1 |
From 7f02656079d029ee3f887c1df07d6d8e9d4d6744 Mon Sep 17 00:00:00 2001 |
2 |
From: Ales Kozumplik <akozumpl@redhat.com> |
3 |
Date: Tue, 1 Mar 2011 18:07:31 +0100 |
4 |
Subject: [booty rhel5-branch 1/3] Be a bit more clever recognizing partitions from names. (#572862) |
5 |
|
6 |
Similar rhel6 commit: ec9e957f3425e37cff34722cb6d10378bf454bee |
7 |
--- |
8 |
bootloaderInfo.py | 23 ++++++++++++----------- |
9 |
1 files changed, 12 insertions(+), 11 deletions(-) |
10 |
|
11 |
diff --git a/bootloaderInfo.py b/bootloaderInfo.py |
12 |
index cdd1692..bca1321 100644 |
13 |
--- a/bootloaderInfo.py |
14 |
+++ b/bootloaderInfo.py |
15 |
@@ -2044,21 +2044,22 @@ class sparcBootloaderInfo(bootloaderInfo): |
16 |
# return (disk, partition number) eg ('hda', 1) |
17 |
def getDiskPart(dev): |
18 |
cut = len(dev) |
19 |
- if (dev.startswith('rd/') or dev.startswith('ida/') or |
20 |
+ if dev[-1] in string.digits: |
21 |
+ if (dev.startswith('rd/') or dev.startswith('ida/') or |
22 |
dev.startswith('cciss/') or dev.startswith('sx8/') or |
23 |
dev.startswith('mapper/')): |
24 |
- if dev[-2] == 'p': |
25 |
- cut = -1 |
26 |
- elif dev[-3] == 'p': |
27 |
- cut = -2 |
28 |
- else: |
29 |
- if dev[-2] in string.digits: |
30 |
- cut = -2 |
31 |
- elif dev[-1] in string.digits: |
32 |
- cut = -1 |
33 |
+ if dev[-2] == 'p': |
34 |
+ cut = -1 |
35 |
+ elif dev[-3] == 'p' and dev[-2] in string.digits: |
36 |
+ cut = -2 |
37 |
+ else: |
38 |
+ if dev[-2] in string.digits: |
39 |
+ cut = -2 |
40 |
+ else: |
41 |
+ cut = -1 |
42 |
|
43 |
name = dev[:cut] |
44 |
- |
45 |
+ |
46 |
# hack off the trailing 'p' from /dev/cciss/*, for example |
47 |
if name[-1] == 'p': |
48 |
for letter in name: |
49 |
-- |
50 |
1.7.3.3 |
51 |
|