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

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



On Sat, 2010-02-13 at 08:12 +0100, Hans de Goede wrote:
> 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?

I don't recall the previous approach causing problems. Mostly I just
wished it wasn't necessary. It isn't related to action sorting, but I
will admit that I don't totally understand why it happens in certain
situations and not in others.

Since we're waiting on beta1 to clear anyway I'll take another look at
this and see if there's a better solution.

Dave

> 
> 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 redhat com>
> >   #
> >
> > +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 redhat com
> https://www.redhat.com/mailman/listinfo/anaconda-devel-list



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