diff --git a/pym/cl_install.py b/pym/cl_install.py index 433c30b..778cf6a 100644 --- a/pym/cl_install.py +++ b/pym/cl_install.py @@ -26,7 +26,8 @@ from cl_utils import runOsCommand,appendProgramToEnvFile, \ removeProgramToEnvFile,pathJoin, \ scanDirectory,process,getTupleVersion, \ detectDeviceForPartition,listDirectory, \ - cmpVersion,STDOUT,getUdevDeviceInfo + cmpVersion,STDOUT,getUdevDeviceInfo, \ + getLvmPartitions from cl_vars_share import varsShare from cl_kernel_utils import KernelConfig,InitRamFs @@ -1332,6 +1333,49 @@ class cl_install(color_print, SignalInterrupt): usingCdromPart[0]) return False + # detect using RAID member disks + raidMemberData = filter(lambda x: "raidmember" in x[0], + zip(self.clVars.Get('os_disk_type'), + self.clVars.Get('os_disk_dev'))) + raidMemberPartitions = map(lambda x:x[1],raidMemberData) + usingRaidMemberPart = list(set(usedDevices)&set(raidMemberPartitions)) + if usingRaidMemberPart: + raidMemberData = filter(lambda x:x[1] in usingRaidMemberPart, + raidMemberData)[0][0] + raidMemberData = raidMemberData.rpartition("raidmember(")[2] + raidMemberData = raidMemberData.partition(")")[0] + self.printERROR(_("Imposible to use active {typepart} member" + " {part} for installation").format( + typepart="RAID",part=usingRaidMemberPart[0])) + self.printERROR( + _("For using this partition need to stop RAID %s")% + raidMemberData) + self.printERROR(" mdadm -S %s"%raidMemberData) + return False + + # detect using LVM member disks + lvmMemberData = filter(lambda x: "lvmmember" in x[0], + zip(self.clVars.Get('os_disk_type'), + self.clVars.Get('os_disk_dev'))) + lvmMemberPartitions = map(lambda x:x[1],lvmMemberData) + usingLvmMemberPart = list(set(usedDevices)&set(lvmMemberPartitions)) + if usingLvmMemberPart: + lvmMemberData = filter(lambda x:x[1] in usingLvmMemberPart[0], + lvmMemberData)[0][0] + lvmMemberData = lvmMemberData.rpartition("lvmmember(")[2] + lvmMemberData = lvmMemberData.partition(")")[0] + prop = getUdevDeviceInfo(name=lvmMemberData) + vgName = prop.get('DM_VG_NAME','') + self.printERROR(_("Imposible to use active {typepart} member" + " {part} for installation").format( + typepart="LVM",part=usingLvmMemberPart[0])) + self.printERROR( + _("For using this partition need to remove LVM %s")% + lvmMemberData) + self.printERROR(" vgremove %s"%vgName) + self.printERROR(" pvremove %s"%usingLvmMemberPart[0]) + return False + srcMountPoints = map(lambda x:x['srcMountPoint'],listBinds) destMountPoints = map(lambda x:x['destMountPoint'],listBinds) wrongBind = filter(lambda x:x in destMountPoints,srcMountPoints) @@ -1810,9 +1854,11 @@ class cl_install(color_print, SignalInterrupt): diskScheme = diskScheme.partition(")")[0] return _("RAID %s member")%diskScheme elif "lvmmember" in diskScheme: - diskScheme = diskScheme.rpartition("lvmmember(")[2] - diskScheme = diskScheme.partition(")")[0] - return _("LVM %s member")%diskScheme + lvms = [] + while "lvmmember" in diskScheme: + diskScheme,op,data = diskScheme.rpartition("lvmmember(") + lvms.append(data.partition(")")[0]) + return _("LVM %s member")%",".join(lvms) elif "disk" == diskScheme: return _("Disk without partitions") elif "lvm" in diskScheme: