Fix get partition table for device.

Some devices by udev does not contain information about partition table.
Get part table by them childs partitions.
master
Mike Hiretsky 13 years ago
parent 0d7b234672
commit 3de7514fff

@ -229,6 +229,20 @@ class fillVars(object, glob_attr):
return ", ".join(map(lambda x:"%s (%s)"%(x[0],x[1]),
listInterfacesInfo))
def getTableByChild(self,device):
"""Get table by child partitions"""
syspath = getUdevDeviceInfo(name=device).get('DEVPATH','')
if not syspath.startswith('/sys'):
syspath = pathJoin('/sys',syspath)
shortnameDevice = path.basename(device)
childs = filter(lambda x:x.startswith(shortnameDevice),
listDirectory(syspath))
if childs:
child = pathJoin(syspath,childs[0])
return getUdevDeviceInfo(path=child).get('ID_PART_ENTRY_SCHEME','')
return ""
def get_os_device_hash(self):
def onlyDisk(devpath):
prop = getUdevDeviceInfo(devpath)
@ -253,7 +267,8 @@ class fillVars(object, glob_attr):
continue
device = props['DEVNAME']
device_hash[device] = {}
device_hash[device]['table'] = props.get('ID_PART_TABLE_TYPE','')
device_hash[device]['table'] = props.get('ID_PART_TABLE_TYPE',
self.getTableByChild(device))
device_hash[device]['map'] = mapnum
if path.basename(device) in usbdevices:

Loading…
Cancel
Save