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

[rhel6] Fix sense of disklabel size check and add some logging (#671230)



From: "Brian C. Lane" <bcl redhat com>

cherry-picked from commit 0254ad8d8c6635d67c08a2ad28a84bfae9c880f9
and tested against RHEL6.3 nightly

Resolves: rhbz#671230
---
 platform.py |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/platform.py b/platform.py
index 9904220..0ce3b70 100644
--- a/platform.py
+++ b/platform.py
@@ -160,14 +160,20 @@ class Platform(object):
         """The best disklabel type for the specified device."""
         # if there's a required type for this device type, use that
         labelType = self.requiredDiskLabelType(device.partedDevice.type)
+        log.debug("required disklabel type for %s (%s) is %s"
+                  % (device.name, device.partedDevice.type, labelType))
         if not labelType:
             # otherwise, use the first supported type for this platform
             # that is large enough to address the whole device
             labelType = self.defaultDiskLabelType
+            log.debug("default disklabel type for %s is %s" % (device.name,
+                                                               labelType))
             for lt in self.diskLabelTypes:
                 l = parted.freshDisk(device=device.partedDevice, ty=lt)
-                if l.maxPartitionStartSector < device.partedDevice.length:
+                if l.maxPartitionStartSector > device.partedDevice.length:
                     labelType = lt
+                    log.debug("selecting %s disklabel for %s based on size"
+                              % (labelType, device.name))
                     break
 
         return labelType
-- 
1.7.7.6


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