From: Mikhail Feoktistov Date: Mon, 3 Oct 2016 15:07:50 +0000 (-0400) Subject: Remove sata bus for virtuozzo hypervisor X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=646151ff1b8d481b70884d201a1b395d904e35b0;p=osstest%2Fopenstack-nova.git Remove sata bus for virtuozzo hypervisor In virtuozzo 7 we have changed disk bus from sata to scsi. Sata is not supported in virtuozzo 7. We don't need to support sata bus for virtuozzo in nova. Virtuozzo 6 may work with python 2.6 only and it's not possible to run upstream nova on virtuozzo 6. We always use this patch in our internal infrastructure to run openstack on virtuozzo 7. Also in this patch we have changed tests for hypervisor version. We don't need to check libvirt version in case of Virtuozzo hypervisor. Because Virtuozzo 7 always has libvirt with support of 'parallels' virt type. Docs have already been updated: If3d2f402bb1b21bec360693a6c1e9d73e998d167 Change-Id: If3d5e39bd745c0df74316a90159fffb3221864cc --- diff --git a/nova/tests/unit/virt/libvirt/test_blockinfo.py b/nova/tests/unit/virt/libvirt/test_blockinfo.py index 58d3e591fc..a1b6e91692 100644 --- a/nova/tests/unit/virt/libvirt/test_blockinfo.py +++ b/nova/tests/unit/virt/libvirt/test_blockinfo.py @@ -755,11 +755,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 @@ -768,7 +772,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( diff --git a/nova/tests/unit/virt/libvirt/test_driver.py b/nova/tests/unit/virt/libvirt/test_driver.py index 25c6aea9ed..d2e02992c2 100644 --- a/nova/tests/unit/virt/libvirt/test_driver.py +++ b/nova/tests/unit/virt/libvirt/test_driver.py @@ -14560,19 +14560,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') + + 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_parallels_min_version_ok(self): + 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): diff --git a/nova/virt/libvirt/blockinfo.py b/nova/virt/libvirt/blockinfo.py index 6ebf6d20a4..8158a2c5c0 100644 --- a/nova/virt/libvirt/blockinfo.py +++ b/nova/virt/libvirt/blockinfo.py @@ -209,7 +209,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: @@ -274,7 +274,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) @@ -301,8 +301,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'): diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py index aba3afe643..3c01f5718b 100644 --- a/nova/virt/libvirt/driver.py +++ b/nova/virt/libvirt/driver.py @@ -252,8 +252,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) @@ -495,12 +496,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. diff --git a/releasenotes/notes/supported-virtuozzo-version-569db9259a7ee579.yaml b/releasenotes/notes/supported-virtuozzo-version-569db9259a7ee579.yaml new file mode 100644 index 0000000000..30e925a09b --- /dev/null +++ b/releasenotes/notes/supported-virtuozzo-version-569db9259a7ee579.yaml @@ -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.