[PATCH 04/11] Add a method to reset a device to its original state.

David Lehman dlehman at redhat.com
Tue Sep 25 20:33:29 UTC 2012


---
 pyanaconda/storage/__init__.py |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/pyanaconda/storage/__init__.py b/pyanaconda/storage/__init__.py
index 7bf03bc..a949633 100644
--- a/pyanaconda/storage/__init__.py
+++ b/pyanaconda/storage/__init__.py
@@ -1221,6 +1221,15 @@ class Storage(object):
         self.devicetree.registerAction(ActionDestroyFormat(device))
         self.devicetree.registerAction(ActionCreateFormat(device, format))
 
+    def resetDevice(self, device):
+        """ Cancel all scheduled actions and reset formatting. """
+        actions = self.devicetree.findActions(device=device)
+        for action in reversed(actions):
+            self.devicetree.cancelAction(action)
+
+        # make sure any random overridden attributes are reset
+        device.format = device.originalFormat
+
     def resizeDevice(self, device, new_size):
         classes = []
         if device.resizable:
-- 
1.7.7.6



More information about the anaconda-patches mailing list