Skip to content

Commit 75250d6

Browse files
committed
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
1 parent 9fa5636 commit 75250d6

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

nova/tests/unit/virt/libvirt/fakelibvirt.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,13 @@
2121
from lxml import etree
2222
from oslo_log import log as logging
2323
from oslo_utils.fixture import uuidsentinel as uuids
24+
from oslo_utils import versionutils
2425

2526
from nova import conf
2627
from nova.objects import fields as obj_fields
2728
from nova.tests.unit.virt.libvirt import fake_libvirt_data
2829
from nova.virt.libvirt import config as vconfig
30+
from nova.virt.libvirt import driver as libvirt_driver
2931

3032

3133
# Allow passing None to the various connect methods
@@ -182,9 +184,11 @@ def _reset():
182184
VIR_SECRET_USAGE_TYPE_ISCSI = 3
183185

184186
# Libvirt version to match MIN_LIBVIRT_VERSION in driver.py
185-
FAKE_LIBVIRT_VERSION = 4000000
186-
# QEMU version to match MIN_QEMU_VERSION in driver.py
187-
FAKE_QEMU_VERSION = 2011000
187+
FAKE_LIBVIRT_VERSION = versionutils.convert_version_to_int(
188+
libvirt_driver.MIN_LIBVIRT_VERSION)
189+
# Libvirt version to match MIN_QEMU_VERSION in driver.py
190+
FAKE_QEMU_VERSION = versionutils.convert_version_to_int(
191+
libvirt_driver.MIN_QEMU_VERSION)
188192

189193
PCI_VEND_ID = '8086'
190194
PCI_VEND_NAME = 'Intel Corporation'

0 commit comments

Comments
 (0)