diff options
author | Martin Kletzander <mkletzan@redhat.com> | 2014-02-17 16:41:02 +0100 |
---|---|---|
committer | Martin Kletzander <mkletzan@redhat.com> | 2014-02-18 08:14:32 +0100 |
commit | 55d5b35e504f1e6c21fbd24f5b351ed4ab4c603f (patch) | |
tree | 5e28168201c912685abe7ef5304adc2454c3839d /virtinst | |
parent | 7c516b382cbb94c2ecafb07baedae19b8d1a2b67 (diff) | |
download | virt-manager-55d5b35e504f1e6c21fbd24f5b351ed4ab4c603f.tar.gz |
Fix generate_target once more
Passing a zero to the generate_target() function's as pref_ctrl
parameter makes the 'if pref_ctrl' conditions obviously false. Also
the range created was starting from 0 and not from 1. Apart from
fixing this, also fix tests so they actually test something this time.
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Diffstat (limited to 'virtinst')
-rw-r--r-- | virtinst/devicedisk.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/virtinst/devicedisk.py b/virtinst/devicedisk.py index 28c55ba1..6e7c6c84 100644 --- a/virtinst/devicedisk.py +++ b/virtinst/devicedisk.py @@ -925,14 +925,14 @@ class VirtualDisk(VirtualDevice): def get_target(): first_found = None - ran = range(1, maxnode + 1) - if pref_ctrl: + ran = range(maxnode) + if pref_ctrl is not None: # We assume narrow SCSI bus and libvirt assigning 7 - # (0-6, 7-13, etc.) devices per controller + # (1-7, 8-14, etc.) devices per controller ran = range(pref_ctrl * 7, (pref_ctrl + 1) * 7) for i in ran: - gen_t = prefix + self.num_to_target(i) + gen_t = prefix + self.num_to_target(i + 1) if gen_t in skip_targets: skip_targets.remove(gen_t) continue @@ -948,7 +948,7 @@ class VirtualDisk(VirtualDevice): self.target = ret return ret - if pref_ctrl: + if pref_ctrl is not None: # This basically means that we either chose full # controller or didn't add any raise ValueError(_("Controller number %d for disk of type %s has " |