From 83b3b1716793ed0fa6f139db76a19fbe237d0204 Mon Sep 17 00:00:00 2001 From: Mike Hiretsky Date: Tue, 26 Jul 2011 11:53:09 +0400 Subject: [PATCH] Add detect active lvm and raid members. --- pym/cl_fill_install.py | 17 ++++++++++++++++- pym/cl_install.py | 4 ++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/pym/cl_fill_install.py b/pym/cl_fill_install.py index 91819b1..1fb901e 100644 --- a/pym/cl_fill_install.py +++ b/pym/cl_fill_install.py @@ -27,7 +27,8 @@ from cl_utils import isMount,typeFile,getTupleVersion,pathJoin,isFstabMount,\ getUdevDeviceInfo, getPartitionDevice, getPartitionSize, \ isPkgInstalled, process, checkUtils, readLinesFile, \ FStab, lspci, getInstalledVideo,getDeviceType, \ - getPartitionType, getOsProberHash, getProgPath + getPartitionType, getOsProberHash, getProgPath, \ + getRaidPartitions, getLvmPartitions from cl_distr import DistributiveRepository,PartitionDistributive from cl_fill import clLocale from operator import itemgetter @@ -299,6 +300,8 @@ class fillVars(object, glob_attr): fstab = FStab('/etc/fstab') distrRep = DistributiveRepository() osProberHash = getOsProberHash(getContentFunc=distrRep._getfromcontent) + raidUsedDisks = [] + lvmUsedDisks = [] for disk in new_disks: props = getUdevDeviceInfo(disk) if not "DEVNAME" in props: @@ -337,6 +340,18 @@ class fillVars(object, glob_attr): else: dev_hash['grub'] = "" disk_hash[devName] = dev_hash + if "raid" in dev_hash['type']: + raidUsedDisks.extend(getRaidPartitions(disk)) + if dev_hash['type'].endswith("lvm"): + prop = getUdevDeviceInfo(path=disk) + lvmUsedDisks.extend(getLvmPartitions(prop.get('DM_VG_NAME',''), + prop.get('DM_LV_NAME',''))) + for part in raidUsedDisks: + if part in disk_hash: + disk_hash[part]['type'] = "%s-raidmember"%disk_hash[part]['type'] + for part in lvmUsedDisks: + if part in disk_hash: + disk_hash[part]['type'] = "%s-lvmmember"%disk_hash[part]['type'] return disk_hash def separateDevice(self,device): diff --git a/pym/cl_install.py b/pym/cl_install.py index 4bb4853..95ab364 100644 --- a/pym/cl_install.py +++ b/pym/cl_install.py @@ -1805,6 +1805,10 @@ class cl_install(color_print, SignalInterrupt): return _("Partition on disk") elif "raid-partition" == diskScheme: return _("Partition on RAID") + elif "raidmember" in diskScheme: + return _("RAID member") + elif "lvmmember" in diskScheme: + return _("LVM member") elif "disk" == diskScheme: return _("Disk without partitions") elif "lvm" in diskScheme: