diff --git a/storage/deviceaction.py b/storage/deviceaction.py
index dbfaf60..61e56d6 100644
@@ -21,6 +21,8 @@
# Red Hat Author(s): Dave Lehman<email@example.com>
from udev import *
from devices import StorageDevice, PartitionDevice
@@ -301,7 +303,12 @@ class ActionDestroyFormat(DeviceAction):
def __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
self.device.format = None
@@ -309,10 +316,14 @@ class ActionDestroyFormat(DeviceAction):
def execute(self, intf=None):
""" wipe the filesystem signature from the device """
+ # 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)