summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2009-08-10 14:38:08 +0200
committerHans de Goede <hdegoede@redhat.com>2009-08-10 14:38:08 +0200
commit95cf84a7a8aa4b1027084e1030bfbc5a8f571fe0 (patch)
tree2ac543c62745ea904dbadad31d43e165bfb470af
parentec9e957f3425e37cff34722cb6d10378bf454bee (diff)
downloadanaconda-95cf84a7a8aa4b1027084e1030bfbc5a8f571fe0.tar.gz
anaconda-95cf84a7a8aa4b1027084e1030bfbc5a8f571fe0.tar.xz
anaconda-95cf84a7a8aa4b1027084e1030bfbc5a8f571fe0.zip
booty: Do not strip the trailing p from a devicename like mapper/isw_Vol0_tmp
While fixing bug 505205, I noticed that the code for removing the trailing p in a name like: mapper/isw_Vol0p1 which becomes mapper/isw_Vol0p after cutting is rather interesting, for example it will wrongly change the whole diskname mapper/isw_Vol0_tmp to mapper/isw_Vol0_tm. This patch fixes this by removing the trailing p as part of the partition cutting code instead of always removing it.
-rw-r--r--booty/util.py16
1 files changed, 6 insertions, 10 deletions
diff --git a/booty/util.py b/booty/util.py
index 2b7973015..48c31945d 100644
--- a/booty/util.py
+++ b/booty/util.py
@@ -10,9 +10,9 @@ def getDiskPart(dev, storage):
path.startswith('mapper/') or path.startswith('mmcblk') or
path.startswith('md')):
if dev[-2] == 'p':
- cut = -1
- elif dev[-3] == 'p' and dev[-2] in string.digits:
cut = -2
+ elif dev[-3] == 'p' and dev[-2] in string.digits:
+ cut = -3
else:
if dev[-2] in string.digits:
cut = -2
@@ -21,15 +21,11 @@ def getDiskPart(dev, storage):
name = dev[:cut]
- # hack off the trailing 'p' from /dev/cciss/*, for example
- if name[-1] == 'p':
- for letter in name:
- if letter not in string.letters and letter != "/":
- name = name[:-1]
- break
-
if cut < 0:
- partNum = int(dev[cut:]) - 1
+ part = dev[cut:]
+ if part[0] == 'p':
+ part = part[1:]
+ partNum = int(part) - 1
else:
partNum = None