From 8b5b8284b88a5cd259646e4f5d92bcfb9bcce06e Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Fri, 6 Nov 2009 14:22:26 +0100 Subject: Don't activate / de-activate dmraid sets on setup / teardown Since BIOS RAID sets never change there is no need to deactivate them and later activate them again. This also fixes problems in case the followng happens: 1) raid sets get activated, pyblock creates device-mappings for partitions on the set. 2) The partition table changes while exectuing actions 3) the raid sets gets de-activated, because of devicetree.processActions() tearing down everything in response to a disklabel commit error caused by lvm or mdraid using a partiton 4) pyblock tries to remove the partition mappings as it has created them, but the partition table has changed, and when parted commits partition table changes of a dmraid set to disk, it also modifies the partitions device-mappings. pyblock tries to remove a non existing mapping -> backtrace. --- storage/devices.py | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) (limited to 'storage') diff --git a/storage/devices.py b/storage/devices.py index bc8951f90..7b4b314d5 100644 --- a/storage/devices.py +++ b/storage/devices.py @@ -2682,34 +2682,19 @@ class DMRaidArrayDevice(DiskDevice): else: self.sysfsPath = '' - def teardown(self, recursive=None): - """ Close, or tear down, a device. """ + def deactivate(self): + """ Deactivate the raid set. """ log_method_call(self, self.name, status=self.status) - if not self.exists: - raise DeviceError("device has not been created", self.name) - - if self.format.exists: - self.format.teardown() - udev_settle(timeout=10) - # This call already checks if the set is not active. self._raidSet.deactivate() - def setup(self, intf=None): - """ Open, or set up, a device. """ + def activate(self): + """ Activate the raid set. """ log_method_call(self, self.name, status=self.status) - if not self.exists: - raise DeviceError("device has not been created", self.name) - # This call already checks if the set is active. self._raidSet.activate(mknod=True) - udev_settle() - # we always probe since the device may not be set up when we want - # information about it - self._size = self.currentSize - @property def mediaPresent(self): # Even if teared down we still want to show up in storage.disks -- cgit