[PATCH 02/11] Do not change device status during populate in normal mode. (#817064)

David Lehman dlehman at redhat.com
Mon Feb 4 23:32:28 UTC 2013


---
 blivet/devices.py    | 31 +++++++++++++++++--------------
 blivet/devicetree.py |  7 +++++--
 2 files changed, 22 insertions(+), 16 deletions(-)

diff --git a/blivet/devices.py b/blivet/devices.py
index 1a4b4d0..28a5a92 100644
--- a/blivet/devices.py
+++ b/blivet/devices.py
@@ -2120,7 +2120,7 @@ class LVMVolumeGroupDevice(DMDevice):
         device.addChild()
 
         # now see if the VG can be activated
-        if self.complete:
+        if self.complete and flags.installer_mode:
             self.setup()
 
     def _removeDevice(self, device):
@@ -2933,20 +2933,21 @@ class MDRaidArrayDevice(StorageDevice):
         self.devices.append(device)
         device.addChild()
 
-        device.setup()
-        udev_settle()
+        if flags.installer_mode:
+            device.setup()
+            udev_settle()
 
-        if self.spares > 0:
-            # mdadm doesn't like it when you try to incrementally add spares
-            return
+            if self.spares > 0:
+                # mdadm doesn't like it when you try to incrementally add spares
+                return
 
-        try:
-            mdraid.mdadd(device.path)
-            # mdadd causes udev events
-            udev_settle()
-        except MDRaidError as e:
-            log.warning("failed to add member %s to md array %s: %s"
-                        % (device.path, self.path, e))
+            try:
+                mdraid.mdadd(device.path)
+                # mdadd causes udev events
+                udev_settle()
+            except MDRaidError as e:
+                log.warning("failed to add member %s to md array %s: %s"
+                            % (device.path, self.path, e))
 
         if self.status:
             # we always probe since the device may not be set up when we want
@@ -4111,7 +4112,9 @@ class BTRFSVolumeDevice(BTRFSDevice):
 
     def listSubVolumes(self):
         subvols = []
-        self.setup(orig=True)
+        if flags.installer_mode:
+            self.setup(orig=True)
+
         try:
             self._do_temp_mount(orig=True)
         except FSError as e:
diff --git a/blivet/devicetree.py b/blivet/devicetree.py
index 26a853b..a627398 100644
--- a/blivet/devicetree.py
+++ b/blivet/devicetree.py
@@ -1212,7 +1212,7 @@ class DeviceTree(object):
                 mirrors[name]["log"] = lv_sizes[index]
 
             lv_dev = self.getDeviceByName(name)
-            if lv_dev is None:
+            if lv_dev is None and flags.installer_mode:
                 lv_uuid = lv_uuids[index]
                 lv_size = lv_sizes[index]
                 lv_device = LVMLogicalVolumeDevice(lv_name,
@@ -1797,7 +1797,7 @@ class DeviceTree(object):
 
         old_devices = {}
 
-        if os.access("/etc/multipath.conf", os.W_OK):
+        if os.access("/etc/multipath.conf", os.W_OK) and flags.installer_mode:
             self.__multipathConfigWriter.writeConfig(self.mpathFriendlyNames)
             self.topology = devicelibs.mpath.MultipathTopology(udev_get_block_devices())
             log.info("devices to scan: %s" %
@@ -1879,6 +1879,9 @@ class DeviceTree(object):
 
     def teardownAll(self):
         """ Run teardown methods on all devices. """
+        if not flags.installer_mode:
+            return
+
         for device in self.leaves:
             if device.protected:
                 continue
-- 
1.8.1



More information about the anaconda-patches mailing list