|
|
|
@ -59,6 +59,15 @@ class DeviceHelper:
|
|
|
|
|
return map(lambda x:getUdevDeviceInfo(name=x).get(prop,default),
|
|
|
|
|
self.Get(var))
|
|
|
|
|
|
|
|
|
|
def getPerfectName(self,device):
|
|
|
|
|
info = getUdevDeviceInfo(name=device)
|
|
|
|
|
if 'DM_VG_NAME' in info and 'DM_LV_NAME' in info:
|
|
|
|
|
lvmDeviceName = '/dev/{vg}/{lv}'.format(vg=info['DM_VG_NAME'],
|
|
|
|
|
lv=info['DM_LV_NAME'])
|
|
|
|
|
if path.exists(lvmDeviceName):
|
|
|
|
|
return lvmDeviceName
|
|
|
|
|
return info.get('DEVNAME','')
|
|
|
|
|
|
|
|
|
|
#######################################################
|
|
|
|
|
# Devices variables
|
|
|
|
|
#######################################################
|
|
|
|
@ -299,6 +308,10 @@ class VariableOsDiskDev(ReadonlyVariable,DeviceHelper):
|
|
|
|
|
path.join(self.sysBlockPath,x)),
|
|
|
|
|
disks),[]))),key=self.separateDevice))
|
|
|
|
|
|
|
|
|
|
def humanReadable(self):
|
|
|
|
|
return map(self.getPerfectName,
|
|
|
|
|
self.Get())
|
|
|
|
|
|
|
|
|
|
class VariableOsDiskMount(ReadonlyVariable,DeviceHelper):
|
|
|
|
|
"""
|
|
|
|
|
List mounted points for current operation system
|
|
|
|
@ -577,7 +590,7 @@ class VariableOsLocationData(LocationHelper,TableVariable):
|
|
|
|
|
"to specify the source directory as DISK")
|
|
|
|
|
self.label = _("Locations")
|
|
|
|
|
|
|
|
|
|
class VariableOsLocationSource(LocationHelper,Variable):
|
|
|
|
|
class VariableOsLocationSource(LocationHelper,DeviceHelper,Variable):
|
|
|
|
|
"""
|
|
|
|
|
Source disk or directory
|
|
|
|
|
"""
|
|
|
|
@ -616,7 +629,9 @@ class VariableOsLocationSource(LocationHelper,Variable):
|
|
|
|
|
return self.availDevs()
|
|
|
|
|
|
|
|
|
|
def choice(self):
|
|
|
|
|
return self.fixOsDiskDev(self.availDevs(choice=True)) + [""]
|
|
|
|
|
return map(lambda x:(x,self.getPerfectName(x) or x),
|
|
|
|
|
self.fixOsDiskDev(self.availDevs(choice=True))) \
|
|
|
|
|
+ [("","")]
|
|
|
|
|
|
|
|
|
|
def fixOsDiskDev(self,sourcelist=None):
|
|
|
|
|
"""
|
|
|
|
|