virt-manager/53030858-generate_target-fix.patch
Charles Arnold 674941bbf7 - Upstream bug fixes
53022930-lxc-connection-fix.patch
  530229cb-non-x86-kvm-creation-fix.patch
  53023f56-dont-alter-caps-machine-list-on-create.patch
  53030858-generate_target-fix.patch
  53037798-not-customizing-generate_target-fix.patch
  53047532-dont-get-duplicated-disks.patch
  53047595-calculate-disk-bus-properly.patch
  530987c4-disk-bus-calculation-fix.patch
  530c021c-attempt-empty-path-on-virDomainBlockStats.patch
  530cd6ab-log-broken-xml.patch
  530cf4de-allow-numbered-object-names.patch
  530cfa5e-close-connection-on-tick-failure-fix.patch

OBS-URL: https://build.opensuse.org/package/show/Virtualization/virt-manager?expand=0&rev=146
2014-02-28 14:58:33 +00:00

59 lines
2.3 KiB
Diff

Subject: Fix generate_target once more
From: Martin Kletzander mkletzan@redhat.com Mon Feb 17 16:41:02 2014 +0100
Date: Tue Feb 18 08:14:32 2014 +0100:
Git: 55d5b35e504f1e6c21fbd24f5b351ed4ab4c603f
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>
diff --git a/tests/xmlconfig.py b/tests/xmlconfig.py
index 9db51cb..5d08ca0 100644
--- a/tests/xmlconfig.py
+++ b/tests/xmlconfig.py
@@ -1045,7 +1045,8 @@ class TestXMLConfig(unittest.TestCase):
self.assertEquals("hdc", disk.generate_target(["hdb", "sda"]))
self.assertEquals("hdb", disk.generate_target(["hda", "hdd"]))
- disk.bus = "scsi"
+ disk.bus = "virtio-scsi"
+ self.assertEquals("sdb", disk.generate_target(["sda", "sdg", "sdi"], 0))
self.assertEquals("sdh", disk.generate_target(["sda", "sdg"], 1))
def testFedoraTreeinfo(self):
diff --git a/virtinst/devicedisk.py b/virtinst/devicedisk.py
index 28c55ba..6e7c6c8 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 "