summaryrefslogtreecommitdiffstats
path: root/abs/core/LinHES-config/mv_install.py
diff options
context:
space:
mode:
Diffstat (limited to 'abs/core/LinHES-config/mv_install.py')
-rwxr-xr-xabs/core/LinHES-config/mv_install.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/abs/core/LinHES-config/mv_install.py b/abs/core/LinHES-config/mv_install.py
index c032aad..e774521 100755
--- a/abs/core/LinHES-config/mv_install.py
+++ b/abs/core/LinHES-config/mv_install.py
@@ -263,6 +263,7 @@ def create_partitions(diskdevice, size, ptype, startsector):
newstart = 0
totalused = 0
device = parted.getDevice(diskdevice)
+ logging.debug("Sector size is %s %s", %( diskdevice , device.sectorSize))
partdisk = parted.Disk(device)
for partition in partdisk.partitions:
if partition.type != parted.PARTITION_FREESPACE:
@@ -280,7 +281,7 @@ def create_partitions(diskdevice, size, ptype, startsector):
newstart = usedend+1
if startsector == 0:
- newstart = 0
+ newstart = 2048
if size == "ALL":
logging.debug(" Using the rest of the disk %s", (device.length-newstart) )
try:
@@ -292,6 +293,10 @@ def create_partitions(diskdevice, size, ptype, startsector):
# convert size in MB to a length on the device in sectors
length = (int(size) * (1024 * 1024)) / device.sectorSize
logging.debug("Size is %s", length)
+ if length > device.length:
+ length = device.length - newstart
+ logging.info("Size is larger then disk, reducing size")
+ logging.debug("New Size is %s", length)
try:
geom = parted.Geometry(device=device, start=newstart, length=length)
except:
@@ -299,7 +304,9 @@ def create_partitions(diskdevice, size, ptype, startsector):
error_out("invalid parition size")
#collect device constraint
- constraint = device.getConstraint()
+ #constraint = device.getConstraint()
+ #constraint = parted.Constraint(device=device)
+ constraint = parted.Constraint(exactGeom = geom )
# new partition
if ptype == "NORMAL":
newpart = parted.Partition(disk=partdisk, type=parted.PARTITION_NORMAL, geometry=geom)