diff options
author | Chen Hanxiao <chenhanxiao@cn.fujitsu.com> | 2014-02-23 13:31:48 +0800 |
---|---|---|
committer | Chen Hanxiao <chenhanxiao@cn.fujitsu.com> | 2014-02-23 13:31:48 +0800 |
commit | 0dceb24b3ba567aad3976fe3c6af524db9e1ac6d (patch) | |
tree | 214056f890142c5c5d0221300e68a19caeac6137 /virtinst | |
parent | 2ace5317e00642f6513529c9b8bc97084343d54e (diff) | |
download | virt-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.py | 5 |
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 |