diff options
author | Peter Jones <pjones@redhat.com> | 2005-03-07 00:40:34 +0000 |
---|---|---|
committer | Peter Jones <pjones@redhat.com> | 2005-03-07 00:40:34 +0000 |
commit | 8b4c702d0c2c6130c5263a4944405efa1301ced9 (patch) | |
tree | 6bb5ec58b687b7fa91494d5cb428cc40043b46fc /lvm.py | |
parent | 23895daf9d93b31f70875380b5211c3c433927c6 (diff) | |
download | anaconda-8b4c702d0c2c6130c5263a4944405efa1301ced9.tar.gz anaconda-8b4c702d0c2c6130c5263a4944405efa1301ced9.tar.xz anaconda-8b4c702d0c2c6130c5263a4944405efa1301ced9.zip |
* autopart.py: fix growable size log to show IDs instead of python's
<instance> info.
log how much free space we're starting with.
don't clamp an lv's total size, instead clamp pv's sizes appropriately
* lvm.py: remove and recreate all PVs when we do a vgremove, so they
don't lose 1 PE each time due to an lvm2 bug.
log what lvm commands are being run, since that doesn't go into lvmout.
log total vs actual in getVGFreeSpace
* partRequests.py: get rid of getPVSize, that way can't work (oopsie).
remove bogus check in getActualSize.
clamp totalspace for preexisting PVs.
clamp each PV's size and trim 1 PE off when computing total space.
don't clamp the LV's overall size.
* iw/lvm_dialog_gui.py: clamp each PV and trim 1 PE when computing
availSpaceMB.
Ow. My head hurts. But autopartition actually works, and even shows the
same numbers as the editor afterwards.
Diffstat (limited to 'lvm.py')
-rw-r--r-- | lvm.py | 38 |
1 files changed, 37 insertions, 1 deletions
@@ -152,6 +152,13 @@ def vgremove(vgname): if flags.test or lvmDevicePresent == 0: return + # find the Physical Volumes which make up this Volume Group, so we + # can prune and recreate them. + pvs = [] + for pv in pvlist(): + if pv[1] == vgname: + pvs.append(pv[0]) + # we'll try to deactivate... if it fails, we'll probably fail on # the removal too... but it's worth a shot try: @@ -161,6 +168,7 @@ def vgremove(vgname): args = ["lvm", "vgremove", vgname] + log(string.join(args, ' ')) rc = iutil.execWithRedirect(args[0], args, stdout = output, stderr = output, @@ -168,6 +176,31 @@ def vgremove(vgname): if rc: raise SystemError, "vgremove failed" + # now iterate all the PVs we've just freed up, so we reclaim the metadata + # space. This is an LVM bug, AFAICS. + for pvname in pvs: + args = ["lvm", "pvremove", pvname] + + log(string.join(args, ' ')) + rc = iutil.execWithRedirect(args[0], args, + stdout = output, + stderr = output, + searchPath = 1) + + if rc: + raise SystemError, "pvremove failed" + + args = ["lvm", "pvcreate", "-ff", "-y", "-v", pvname] + + log(string.join(args, ' ')) + rc = iutil.execWithRedirect(args[0], args, + stdout = output, + stderr = output, + searchPath = 1) + + if rc: + raise SystemError, "pvcreate failed for %s" % (pvname,) + def lvlist(): global lvmDevicePresent if lvmDevicePresent == 0: @@ -388,5 +421,8 @@ def getVGUsedSpace(vgreq, requests, diskset): def getVGFreeSpace(vgreq, requests, diskset): used = getVGUsedSpace(vgreq, requests, diskset) + log("used space is %s" % (used,)) - return vgreq.getActualSize(requests, diskset) - used + total = vgreq.getActualSize(requests, diskset) + log("actual space is %s" % (total,)) + return total - used |