nova/nova/tests/unit/virt
melanie witt 8703282508 libvirt: set device address tag only if setting disk unit
In Pike, we began setting disk unit values manually for the
'virtio-scsi' controller model in order to allow up to 256 devices [1].
We do this by setting the disk unit of the address tag manually for the
guest config. If we do not set the address tag manually, libvirt would
autogenerate it for us.

A problem occurs when a user has a SCSI disk that is a volume or isn't
using the 'virtio-scsi' controller model because we're not guarding our
manual setting of the address tag in the guest config by the disk unit,
in addition to the SCSI bus. This means that for a SCSI volume, we
generate an address tag like '<address type="drive" controller="0"/>'
for any SCSI volume, so a user with more than one device will get the
following error when they try to boot an instance:

  Failed to start libvirt guest: libvirtError: unsupported
    configuration: Found duplicate drive address for disk with target name
    'sda' controller='0' bus='0' target='0' unit='0'

This updates the conditionals to only manually set the address tag if
the bus is SCSI _and_ the disk unit has been specified. Otherwise, let
libvirt autogenerate the address tag and take care of avoiding
collisions.

[1] https://bugs.launchpad.net/nova/+bug/1686116

Closes-Bug: #1792077

NOTE(melwitt): The difference in test_imagebackend.py from the Stein
backport is because change I28c5bc23c0ea60d64153472d8937965f60f907c4
is not in Rocky.

Change-Id: Iefab05e84ccc0bf8f15bdbbf515a290d282dbc5d
(cherry picked from commit 48fd81648a)
(cherry picked from commit 7500c1910c)
2019-04-18 15:56:28 +00:00
..
disk Don't use private interface in oslo.service 2018-11-21 16:37:38 -05:00
hyperv hyperv: Cleans up live migration Planned VM 2018-09-14 11:49:17 -06:00
image Use assert(Not)Equal instead of assertTrue(A == X) 2016-06-03 16:53:15 +01:00
ironic Merge "pass endpoint interface to Ironic client" into stable/rocky 2019-03-21 15:59:11 +00:00
libvirt libvirt: set device address tag only if setting disk unit 2019-04-18 15:56:28 +00:00
powervm Merge "Rename recreate to evacuate in driver signatures" 2018-07-21 23:19:40 +00:00
vmwareapi Rename recreate to evacuate in driver signatures 2018-04-19 14:07:47 +01:00
xenapi XenAPI/Stops the migration of volume backed VHDS 2018-09-20 19:57:37 +00:00
zvm z/VM Driver: add get console output 2018-07-16 11:35:11 +08:00
__init__.py
fakelibosinfo.py
test_block_device.py Override the 'get' method in DriverBlockDevice class 2019-03-26 12:13:56 +09:00
test_configdrive.py
test_driver.py Remove usage of parameter enforce_type 2017-04-17 20:23:19 +08:00
test_events.py
test_fake.py
test_firewall.py remove get_nw_info_for_instance from compute.utils 2017-06-13 13:30:06 +02:00
test_hardware.py hardware: fix memory check usage for small/large pages 2018-09-03 14:45:26 +00:00
test_imagecache.py Remove mox from tests/unit/virt/test_imagecache.py 2016-06-16 23:40:01 +00:00
test_images.py Fix execute mock for test_convert_image_with_errors 2018-06-14 12:33:21 +00:00
test_netutils.py Remove unnecessary code 2017-07-28 06:01:21 +00:00
test_osinfo.py Do not attempt to load osinfo if we do not have os_distro 2017-03-23 22:07:03 -04:00
test_virt.py Rename block_device_info_get_root 2018-01-11 20:46:13 +00:00
test_virt_drivers.py Revert "libvirt: slow live-migration to ensure network is ready" 2018-08-13 06:20:04 +00:00