FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Gentoo > Gentoo User

 
 
LinkBack Thread Tools
 
Old 02-13-2010, 06:12 AM
Hans de Goede
 
Default Put back the deepcopy of the device stack in ActionDestroyFormat.

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?

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
 

Thread Tools




All times are GMT. The time now is 11:45 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org