Browse Source

Merge "libvirt: 'video.vram' property must be an integer" into stable/ussuri

changes/68/788468/1
Zuul 3 weeks ago
committed by Gerrit Code Review
parent
commit
000d6ff942
2 changed files with 11 additions and 7 deletions
  1. +10
    -6
      nova/tests/unit/virt/libvirt/test_driver.py
  2. +1
    -1
      nova/virt/libvirt/driver.py

+ 10
- 6
nova/tests/unit/virt/libvirt/test_driver.py View File

@ -6213,7 +6213,7 @@ class LibvirtConnTestCase(test.NoDBTestCase,
self.assertEqual(cfg.devices[4].type, "spice")
self.assertEqual(cfg.devices[5].type, "qxl")
self.assertEqual(cfg.devices[5].vram, 64 * units.Mi / units.Ki)
self.assertEqual(cfg.devices[5].vram, 65536)
def _test_add_video_driver(self, model):
self.flags(virt_type='kvm', group='libvirt')
@ -6224,15 +6224,19 @@ class LibvirtConnTestCase(test.NoDBTestCase,
drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), True)
guest = vconfig.LibvirtConfigGuest()
instance_ref = objects.Instance(**self.test_instance)
flavor = instance_ref.get_flavor()
flavor = objects.Flavor(
extra_specs={'hw_video:ram_max_mb': '512'})
image_meta = objects.ImageMeta.from_dict({
'properties': {'hw_video_model': model}})
'properties': {
'hw_video_model': model,
'hw_video_ram': 8,
},
})
self.assertTrue(drvr._guest_add_video_device(guest))
video = drvr._add_video_driver(guest, image_meta,
flavor)
video = drvr._add_video_driver(guest, image_meta, flavor)
self.assertEqual(model, video.type)
self.assertEqual(8192, video.vram) # should be in bytes
def test__add_video_driver(self):
self._test_add_video_driver('qxl')


+ 1
- 1
nova/virt/libvirt/driver.py View File

@ -5421,7 +5421,7 @@ class LibvirtDriver(driver.ComputeDriver):
raise exception.RequestedVRamTooHigh(req_vram=video_ram,
max_vram=max_vram)
if max_vram and video_ram:
video.vram = video_ram * units.Mi / units.Ki
video.vram = video_ram * units.Mi // units.Ki
guest.add_device(video)
# NOTE(sean-k-mooney): return the video device we added


Loading…
Cancel
Save