[rhel6-branch] mpath: do not deactivate mpath device upon its teardown.

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

 



So /dev/mapper/mpathx is still existing after the findrootparts step tears
the mpath device down. As we change the format of mpathx to disklabel,
parted device initialization will need /dev/mapper/mpathx to exist.

Related: rhbz#624175
---
 storage/devices.py           |   13 ++++++++++---
 storage/formats/disklabel.py |   24 ++++++++++++++----------
 2 files changed, 24 insertions(+), 13 deletions(-)

diff --git a/storage/devices.py b/storage/devices.py
index ec84641..82a46f8 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -3213,6 +3213,16 @@ class MultipathDevice(DMDevice):
                 self.format.teardown()
             udev_settle()
 
+        if recursive:
+            self.teardownParents(recursive=recursive)
+
+    def deactivate(self):
+        """ 
+        This is never called, included just for documentation.
+
+        If we called this during teardown(), we wouldn't be able to get parted
+        object because /dev/mapper/mpathX wouldn't exist.
+        """
         if self.exists and os.path.exists(self.path):
             #self.teardownPartitions()
             #rc = iutil.execWithRedirect("multipath",
@@ -3232,9 +3242,6 @@ class MultipathDevice(DMDevice):
                 raise MPathError("failed to tear down multipath device %s: %s"
                                 % (self.name, e))
 
-        if recursive:
-            self.teardownParents(recursive=recursive)
-
     def setup(self, intf=None, orig=False):
         """ Open, or set up, a device. """
         log_method_call(self, self.name, orig=orig, status=self.status)
diff --git a/storage/formats/disklabel.py b/storage/formats/disklabel.py
index 10c9bb9..c9ac5a0 100644
--- a/storage/formats/disklabel.py
+++ b/storage/formats/disklabel.py
@@ -147,17 +147,21 @@ class DiskLabel(DeviceFormat):
 
     @property
     def partedDevice(self):
-        if not self._partedDevice and self.device and \
-           os.path.exists(self.device):
-            # We aren't guaranteed to be able to get a device.  In
-            # particular, built-in USB flash readers show up as devices but
-            # do not always have any media present, so parted won't be able
-            # to find a device.
-            try:
-                 self._partedDevice = parted.Device(path=self.device)
-            except (_ped.IOException, _ped.DeviceException):
-                 pass
+        if not self._partedDevice and self.device:
+            if os.path.exists(self.device):
+                # We aren't guaranteed to be able to get a device.  In
+                # particular, built-in USB flash readers show up as devices but
+                # do not always have any media present, so parted won't be able
+                # to find a device.
+                try:
+                    self._partedDevice = parted.Device(path=self.device)
+                except (_ped.IOException, _ped.DeviceException) as e:
+                    log.error("DiskLabel.partedDevice: Parted exception: %s" % e)
+            else:
+                log.info("DiskLabel.partedDevice: %s does not exist" % self.device)
 
+        if not self._partedDevice:
+            log.info("DiskLabel.partedDevice is not having a good time, returning None")
         return self._partedDevice
 
     @property
-- 
1.7.1.1

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux