From: Thierry Parmentelat Date: Thu, 25 Jun 2015 11:09:08 +0000 (+0200) Subject: upgrade mode was not working; CheckForNewDisks was erroneously taking the disk as... X-Git-Tag: bootmanager-5.3-1~7 X-Git-Url: http://git.onelab.eu/?p=bootmanager.git;a=commitdiff_plain;h=d86e809b0ea2de1447e144a38f9ca413b6c68806 upgrade mode was not working; CheckForNewDisks was erroneously taking the disk as not yet in the volume, and would destroy everything this is now taken care of by beinf a llittle more conservative in ChekForNewDisks --- diff --git a/source/RunlevelAgent.py b/source/RunlevelAgent.py index 9844648..c1843bd 100755 --- a/source/RunlevelAgent.py +++ b/source/RunlevelAgent.py @@ -125,7 +125,7 @@ def start_and_run(): break except: print("Retry in 30 seconds: ", os.popen("uptime").read().strip()) - traceback.print_exc() + traceback.print_exc(limit=5) time.sleep(30) try: diff --git a/source/steps/CheckForNewDisks.py b/source/steps/CheckForNewDisks.py index 223c3ae..38d8464 100644 --- a/source/steps/CheckForNewDisks.py +++ b/source/steps/CheckForNewDisks.py @@ -78,10 +78,17 @@ def Run(vars, log): log.write("Checking device {} to see if it is part " \ "of the volume group.\n".format(device)) - # this is the lvm partition, if it exists on that device - lvm_partition = InstallPartitionDisks.get_partition_path_from_device(device, vars, log) - cmd = "pvdisplay {} | grep -q 'planetlab'".format(lvm_partition) - already_added = utils.sysexec_noerr(cmd, log, shell=True) + # Thierry - June 2015 + # when introducing the 'upgrade' verb, we ran into the situation + # where 'pvdisplay' at this point displays e.g. /dev/sda, instead + # of /dev/sda1 + # we thus consider that if either of these is known, then + # the disk is already part of LVM + first_partition = InstallPartitionDisks.get_partition_path_from_device(device, vars, log) + probe_first_part = "pvdisplay {} | grep -q planetlab".format(first_partition) + probe_device = "pvdisplay {} | grep -q planetlab".format(device) + already_added = utils.sysexec_noerr(probe_first_part, log, shell=True) \ + or utils.sysexec_noerr(probe_device, log, shell=True) if already_added: log.write("It appears {} is part of the volume group, continuing.\n"\ @@ -92,7 +99,7 @@ def Run(vars, log): # an lvm partition on it (new disks won't have this, and that is # what this code is for, so it should be ok). cmd = "parted --script --list {} | grep -q lvm$".format(device) - has_lvm = utils.sysexec_noerr(cmd, log) + has_lvm = utils.sysexec_noerr(cmd, log, shell=True) if has_lvm: log.write("It appears {} has lvm already setup on it.\n".format(device)) paranoid = False diff --git a/source/steps/InstallBootstrapFS.py b/source/steps/InstallBootstrapFS.py index 70d22a5..1de9d70 100644 --- a/source/steps/InstallBootstrapFS.py +++ b/source/steps/InstallBootstrapFS.py @@ -15,6 +15,7 @@ import time from Exceptions import * import utils +import systeminfo import BootServerRequest import BootAPI @@ -245,10 +246,12 @@ def Run(vars, upgrade, log): def CleanupSysimgBeforeUpgrade(sysimg, target_nodefamily, log): areas_to_cleanup = [ - '/usr/lib', + '/boot', + '/usr', '/var', '/etc', - '/boot', + '/run', + '/vsys', ] target_pldistro, target_fcdistro, target_arch = target_nodefamily.split('-')