Add autodetect mbr for lvm and raid devices

master3.3
Mike Hiretsky 12 years ago
parent 1d66245a05
commit 75e17eec6f

@ -182,7 +182,9 @@ class AutoPartition:
def _removeVolumeGroup(self,vgname):
vgRemoveProg = getProgPath('/sbin/vgremove')
return process(vgRemoveProg,vgname,"-f").success()
# double remove volume group
return process(vgRemoveProg,vgname,"-f").success() or \
process(vgRemoveProg,vgname,"-f").success()
def recreateLvm(self,table,devices,data,vgname):
"""
@ -628,8 +630,11 @@ class VariableClAutopartitionDiskType(ReadonlyVariable,AutopartitionHelper):
def get(self):
if self.Get('cl_autopartition_set') == "auto":
return map(lambda x:"disk-partition",
self.Get('cl_autopartition_disk_dev'))
if self.Get('cl_autopartition_lvm_set')=="on":
diskType = "LVM"
else:
diskType = "disk-partition"
return [diskType]*len(self.Get('cl_autopartition_disk_dev'))
return []
class VariableClAutopartitionDiskSize(ReadonlyVariable,AutopartitionHelper):

@ -802,7 +802,7 @@ class VariableOsLocationDest(LocationHelper,Variable):
installTypes = zip(self.Get('os_install_disk_dev'),
self.Get('os_install_disk_type'))
for checkType in ("raid","lvm"):
memberData = filter(lambda x:checkType in x[1],
memberData = filter(lambda x:checkType+"member" in x[1],
installTypes)
if memberData:
raise VariableError(
@ -1290,6 +1290,9 @@ class VariableOsInstallMbr(LocationHelper,Variable):
TODO: add get list of devices if install on RAID
"""
if self.Get('cl_autopartition_set') == 'auto' and \
self.Get('cl_autopartition_lvm_set') == 'on':
return self.Get('cl_autopartition_device')
if self.Get('os_install_root_type') in ("flash","usb-hdd"):
rootdev = self.Get('os_install_root_dev')
device = filter(lambda x:x in rootdev,
@ -1298,15 +1301,35 @@ class VariableOsInstallMbr(LocationHelper,Variable):
return [device[0]]
else:
return []
bootDev = self.Select('os_install_disk_dev',
where='os_install_disk_mount',
_in=('/','/boot'),sort="DESC",limit=1)
# if install on lvm detected
if self.Get('os_install_lvm_set') == "on":
if bootDev:
group = self.Select('os_lvm_vgname',
where='os_lvm_pvname',eq=bootDev)
disks = self.Select('os_lvm_pvname',
where='os_lvm_vgname',_in=group)
return self.Select('os_disk_parent',
where='os_disk_dev',
_in=disks)
if self.Get('os_install_mdadm_set') == "on":
if bootDev:
disks = self.Select('os_disk_parent',
where='os_disk_type',
like='raidmember\(%s\)'%bootDev)
if disks:
return disks
# if loaded system livecd
if self.Get('os_root_type') == "livecd":
# search /boot device or / device, by priority /boot,/
bootDev=self.Select('os_install_disk_parent',
bootDevice=self.Select('os_install_disk_parent',
where='os_install_disk_mount',
_in=('/','/boot'),
sort="DESC")[:1]
if bootDev:
return bootDev
# search /boot device or / device, by priority /boot,/
if bootDevice:
return bootDevice
if self.Get('os_device_dev'):
return [self.Get('os_device_dev')[0]]
return []

@ -362,7 +362,7 @@ class VariableOsInstallLvmSet(ReadonlyVariable):
def get(self):
for typeDisk in self.Get('os_install_disk_type'):
if "lvm" in typeDisk:
if "lvm" in typeDisk.lower():
return "on"
else:
return "off"
@ -375,7 +375,7 @@ class VariableOsInstallMdadmSet(ReadonlyVariable):
def get(self):
for typeDisk in self.Get('os_install_disk_type'):
if "lvm" in typeDisk:
if "raid" in typeDisk.lower():
return "on"
else:
return "off"

Loading…
Cancel
Save