nova/nova/tests/unit/virt/libvirt
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
..
storage Merge "Revert "Re-using the code of os brick cinder"" 2018-06-19 02:08:35 +00:00
volume libvirt: set device address tag only if setting disk unit 2019-04-18 15:56:28 +00:00
__init__.py
fake_imagebackend.py libvirt: update logic to configure device for scsi controller 2017-07-03 03:23:53 -04:00
fake_libvirt_utils.py Add method to get cpu traits 2018-07-24 12:37:46 +00:00
fake_os_brick_connector.py
fakelibvirt.py Merge "Improve NeutronFixture and remove unncessary stubbing" 2018-08-02 17:44:55 +00:00
test_blockinfo.py Modify the test case of get_disk_mapping_rescue_with_config 2018-01-12 14:08:51 +08:00
test_compat.py
test_config.py conf: libvirt: Make `/dev/urandom` the default for 'rng_dev_path' 2018-06-26 17:55:11 +02:00
test_designer.py add mtu to libvirt xml for ethernet and bridge types 2018-06-06 09:39:40 -04:00
test_driver.py libvirt: disconnect volume when encryption fails 2019-04-11 14:36:28 +00:00
test_fakelibvirt.py conf: Deprecate 'keymap' options 2018-03-07 10:18:23 +00:00
test_firewall.py Don't modify objects directly 2018-01-30 16:35:02 +00:00
test_guest.py Add missing libvirt exception during device detach 2019-04-10 14:31:16 -06:00
test_host.py libvirt: Don't react to VIR_DOMAIN_EVENT_SUSPENDED_MIGRATED events 2018-08-23 14:44:22 -04:00
test_imagebackend.py libvirt: set device address tag only if setting disk unit 2019-04-18 15:56:28 +00:00
test_imagecache.py Move the dac_admin privsep code to a new location. 2017-09-18 23:14:11 +10:00
test_migration.py libvirt: Avoid setting MTU during live migration if unset 2018-10-29 22:46:06 +01:00
test_utils.py Plumb trusted_certs through the compute service 2018-06-12 16:58:25 -04:00
test_vif.py libvirt: skip setting rx/tx queue sizes for not virto interfaces 2018-09-04 07:09:27 +00:00