[PATCH 1/5] Don't store a copy of ActionDestroyFormat's device attr.

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

 



---
 storage/deviceaction.py |   25 +++++++------------------
 1 files changed, 7 insertions(+), 18 deletions(-)

diff --git a/storage/deviceaction.py b/storage/deviceaction.py
index 0b34555..7e73dfb 100644
--- a/storage/deviceaction.py
+++ b/storage/deviceaction.py
@@ -21,8 +21,6 @@
 # Red Hat Author(s): Dave Lehman <dlehman@xxxxxxxxxx>
 #
 
-import copy
-
 from udev import *
 
 from devices import StorageDevice, PartitionDevice
@@ -291,12 +289,7 @@ class ActionDestroyFormat(DeviceAction):
 
     def __init__(self, device):
         DeviceAction.__init__(self, device)
-        # 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
+        self.origFormat = self.device.format
         if device.format.exists:
             device.format.teardown()
         self.device.format = None
@@ -304,20 +297,16 @@ class ActionDestroyFormat(DeviceAction):
     def execute(self, intf=None):
         """ wipe the filesystem signature from the device """
         if self.origFormat:
-            if isinstance(self._device, PartitionDevice) and \
+            if isinstance(self.device, PartitionDevice) and \
                self.origFormat.partedFlag is not None:
                 # unset partition flags and commit
-                self._device.unsetFlag(self.origFormat.partedFlag)
-                self._device.disk.format.commitToDisk()
-
-            # 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.device.unsetFlag(self.origFormat.partedFlag)
+                self.device.disk.format.commitToDisk()
+
+            self.device.setup()
             self.origFormat.destroy()
             udev_settle()
-            self._device.teardown()
+            self.device.teardown()
 
     def cancel(self):
         self.device.format = self.origFormat
-- 
1.6.0.6

_______________________________________________
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