Re: [PATCH 1/2] Put back the deepcopy of the device stack in ActionDestroyFormat.

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

 



Hi,

On 02/12/2010 09:28 PM, David Lehman wrote:
This is needed to make preexisting LUKS LVM PVs work correctly.


Hmm, iirc there were several issues with this approach, doesn't
the need for this indicate a deviceaction sorting problem and
wouldn't it be better to fix that instead?

Regards,

Hans


It reverts commit f944e092f2415caad8856f8cfe6a3834be8f95c4.
---
  storage/deviceaction.py |   17 ++++++++++++++---
  1 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/storage/deviceaction.py b/storage/deviceaction.py
index dbfaf60..61e56d6 100644
--- a/storage/deviceaction.py
+++ b/storage/deviceaction.py
@@ -21,6 +21,8 @@
  # Red Hat Author(s): Dave Lehman<dlehman@xxxxxxxxxx>
  #

+import copy
+
  from udev import *

  from devices import StorageDevice, PartitionDevice
@@ -301,7 +303,12 @@ class ActionDestroyFormat(DeviceAction):

      def __init__(self, device):
          DeviceAction.__init__(self, device)
-        self.origFormat = self.device.format
+        # Save a deep copy of the device stack this format occupies.
+        # This is necessary since the stack of devices and formats
+        # required to get to this format may get yanked out from under
+        # us between now and execute.
+        self._device = copy.deepcopy(device)
+        self.origFormat = self._device.format
          if device.format.exists:
              device.format.teardown()
          self.device.format = None
@@ -309,10 +316,14 @@ class ActionDestroyFormat(DeviceAction):
      def execute(self, intf=None):
          """ wipe the filesystem signature from the device """
          if self.origFormat:
-            self.device.setup()
+            # set up our copy of the original device stack since the
+            # reference we got may have had any number of things changed
+            # since then (most notably, formats removed by this very
+            # class' constructor)
+            self._device.setup()
              self.origFormat.destroy()
              udev_settle()
-            self.device.teardown()
+            self._device.teardown()

      def cancel(self):
          self.device.format = self.origFormat

_______________________________________________
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