X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=source%2Fsteps%2FInstallPartitionDisks.py;h=10021b4d4c00422520607df5003f7bedc69fcb29;hb=31fbaa36b8651ad4fe29996e1540e8bd952a398d;hp=95345cc7a252bdaf151fe930d871febb88ee9adf;hpb=cd3c345d82f6920dc01d1a2a00b8ef9ea76fc5dc;p=bootmanager.git diff --git a/source/steps/InstallPartitionDisks.py b/source/steps/InstallPartitionDisks.py index 95345cc..10021b4 100644 --- a/source/steps/InstallPartitionDisks.py +++ b/source/steps/InstallPartitionDisks.py @@ -57,7 +57,7 @@ def Run( vars, log ): if NODE_MODEL_OPTIONS & ModelOptions.RAWDISK: VSERVERS_SIZE= "-1" - if "VSERVER_SIZE" in vars: + if "VSERVERS_SIZE" in vars: VSERVERS_SIZE= vars["VSERVERS_SIZE"] if VSERVERS_SIZE == "" or VSERVERS_SIZE == 0: raise ValueError, "VSERVERS_SIZE" @@ -80,7 +80,7 @@ def Run( vars, log ): utils.sysexec_noerr( "lvremove -f %s" % PARTITIONS["swap"], log ) utils.sysexec_noerr( "lvremove -f %s" % PARTITIONS["vservers"], log ) utils.sysexec_noerr( "vgchange -an", log ) - utils.sysexec_noerr( "vgremove planetlab", log ) + utils.sysexec_noerr( "vgremove -f planetlab", log ) log.write( "Running vgscan for devices\n" ) utils.sysexec_noerr( "vgscan", log ) @@ -139,7 +139,7 @@ def Run( vars, log ): #utils.sysexec( TEMP_PATH + "vgchange -ay planetlab", log ) # make swap - utils.sysexec( "mkswap %s" % PARTITIONS["swap"], log ) + utils.sysexec( "mkswap -f %s" % PARTITIONS["swap"], log ) # check if badhd option has been set option = '' @@ -183,20 +183,27 @@ def single_partition_device( device, vars, log ): """ # two forms, depending on which version of pyparted we have + # v1 does not have a 'version' method + # v2 and above does, but to make it worse, + # parted-3.4 on f14 has parted.version broken and raises SystemError try: - version=parted.version() + parted.version() return single_partition_device_2_x (device, vars, log) - except: + except AttributeError: + # old parted does not have version at all return single_partition_device_1_x (device, vars, log) - - + except SystemError: + # let's assume this is >=2 + return single_partition_device_2_x (device, vars, log) + except: + raise def single_partition_device_1_x ( device, vars, log): lvm_flag= parted.partition_flag_get_by_name('lvm') try: - print >>log, "Using pyparted 1.x" + log.write("Using pyparted 1.x\n") # wipe the old partition table utils.sysexec( "dd if=/dev/zero of=%s bs=512 count=1" % device, log ) @@ -239,7 +246,7 @@ def single_partition_device_1_x ( device, vars, log): def single_partition_device_2_x ( device, vars, log): try: - print >>log, "Using pyparted 2.x" + log.write("Using pyparted 2.x\n") # wipe the old partition table utils.sysexec( "dd if=/dev/zero of=%s bs=512 count=1" % device, log ) # get the device