summaryrefslogtreecommitdiff
path: root/nova/virt/libvirt/volume/volume.py
diff options
context:
space:
mode:
Diffstat (limited to 'nova/virt/libvirt/volume/volume.py')
-rw-r--r--nova/virt/libvirt/volume/volume.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/nova/virt/libvirt/volume/volume.py b/nova/virt/libvirt/volume/volume.py
index 327aeca050..004f2fec8b 100644
--- a/nova/virt/libvirt/volume/volume.py
+++ b/nova/virt/libvirt/volume/volume.py
@@ -93,16 +93,21 @@ class LibvirtBaseVolumeDriver(object):
if data.get('discard', False) is True:
conf.driver_discard = 'unmap'
- if disk_info['bus'] == 'scsi':
+ # NOTE(melwitt): We set the device address unit number manually in the
+ # case of the virtio-scsi controller, in order to allow attachment of
+ # up to 256 devices. So, we should only be setting the address tag
+ # if we intend to set the unit number. Otherwise, we will let libvirt
+ # handle autogeneration of the address tag.
+ # See https://bugs.launchpad.net/nova/+bug/1792077 for details.
+ if disk_info['bus'] == 'scsi' and 'unit' in disk_info:
# The driver is responsible to create the SCSI controller
# at index 0.
conf.device_addr = vconfig.LibvirtConfigGuestDeviceAddressDrive()
conf.device_addr.controller = 0
- if 'unit' in disk_info:
- # In order to allow up to 256 disks handled by one
- # virtio-scsi controller, the device addr should be
- # specified.
- conf.device_addr.unit = disk_info['unit']
+ # In order to allow up to 256 disks handled by one
+ # virtio-scsi controller, the device addr should be
+ # specified.
+ conf.device_addr.unit = disk_info['unit']
return conf