diff options
author | Peter Jones <pjones@redhat.com> | 2005-03-28 18:50:36 +0000 |
---|---|---|
committer | Peter Jones <pjones@redhat.com> | 2005-03-28 18:50:36 +0000 |
commit | 3d28ee19b7b9ed0453a6a27d13d8c987f2ecb508 (patch) | |
tree | 66f9a1e04c508b498a29b7f1d1f881461f659909 /lvm.py | |
parent | 211f0b5b68d2a07db9e753a305737a8ed86225ec (diff) | |
download | anaconda-3d28ee19b7b9ed0453a6a27d13d8c987f2ecb508.tar.gz anaconda-3d28ee19b7b9ed0453a6a27d13d8c987f2ecb508.tar.xz anaconda-3d28ee19b7b9ed0453a6a27d13d8c987f2ecb508.zip |
Delete snapshot LVs before their parents
Diffstat (limited to 'lvm.py')
-rw-r--r-- | lvm.py | 44 |
1 files changed, 28 insertions, 16 deletions
@@ -207,18 +207,27 @@ def lvlist(): return [] lvs = [] - args = ["lvm", "lvdisplay", "-C", "--noheadings", "--units", "b"] + # field names for "options" are in LVM2.2.01.01/lib/report/columns.h + args = ["lvm", "lvdisplay", "-C", "--noheadings", "--units", "b", + "--nosuffix", "--separator", ":", "--options", + "vg_name,lv_name,lv_size,origin" + ] lvscanout = iutil.execWithCapture(args[0], args, searchPath = 1, stderr = "/dev/tty6") for line in lvscanout.split("\n"): try: - (lv, vg, attr, size) = line.strip()[:-1].split() + (vg, lv, size, origin) = line.strip().split(':') + size = long(math.floor(long(size) / (1024 * 1024))) + if origin == '': + origin = None except: continue - size = long(size) - size = long(math.floor(size / (1024 * 1024))) - log("lv is %s/%s, size of %s" %(vg, lv, size)) - lvs.append( (vg, lv, size) ) + + logmsg = "lv is %s/%s, size of %s" % (vg, lv, size) + if origin: + logmsg += ", snapshot from %s" % (origin,) + log(logmsg) + lvs.append( (vg, lv, size, origin) ) return lvs @@ -228,16 +237,18 @@ def pvlist(): return [] pvs = [] - args = ["lvm", "pvdisplay", "-C", "--noheadings", "--units", "b"] + args = ["lvm", "pvdisplay", "-C", "--noheadings", "--units", "b", + "--nosuffix", "--separator", ":", "--options", + "pv_name,vg_name,dev_size" + ] scanout = iutil.execWithCapture(args[0], args, searchPath = 1, stderr = "/dev/tty6") for line in scanout.split("\n"): try: - (dev, vg, format, attr, size, free) = line.strip()[:-1].split() + (dev, vg, size) = line.strip().split(':') + size = long(math.floor(long(size) / (1024 * 1024))) except: continue - size = long(size[:-1]) - size = long(math.floor(size / (1024 * 1024))) log("pv is %s in vg %s, size is %s" %(dev, vg, size)) pvs.append( (dev, vg, size) ) @@ -249,18 +260,19 @@ def vglist(): return [] vgs = [] - args = ["lvm", "vgdisplay", "-C", "--noheadings", "--units", "b", "-v"] + args = ["lvm", "vgdisplay", "-C", "--noheadings", "--units", "b", + "--nosuffix", "--separator", ":", "--options", + "vg_name,vg_size,vg_extent_size" + ] scanout = iutil.execWithCapture(args[0], args, searchPath = 1, stderr = "/dev/tty6") for line in scanout.split("\n"): try: - (vg, attr, pesize, numpv, numlv, numsn, size, free, uuid) = line.strip().split() + (vg, size, pesize) = line.strip().split(':') + size = long(math.floor(long(size) / (1024 * 1024))) + pesize = long(pesize)/1024 except: continue - size = long(size[:-1]) - size = long(math.floor(size / (1024 * 1024))) - pesize = long(pesize[:-1]) - pesize /= 1024 log("vg %s, size is %s, pesize is %s" %(vg, size, pesize)) vgs.append( (vg, size, pesize) ) |