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

David Lehman dlehman at redhat.com
Tue Feb 17 19:49:09 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.
---
 blivet/devicetree.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/blivet/devicetree.py b/blivet/devicetree.py
index 2e7e252..322087f 100644
--- a/blivet/devicetree.py
+++ b/blivet/devicetree.py
@@ -1184,10 +1184,12 @@ class DeviceTree(object):
         #
         # The first step is to either look up or create the device
         #
+        device_added = True
         if device:
             # we successfully looked up the device. skip to format handling.
             # first, grab the parted.Device while it's active
             _unused = device.partedDevice
+            device_added = False
         elif udev.device_is_loop(info):
             log.info("%s is a loop device", name)
             device = self.addUdevLoopDevice(info)
@@ -1256,7 +1258,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):
-- 
1.9.3



More information about the anaconda-patches mailing list