From c24d5decb0f77dd608d2d7887c528e0a1c060281 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Fri, 3 Dec 2004 22:03:34 +0000 Subject: 2004-12-03 Jeremy Katz * lvm.py (partialvgs): Detect partial volume groups. --- ChangeLog | 7 +++++++ lvm.py | 20 ++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/ChangeLog b/ChangeLog index dbca5be50..e0849df83 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2004-12-03 Jeremy Katz + * lvm.py (partialvgs): Detect partial volume groups. + + * partitions.py (Partitions.getPartialLVMRequests): Get partial + volume group requests + (Partitions.isVolumeGroupNameInUse): If we have a partial by the + requested name, let it be known so that we avoid conflicts. + * partRequests.py (PartialVolumeGroupRequestSpec.__init__): Add partial volume group request for handling non-complete volume groups so we avoid conflicting names. diff --git a/lvm.py b/lvm.py index ef4b879d6..954783afe 100644 --- a/lvm.py +++ b/lvm.py @@ -227,6 +227,26 @@ def vglist(): return vgs +def partialvgs(): + global lvmDevicePresent + if lvmDevicePresent == 0: + return [] + + vgs = [] + args = ["lvm", "vgdisplay", "-C", "--noheadings", "--units", "b"] + scanout = iutil.execWithCapture(args[0], args, searchPath = 1, + stderr = "/dev/tty6") + for line in scanout.split("\n"): + try: + (vg, numpv, numlv, numsn, attr, size, free) = line.strip()[:-1].split() + except: + continue + if attr.find("p") != -1: + log("vg %s, attr is %s" %(vg, attr)) + vgs.append(vg) + + return vgs + # FIXME: this is a hack. we really need to have a --force option. def unlinkConf(): lvmroot = "/etc/lvm" -- cgit