It seems to me that we shouldn't be creating the address tag at all unless we intend to set the unit as well. So, I wonder if we should do something like this then:
--- a/nova/virt/libvirt/volume/volume.py
+++ b/nova/virt/libvirt/volume/volume.py
@@ -94,16 +94,15 @@ class LibvirtBaseVolumeDriver(object):
if data.get('discard', False) is True: conf.driver_discard = 'unmap'
- if disk_info['bus'] == 'scsi':
+ 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']
if connection_info.get('multiattach', False):
# Note that driver_cache should be disabled (none) when using
Ah, I think you're right.
It seems to me that we shouldn't be creating the address tag at all unless we intend to set the unit as well. So, I wonder if we should do something like this then:
--- a/nova/ virt/libvirt/ volume/ volume. py virt/libvirt/ volume/ volume. py meDriver( object) :
conf. driver_ discard = 'unmap'
+++ b/nova/
@@ -94,16 +94,15 @@ class LibvirtBaseVolu
if data.get('discard', False) is True:
- if disk_info['bus'] == 'scsi':
conf. device_ addr = vconfig. LibvirtConfigGu estDeviceAddres sDrive( )
conf. device_ addr.controller = 0 addr.unit = disk_info['unit'] addr.unit = disk_info['unit']
+ if disk_info['bus'] == 'scsi' and 'unit' in disk_info:
# The driver is responsible to create the SCSI controller
# at index 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_
+ # In order to allow up to 256 disks handled by one
+ # virtio-scsi controller, the device addr should be
+ # specified.
+ conf.device_
if connection_ info.get( 'multiattach' , False):
# Note that driver_cache should be disabled (none) when using