[master 2/3] Do format handling when adding devices from format handlers.

dwlehman installerbot-noreply at redhat.com
Thu May 28 18:06:31 UTC 2015


From: David Lehman <dlehman at redhat.com>

This way the formatting is set up correctly so that any subsequent
lookup of the newly-added device will find the correct format info.

Related: rhbz#1197582
---
 blivet/populator.py | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/blivet/populator.py b/blivet/populator.py
index 157178a..9c1fd89 100644
--- a/blivet/populator.py
+++ b/blivet/populator.py
@@ -24,7 +24,6 @@
 import re
 import shutil
 import pprint
-import copy
 import parted
 
 from gi.repository import BlockDev as blockdev
@@ -745,7 +744,7 @@ def addUdevDevice(self, info):
         # now handle the device's formatting
         self.handleUdevDeviceFormat(info, device)
         if device_added:
-            device.originalFormat = copy.copy(device.format)
+            device.updateOriginalFormat()
         device.deviceLinks = udev.device_get_symlinks(info)
 
     def handleUdevDiskLabelFormat(self, info, device):
@@ -843,6 +842,11 @@ def handleUdevLUKSFormat(self, info, device):
             else:
                 luks_device.updateSysfsPath()
                 self.devicetree._addDevice(luks_device)
+
+                # do format handling immediately to keep things consistent
+                luks_info = udev.get_device(luks_device.sysfsPath)
+                self.handleUdevDeviceFormat(luks_info, luks_device)
+                luks_device.updateOriginalFormat()
         else:
             log.warning("luks device %s already in the tree",
                         device.format.mapName)
@@ -1002,8 +1006,9 @@ def addLV(lv):
                         log.error("failed to get udev data for lv %s", lv_device.name)
                         return
 
-                    # do format handling now
-                    self.addUdevDevice(lv_info)
+                    # do format handling immediately to keep things consistent
+                    self.handleUdevDeviceFormat(lv_info, lv_device)
+                    lv_device.updateOriginalFormat()
 
         raid_items = dict((n.replace("[", "").replace("]", ""),
                      {"copies": 0, "log": Size(0), "meta": Size(0)})
@@ -1146,6 +1151,11 @@ def handleUdevMDMemberFormat(self, info, device):
             md_array.parents.append(device)
             self.devicetree._addDevice(md_array)
 
+            # do format handling now to keep things consistent
+            array_info = udev.get_device(md_array.sysfsPath)
+            self.handleUdevDeviceFormat(array_info, md_array)
+            md_array.updateOriginalFormat()
+
     def handleUdevDMRaidMemberFormat(self, info, device):
         # if dmraid usage is disabled skip any dmraid set activation
         if not flags.dmraid:


-- 
To view this commit on github, visit https://github.com/rhinstaller/blivet/commit/0bd1e23b07694d14d2187a01038cdcc69d9178ae


More information about the anaconda-patches mailing list