libvirt: Remove MIN_LIBVIRT_VIDEO_MODEL_VERSIONS
I8e349849db0b1a540d295c903f1470917b82fd97 has bumped MIN_LIBVIRT_VERSION past this so remove the constant and associated logic. Change-Id: If082b869238d08c0b713e60697185fc61c3ff99b
This commit is contained in:
parent
d309e3cdf5
commit
0e7cd9d1a9
|
@ -6738,25 +6738,11 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
|||
|
||||
def test__video_model_supported(self):
|
||||
drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), True)
|
||||
with mock.patch.object(drvr._host, "has_min_version",
|
||||
return_value=True) as min_version_mock:
|
||||
model_versions = libvirt_driver.MIN_LIBVIRT_VIDEO_MODEL_VERSIONS
|
||||
# assert that all known vif models pass
|
||||
for model in nova.objects.fields.VideoModel.ALL:
|
||||
min_version_mock.reset_mock()
|
||||
self.assertTrue(drvr._video_model_supported(model))
|
||||
# and that vif models with minium versions are checked
|
||||
if model in model_versions:
|
||||
ver = model_versions[model]
|
||||
min_version_mock.assert_called_with(lv_ver=ver)
|
||||
else:
|
||||
min_version_mock.assert_not_called()
|
||||
# then assert that fake models fail
|
||||
self.assertFalse(drvr._video_model_supported("fake"))
|
||||
# finally if the min version is not met assert that
|
||||
# the video model is not supported.
|
||||
min_version_mock.return_value = False
|
||||
self.assertFalse(drvr._video_model_supported("none"))
|
||||
# assert that all known vif models pass
|
||||
for model in nova.objects.fields.VideoModel.ALL:
|
||||
self.assertTrue(drvr._video_model_supported(model))
|
||||
# then assert that fake models fail
|
||||
self.assertFalse(drvr._video_model_supported("fake"))
|
||||
|
||||
@mock.patch.object(libvirt_driver.LibvirtDriver, '_video_model_supported')
|
||||
def test__add_video_driver_gop(self, _supports_gop_video):
|
||||
|
|
|
@ -264,11 +264,6 @@ MIN_LIBVIRT_VTPM = (5, 6, 0)
|
|||
|
||||
MIN_LIBVIRT_S390X_CPU_COMPARE = (5, 9, 0)
|
||||
|
||||
# see https://libvirt.org/formatdomain.html#elementsVideo
|
||||
MIN_LIBVIRT_VIDEO_MODEL_VERSIONS = {
|
||||
fields.VideoModel.NONE: (4, 6, 0),
|
||||
}
|
||||
|
||||
|
||||
class LibvirtDriver(driver.ComputeDriver):
|
||||
def __init__(self, virtapi, read_only=False):
|
||||
|
@ -5430,12 +5425,7 @@ class LibvirtDriver(driver.ComputeDriver):
|
|||
allowed=ALLOWED_QEMU_SERIAL_PORTS, virt_type=virt_type)
|
||||
|
||||
def _video_model_supported(self, model):
|
||||
if model not in fields.VideoModel.ALL:
|
||||
return False
|
||||
min_ver = MIN_LIBVIRT_VIDEO_MODEL_VERSIONS.get(model)
|
||||
if min_ver and not self._host.has_min_version(lv_ver=min_ver):
|
||||
return False
|
||||
return True
|
||||
return model in fields.VideoModel.ALL
|
||||
|
||||
def _add_video_driver(self, guest, image_meta, flavor):
|
||||
video = vconfig.LibvirtConfigGuestVideo()
|
||||
|
|
Loading…
Reference in New Issue