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

[booty rhel5-branch] Be a bit more clever recognizing partitions from names. (#572862)



Similar rhel6 commit: ec9e957f3425e37cff34722cb6d10378bf454bee
---
 bootloaderInfo.py |   23 ++++++++++++-----------
 1 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/bootloaderInfo.py b/bootloaderInfo.py
index cdd1692..bca1321 100644
--- a/bootloaderInfo.py
+++ b/bootloaderInfo.py
@@ -2044,21 +2044,22 @@ class sparcBootloaderInfo(bootloaderInfo):
 # return (disk, partition number) eg ('hda', 1)
 def getDiskPart(dev):
     cut = len(dev)
-    if (dev.startswith('rd/') or dev.startswith('ida/') or
+    if dev[-1] in string.digits:
+        if (dev.startswith('rd/') or dev.startswith('ida/') or
             dev.startswith('cciss/') or dev.startswith('sx8/') or
             dev.startswith('mapper/')):
-        if dev[-2] == 'p':
-            cut = -1
-        elif dev[-3] == 'p':
-            cut = -2
-    else:
-        if dev[-2] in string.digits:
-            cut = -2
-        elif dev[-1] in string.digits:
-            cut = -1
+            if dev[-2] == 'p':
+                cut = -1
+            elif dev[-3] == 'p' and dev[-2] in string.digits:
+                cut = -2
+        else:
+            if dev[-2] in string.digits:
+                cut = -2
+            else:
+                cut = -1
 
     name = dev[:cut]
-    
+
     # hack off the trailing 'p' from /dev/cciss/*, for example
     if name[-1] == 'p':
         for letter in name:
-- 
1.7.3.3


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