Merge "Remove sata bus for virtuozzo hypervisor"

This commit is contained in:
Jenkins
2016-11-28 14:55:12 +00:00
committed by Gerrit Code Review
5 changed files with 67 additions and 23 deletions
@@ -750,11 +750,15 @@ class LibvirtBlockInfoTest(test.NoDBTestCase):
self.assertEqual(res, bus)
expected = (
('scsi', None, 'disk', 'scsi'),
(None, 'scsi', 'cdrom', 'scsi'),
('usb', None, 'disk', 'usb')
('kvm', 'scsi', None, 'disk', 'scsi'),
('kvm', None, 'scsi', 'cdrom', 'scsi'),
('kvm', 'usb', None, 'disk', 'usb'),
('parallels', 'scsi', None, 'disk', 'scsi'),
('parallels', None, None, 'disk', 'scsi'),
('parallels', None, 'ide', 'cdrom', 'ide'),
('parallels', None, None, 'cdrom', 'ide')
)
for dbus, cbus, dev, res in expected:
for hv, dbus, cbus, dev, res in expected:
props = {}
if dbus is not None:
props['hw_disk_bus'] = dbus
@@ -763,7 +767,7 @@ class LibvirtBlockInfoTest(test.NoDBTestCase):
image_meta = objects.ImageMeta.from_dict(
{'properties': props})
bus = blockinfo.get_disk_bus_for_device_type(
instance, 'kvm', image_meta, device_type=dev)
instance, hv, image_meta, device_type=dev)
self.assertEqual(res, bus)
image_meta = objects.ImageMeta.from_dict(
+38 -6
View File
@@ -14759,19 +14759,51 @@ class LibvirtConnTestCase(test.NoDBTestCase):
string_ver = driver._version_to_string((4, 33, 173))
self.assertEqual("4.33.173", string_ver)
def test_parallels_min_version_fail(self):
def test_virtuozzo_min_version_fail(self):
self.flags(virt_type='parallels', group='libvirt')
driver = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), False)
with mock.patch.object(driver._conn, 'getLibVersion',
return_value=1002011):
with test.nested(
mock.patch.object(
driver._conn, 'getVersion'),
mock.patch.object(
driver._conn, 'getLibVersion'))\
as (mock_getver, mock_getlibver):
mock_getver.return_value = \
versionutils.convert_version_to_int(
libvirt_driver.MIN_VIRTUOZZO_VERSION) - 1
mock_getlibver.return_value = \
versionutils.convert_version_to_int(
libvirt_driver.MIN_LIBVIRT_VIRTUOZZO_VERSION)
self.assertRaises(exception.NovaException,
driver.init_host, 'wibble')
def test_parallels_min_version_ok(self):
mock_getver.return_value = \
versionutils.convert_version_to_int(
libvirt_driver.MIN_VIRTUOZZO_VERSION)
mock_getlibver.return_value = \
versionutils.convert_version_to_int(
libvirt_driver.MIN_LIBVIRT_VIRTUOZZO_VERSION) - 1
self.assertRaises(exception.NovaException,
driver.init_host, 'wibble')
def test_virtuozzo_min_version_ok(self):
self.flags(virt_type='parallels', group='libvirt')
driver = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), False)
with mock.patch.object(driver._conn, 'getLibVersion',
return_value=1002012):
with test.nested(
mock.patch.object(
driver._conn, 'getVersion'),
mock.patch.object(
driver._conn, 'getLibVersion'))\
as (mock_getver, mock_getlibver):
mock_getver.return_value = \
versionutils.convert_version_to_int(
libvirt_driver.MIN_VIRTUOZZO_VERSION)
mock_getlibver.return_value = \
versionutils.convert_version_to_int(
libvirt_driver.MIN_LIBVIRT_VIRTUOZZO_VERSION)
driver.init_host('wibble')
def test_get_guest_config_parallels_vm(self):
+2 -4
View File
@@ -204,7 +204,7 @@ def is_disk_bus_valid_for_virt(virt_type, disk_bus):
'xen': ['xen', 'ide'],
'uml': ['uml'],
'lxc': ['lxc'],
'parallels': ['ide', 'scsi', 'sata']
'parallels': ['ide', 'scsi']
}
if virt_type not in valid_bus:
@@ -269,7 +269,7 @@ def get_disk_bus_for_device_type(instance,
if device_type == "cdrom":
return "ide"
elif device_type == "disk":
return "sata"
return "scsi"
else:
# If virt-type not in list then it is unsupported
raise exception.UnsupportedVirtType(virt=virt_type)
@@ -296,8 +296,6 @@ def get_disk_bus_for_disk_dev(virt_type, disk_dev):
# this picks the most likely mappings
if virt_type == "xen":
return "xen"
elif virt_type == "parallels":
return "sata"
else:
return "scsi"
elif disk_dev.startswith('vd'):
+13 -8
View File
@@ -253,8 +253,9 @@ MIN_LIBVIRT_UEFI_VERSION = (1, 2, 9)
MIN_LIBVIRT_HYPERV_TIMER_VERSION = (1, 2, 2)
MIN_QEMU_HYPERV_TIMER_VERSION = (2, 0, 0)
# parallels driver support
MIN_LIBVIRT_PARALLELS_VERSION = (1, 2, 12)
# Virtuozzo driver support
MIN_VIRTUOZZO_VERSION = (7, 0, 0)
MIN_LIBVIRT_VIRTUOZZO_VERSION = (1, 2, 12)
# Ability to set the user guest password with Qemu
MIN_LIBVIRT_SET_ADMIN_PASSWD = (1, 2, 16)
@@ -510,12 +511,16 @@ class LibvirtDriver(driver.ComputeDriver):
_('Nova requires QEMU version %s or greater.') %
self._version_to_string(MIN_QEMU_VERSION))
if (CONF.libvirt.virt_type == 'parallels' and
not self._host.has_min_version(MIN_LIBVIRT_PARALLELS_VERSION)):
raise exception.NovaException(
_('Running Nova with parallels virt_type requires '
'libvirt version %s') %
self._version_to_string(MIN_LIBVIRT_PARALLELS_VERSION))
if CONF.libvirt.virt_type == 'parallels':
if not self._host.has_min_version(hv_ver=MIN_VIRTUOZZO_VERSION):
raise exception.NovaException(
_('Nova requires Virtuozzo version %s or greater.') %
self._version_to_string(MIN_VIRTUOZZO_VERSION))
if not self._host.has_min_version(MIN_LIBVIRT_VIRTUOZZO_VERSION):
raise exception.NovaException(
_('Running Nova with parallels virt_type requires '
'libvirt version %s') %
self._version_to_string(MIN_LIBVIRT_VIRTUOZZO_VERSION))
# Give the cloud admin a heads up if we are intending to
# change the MIN_LIBVIRT_VERSION in the next release.
@@ -0,0 +1,5 @@
---
upgrade:
- As of Ocata, the minimum version of Virtuozzo that nova compute will
interoperate with will be 7.0.0. Deployments using older versions of
Virtuozzo should upgrade.