Adds 'sata' as a valid disk bus for qemu and kvm hypervisors

Reasoning:
- Setting custom properties on glance images allows us to select the
type of disk bus e.g. VIRTIO/IDE/SCSI.
Although SATA disk bus works perfectly for qemu/kvm, it is not allowed
due to a check in virt/libvirt/blockinfo.py : is_disk_bus_valid_for_virt
- some Linux (custom) images require use of SATA bus rather than any
other that seems to be allowed.

Change-Id: Ie32ff7acf31d80d4fc1adbeadaaf30a886d10e49
Closes-Bug: #1686136
This commit is contained in:
Sumedh Degaonkar 2017-04-25 13:19:57 -04:00 committed by Matt Riedemann
parent 9058ed951f
commit c1c611bcd7
3 changed files with 14 additions and 4 deletions

View File

@ -844,7 +844,9 @@ class LibvirtBlockInfoTest(test.NoDBTestCase):
'disk_bus': 'scsi',
'boot_index': 1,
'device_type': 'lame_type',
'delete_on_termination': True}]
'delete_on_termination': True},
{'disk_bus': 'sata', 'guest_format': None,
'device_name': '/dev/sda', 'size': 3}]
expected = [{'dev': 'vds', 'type': 'disk', 'bus': 'usb'},
{'dev': 'vdb', 'type': 'disk',
'bus': 'virtio', 'format': 'ext4'},
@ -852,7 +854,8 @@ class LibvirtBlockInfoTest(test.NoDBTestCase):
{'dev': 'sdr', 'type': 'cdrom',
'bus': 'scsi', 'boot_index': '1'},
{'dev': 'vdo', 'type': 'disk',
'bus': 'scsi', 'boot_index': '2'}]
'bus': 'scsi', 'boot_index': '2'},
{'dev': 'sda', 'type': 'disk', 'bus': 'sata'}]
image_meta = objects.ImageMeta.from_dict(self.test_image_meta)
for bdm, expected in zip(bdms, expected):

View File

@ -197,8 +197,8 @@ def find_disk_dev_for_disk_bus(mapping, bus,
def is_disk_bus_valid_for_virt(virt_type, disk_bus):
valid_bus = {
'qemu': ['virtio', 'scsi', 'ide', 'usb', 'fdc'],
'kvm': ['virtio', 'scsi', 'ide', 'usb', 'fdc'],
'qemu': ['virtio', 'scsi', 'ide', 'usb', 'fdc', 'sata'],
'kvm': ['virtio', 'scsi', 'ide', 'usb', 'fdc', 'sata'],
'xen': ['xen', 'ide'],
'uml': ['uml'],
'lxc': ['lxc'],

View File

@ -0,0 +1,7 @@
---
other:
- Adds 'sata' as a valid disk bus for qemu and kvm hypervisors.
Setting the 'hw_disk_bus' custom property on glance images allows for
selecting the type of disk bus e.g. VIRTIO/IDE/SCSI. Some Linux (custom)
images require use of SATA bus rather than any other that seem to be
allowed.