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.
Reviewed: https:/ /review. opendev. org/653514 /git.openstack. org/cgit/ openstack/ nova/commit/ ?id=b50b70a1828 6b20afa0dbf68bc 4833ce5a6235ca
Committed: https:/
Submitter: Zuul
Branch: stable/pike
commit b50b70a18286b20 afa0dbf68bc4833 ce5a6235ca
Author: melanie witt <email address hidden>
Date: Fri Oct 19 22:06:20 2018 +0000
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
Conflicts:
nova/ tests/unit/ virt/libvirt/ volume/ test_volume. py
NOTE(melwitt): Conflict is due to not having change d2fb70db7791330 ed1a64fe61c1355 in Pike.
Ibfa64f18bb
Change-Id: Iefab05e84ccc0b f8f15bdbbf515a2 90d282dbc5d 2d147a6beabac06 7c28b288b0) 16ee48028b67aa9 19160f44da) 6e1d041340878c6 36693d8f5f) fdada565cc6660f bac7f75d6c)
(cherry picked from commit 48fd81648a7cadf
(cherry picked from commit 7500c1910cf1cbe
(cherry picked from commit 870328250895459
(cherry picked from commit c8ad9f4e1949ce6