summaryrefslogtreecommitdiff
path: root/virtinst
diff options
context:
space:
mode:
authorChen Hanxiao <chenhanxiao@cn.fujitsu.com>2014-02-23 13:31:48 +0800
committerChen Hanxiao <chenhanxiao@cn.fujitsu.com>2014-02-23 13:31:48 +0800
commit0dceb24b3ba567aad3976fe3c6af524db9e1ac6d (patch)
tree214056f890142c5c5d0221300e68a19caeac6137 /virtinst
parent2ace5317e00642f6513529c9b8bc97084343d54e (diff)
downloadvirt-manager-0dceb24b3ba567aad3976fe3c6af524db9e1ac6d.tar.gz
virtinst: fix an issue of disk bus caculation
commit 466c2bcf9cb07f16690cb41684d67d0265d2d47e will generate the same index for 'hda' and 'hdaa'. Also break test cases. This patch will fix this. Signed-off-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
Diffstat (limited to 'virtinst')
-rw-r--r--virtinst/devicedisk.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/virtinst/devicedisk.py b/virtinst/devicedisk.py
index 9ebcc117..2d692f13 100644
--- a/virtinst/devicedisk.py
+++ b/virtinst/devicedisk.py
@@ -480,11 +480,14 @@ class VirtualDisk(VirtualDevice):
Convert disk /dev number (like hda, hdb, hdaa, etc.) to an index
"""
num = 0
+ k = 0
if tgt[0] == 'x':
# This case is here for 'xvda'
tgt = tgt[1:]
for i, c in enumerate(reversed(tgt[2:])):
- num += (ord(c) - ord('a')) * (26 ** i)
+ if i != 0:
+ k = 1
+ num += (ord(c) - ord('a') + k) * (26 ** i)
return num