[PATCH 1/3] Be more careful about overwriting device.originalFormat. (#1192004)

David Lehman dlehman at redhat.com
Fri Jun 26 21:59:54 UTC 2015


We don't want to overwrite it if addUdevDevice was called a second time
for a device we've already added, since that would cause us to lose the
real original format.

(cherry picked from commit b3f28a2d1fcaeec768917ba6ef1b761423bc01d4)
---
 blivet/devicetree.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/blivet/devicetree.py b/blivet/devicetree.py
index 915b94e..5318bea 100644
--- a/blivet/devicetree.py
+++ b/blivet/devicetree.py
@@ -1200,8 +1200,9 @@ class DeviceTree(object):
         #
         # The first step is to either look up or create the device
         #
+        device_added = True
         if device:
-            pass
+            device_added = False
         elif udev.device_is_loop(info):
             log.info("%s is a loop device", name)
             device = self.addUdevLoopDevice(info)
@@ -1265,7 +1266,8 @@ class DeviceTree(object):
 
         # now handle the device's formatting
         self.handleUdevDeviceFormat(info, device)
-        device.originalFormat = copy.copy(device.format)
+        if device_added:
+            device.originalFormat = copy.copy(device.format)
         device.deviceLinks = udev.device_get_symlinks(info)
 
     def handleUdevDiskLabelFormat(self, info, device):
-- 
2.4.3



More information about the anaconda-patches mailing list