[PATCH 04/11] Add a method to reset a device to its original state.
Brian C. Lane
bcl at redhat.com
Wed Sep 26 00:46:10 UTC 2012
On Tue, Sep 25, 2012 at 03:33:29PM -0500, David Lehman wrote:
> ---
> 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
> +
Should this be using copy.copy()? Otherwise we've just set a reference
to the originalFormat, which was a copy of format and now changes will
propagate again.
--
Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 482 bytes
Desc: not available
URL: <https://lists.fedorahosted.org/pipermail/anaconda-patches/attachments/20120925/93ddb69d/attachment.sig>
More information about the anaconda-patches
mailing list