From: Mark Huang Date: Sat, 13 Jan 2007 17:41:53 +0000 (+0000) Subject: - fix get_block_device_list() regression X-Git-Tag: planetlab-4_0-rc1~8 X-Git-Url: http://git.onelab.eu/?p=bootmanager.git;a=commitdiff_plain;h=6582d10277c2041a840c54612c6255f9eaac5e4f - fix get_block_device_list() regression - devfs under 2.4 (old boot cds) used to list partitions in a format such as scsi/host0/bus0/target0/lun0/disc and /dev/sda, etc. were just symlinks --- diff --git a/source/systeminfo.py b/source/systeminfo.py index ccc7f79..6802386 100755 --- a/source/systeminfo.py +++ b/source/systeminfo.py @@ -140,6 +140,16 @@ def get_block_device_list(vars = {}, log = sys.stderr): devicename = "cciss/c%dd%d" % (M,N) valid_blk_names[devicename]=None + for devicename in valid_blk_names.keys(): + # devfs under 2.4 (old boot cds) used to list partitions + # in a format such as scsi/host0/bus0/target0/lun0/disc + # and /dev/sda, etc. were just symlinks + try: + devfsname= os.readlink( "/dev/%s" % devicename ) + valid_blk_names[devfsname]= devicename + except OSError: + pass + # only do this once every system boot if not os.access(DEVICES_SCANNED_FLAG, os.R_OK): @@ -180,6 +190,8 @@ def get_block_device_list(vars = {}, log = sys.stderr): # skip and ignore any partitions if not valid_blk_names.has_key(device): continue + elif valid_blk_names[device] is not None: + device= valid_blk_names[device] try: major= int(parts[0])