Re: [PATCH 3/3] Prune resize and format create/migrate actions if destroying a device.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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.

Resolves: rhbz#575070
Resolves: rhbz#576710
Resolves: rhbz#568759
Related: rhbz#583290

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
--- a/storage/devicetree.py
+++ b/storage/devicetree.py
@@ -210,12 +210,17 @@ class DeviceTree(object):
            creates = self.findActions(devid=a.device.id,
                                       type="create",
                                       object="device")
+            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:
-                continue
+                # 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()):
+                        continue
+
+                    dev_actions.remove(_a)
+
+                if not dev_actions:
+                    # nothing to prune
+                    continue
+
+                start = self._actions.index(dev_actions[0])
+                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 <dcantrell@xxxxxxxxxx>
Red Hat / Honolulu, HI

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iEYEARECAAYFAkvQv9oACgkQ5hsjjIy1Vkk/UQCgu4rVCHQN6ldlHZFbrX/nVoOY
LyYAoPfBW+Jh2WIf+1merfbcHEiy9Rfl
=04ul
-----END PGP SIGNATURE-----

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux