Prune resize and format create/migrate actions if destroying a device.
-----BEGIN PGP SIGNED MESSAGE-----
And this one looks good too. Comments below.
On Thu, 22 Apr 2010, David Lehman wrote:
Also, only prune actions on a single device id at a time for destroy
actions. Trying to handle several loops at once is messy and dangerous.
Please clone the last 3 BZs here to RHEL-6 bugs and reference them in the
rhel6-branch commit msg.
storage/devicetree.py | 22 ++++++++++++++++++++--
1 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/storage/devicetree.py b/storage/devicetree.py
index 377f88d..03827df 100644
@@ -210,12 +210,17 @@ class DeviceTree(object):
creates = self.findActions(devid=a.device.id,
+ log.debug("found %d create and %d destroy actions for device id %d"
+ % (len(creates), len(destroys), a.device.id))
# If the device is not preexisting, we remove all actions up
# to and including the last destroy action.
# If the device is preexisting, we remove all actions from
# after the first destroy action up to and including the last
# destroy action.
+ # If the device is preexisting and there is only one device
+ # destroy action we remove all resize and format create/migrate
+ # actions on that device that precede the destroy action.
loops = 
first_destroy_idx = None
first_create_idx = None
@@ -235,12 +240,25 @@ class DeviceTree(object):
start = first_create_idx
stop_action = destroys[-1]
+ dev_actions = self.findActions(devid=a.device.id)
if start is None:
+ # only one device destroy, so prune preceding resizes and
+ # format creates and migrates
+ for _a in dev_actions[:]:
+ if _a.isResize() or (_a.isFormat() and not _a.isDestroy()):
+ if not dev_actions:
+ # nothing to prune
+ start = self._actions.index(dev_actions)
+ stop_action = dev_actions[-1]
# now we remove all actions on this device between the start
# index (into self._actions) and stop_action.
- dev_actions = self.findActions(path=a.device.path)
for rem in dev_actions:
end = self._actions.index(stop_action)
if start <= self._actions.index(rem) <= end:
David Cantrell <email@example.com>
Red Hat / Honolulu, HI
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
-----END PGP SIGNATURE-----
Anaconda-devel-list mailing list