fakelibvirt: Use versionutils to set min versions found in the driver

These were previously manually converted ints based on the version
tuples present in the driver. To avoid ever needing to worry about these
again this change simply uses versionutils to covert the tuples found in
the driver into ints used by fakelibvirt.

Change-Id: I864494e11ff697788167c996a39f38d3d833d0d7
This commit is contained in:
Lee Yarwood
2020-09-03 10:34:19 +01:00
parent 9fa563666e
commit 75250d6b17
+7 -3
View File
@@ -21,11 +21,13 @@ import fixtures
from lxml import etree
from oslo_log import log as logging
from oslo_utils.fixture import uuidsentinel as uuids
from oslo_utils import versionutils
from nova import conf
from nova.objects import fields as obj_fields
from nova.tests.unit.virt.libvirt import fake_libvirt_data
from nova.virt.libvirt import config as vconfig
from nova.virt.libvirt import driver as libvirt_driver
# Allow passing None to the various connect methods
@@ -182,9 +184,11 @@ VIR_SECRET_USAGE_TYPE_CEPH = 2
VIR_SECRET_USAGE_TYPE_ISCSI = 3
# Libvirt version to match MIN_LIBVIRT_VERSION in driver.py
FAKE_LIBVIRT_VERSION = 4000000
# QEMU version to match MIN_QEMU_VERSION in driver.py
FAKE_QEMU_VERSION = 2011000
FAKE_LIBVIRT_VERSION = versionutils.convert_version_to_int(
libvirt_driver.MIN_LIBVIRT_VERSION)
# Libvirt version to match MIN_QEMU_VERSION in driver.py
FAKE_QEMU_VERSION = versionutils.convert_version_to_int(
libvirt_driver.MIN_QEMU_VERSION)
PCI_VEND_ID = '8086'
PCI_VEND_NAME = 'Intel Corporation'