|
|
|
@@ -2447,7 +2447,7 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
|
|
|
|
self.assertEqual(cfg.os_type, fields.VMMode.HVM)
|
|
|
|
|
self.assertEqual(cfg.os_boot_dev, ["hd"])
|
|
|
|
|
self.assertIsNone(cfg.os_root)
|
|
|
|
|
self.assertEqual(len(cfg.devices), 9)
|
|
|
|
|
self.assertEqual(len(cfg.devices), 10)
|
|
|
|
|
self.assertIsInstance(cfg.devices[0],
|
|
|
|
|
vconfig.LibvirtConfigGuestDisk)
|
|
|
|
|
self.assertIsInstance(cfg.devices[1],
|
|
|
|
@@ -2465,6 +2465,8 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
|
|
|
|
self.assertIsInstance(cfg.devices[7],
|
|
|
|
|
vconfig.LibvirtConfigGuestVideo)
|
|
|
|
|
self.assertIsInstance(cfg.devices[8],
|
|
|
|
|
vconfig.LibvirtConfigGuestRng)
|
|
|
|
|
self.assertIsInstance(cfg.devices[9],
|
|
|
|
|
vconfig.LibvirtConfigMemoryBalloon)
|
|
|
|
|
self.assertEqual(len(cfg.metadata), 1)
|
|
|
|
|
self.assertIsInstance(cfg.metadata[0],
|
|
|
|
@@ -4472,7 +4474,7 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
|
|
|
|
self.assertEqual(cfg.os_type, fields.VMMode.HVM)
|
|
|
|
|
self.assertEqual(cfg.os_boot_dev, ["hd"])
|
|
|
|
|
self.assertIsNone(cfg.os_root)
|
|
|
|
|
self.assertEqual(len(cfg.devices), 9)
|
|
|
|
|
self.assertEqual(len(cfg.devices), 10)
|
|
|
|
|
self.assertIsInstance(cfg.devices[0],
|
|
|
|
|
vconfig.LibvirtConfigGuestDisk)
|
|
|
|
|
self.assertIsInstance(cfg.devices[1],
|
|
|
|
@@ -4490,6 +4492,8 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
|
|
|
|
self.assertIsInstance(cfg.devices[7],
|
|
|
|
|
vconfig.LibvirtConfigGuestVideo)
|
|
|
|
|
self.assertIsInstance(cfg.devices[8],
|
|
|
|
|
vconfig.LibvirtConfigGuestRng)
|
|
|
|
|
self.assertIsInstance(cfg.devices[9],
|
|
|
|
|
vconfig.LibvirtConfigMemoryBalloon)
|
|
|
|
|
|
|
|
|
|
def test_get_guest_config_with_root_device_name(self):
|
|
|
|
@@ -4940,7 +4944,7 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
|
|
|
|
|
|
|
|
|
cfg = self._get_guest_config_with_graphics()
|
|
|
|
|
|
|
|
|
|
self.assertEqual(len(cfg.devices), 6)
|
|
|
|
|
self.assertEqual(len(cfg.devices), 7)
|
|
|
|
|
self.assertIsInstance(cfg.devices[0],
|
|
|
|
|
vconfig.LibvirtConfigGuestDisk)
|
|
|
|
|
self.assertIsInstance(cfg.devices[1],
|
|
|
|
@@ -4952,6 +4956,8 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
|
|
|
|
self.assertIsInstance(cfg.devices[4],
|
|
|
|
|
vconfig.LibvirtConfigGuestVideo)
|
|
|
|
|
self.assertIsInstance(cfg.devices[5],
|
|
|
|
|
vconfig.LibvirtConfigGuestRng)
|
|
|
|
|
self.assertIsInstance(cfg.devices[6],
|
|
|
|
|
vconfig.LibvirtConfigMemoryBalloon)
|
|
|
|
|
|
|
|
|
|
self.assertEqual(cfg.devices[3].type, 'vnc')
|
|
|
|
@@ -4967,7 +4973,7 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
|
|
|
|
|
|
|
|
|
cfg = self._get_guest_config_with_graphics()
|
|
|
|
|
|
|
|
|
|
self.assertEqual(len(cfg.devices), 7)
|
|
|
|
|
self.assertEqual(len(cfg.devices), 8)
|
|
|
|
|
self.assertIsInstance(cfg.devices[0],
|
|
|
|
|
vconfig.LibvirtConfigGuestDisk)
|
|
|
|
|
self.assertIsInstance(cfg.devices[1],
|
|
|
|
@@ -4981,6 +4987,8 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
|
|
|
|
self.assertIsInstance(cfg.devices[5],
|
|
|
|
|
vconfig.LibvirtConfigGuestVideo)
|
|
|
|
|
self.assertIsInstance(cfg.devices[6],
|
|
|
|
|
vconfig.LibvirtConfigGuestRng)
|
|
|
|
|
self.assertIsInstance(cfg.devices[7],
|
|
|
|
|
vconfig.LibvirtConfigMemoryBalloon)
|
|
|
|
|
|
|
|
|
|
self.assertEqual(cfg.devices[3].type, "tablet")
|
|
|
|
@@ -4999,7 +5007,7 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
|
|
|
|
|
|
|
|
|
cfg = self._get_guest_config_with_graphics()
|
|
|
|
|
|
|
|
|
|
self.assertEqual(len(cfg.devices), 7)
|
|
|
|
|
self.assertEqual(len(cfg.devices), 8)
|
|
|
|
|
self.assertIsInstance(cfg.devices[0],
|
|
|
|
|
vconfig.LibvirtConfigGuestDisk)
|
|
|
|
|
self.assertIsInstance(cfg.devices[1],
|
|
|
|
@@ -5013,6 +5021,8 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
|
|
|
|
self.assertIsInstance(cfg.devices[5],
|
|
|
|
|
vconfig.LibvirtConfigGuestVideo)
|
|
|
|
|
self.assertIsInstance(cfg.devices[6],
|
|
|
|
|
vconfig.LibvirtConfigGuestRng)
|
|
|
|
|
self.assertIsInstance(cfg.devices[7],
|
|
|
|
|
vconfig.LibvirtConfigMemoryBalloon)
|
|
|
|
|
|
|
|
|
|
self.assertEqual(cfg.devices[3].type, 'tablet')
|
|
|
|
@@ -5034,7 +5044,7 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
|
|
|
|
expect = {"ppc": "vga", "ppc64": "vga",
|
|
|
|
|
"ppc64le": "vga", "aarch64": "virtio"}
|
|
|
|
|
video_type = expect.get(blockinfo.libvirt_utils.get_arch({}), "qxl")
|
|
|
|
|
self.assertEqual(len(cfg.devices), 7)
|
|
|
|
|
self.assertEqual(len(cfg.devices), 8)
|
|
|
|
|
self.assertIsInstance(cfg.devices[0],
|
|
|
|
|
vconfig.LibvirtConfigGuestDisk)
|
|
|
|
|
self.assertIsInstance(cfg.devices[1],
|
|
|
|
@@ -5048,6 +5058,8 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
|
|
|
|
self.assertIsInstance(cfg.devices[5],
|
|
|
|
|
vconfig.LibvirtConfigGuestVideo)
|
|
|
|
|
self.assertIsInstance(cfg.devices[6],
|
|
|
|
|
vconfig.LibvirtConfigGuestRng)
|
|
|
|
|
self.assertIsInstance(cfg.devices[7],
|
|
|
|
|
vconfig.LibvirtConfigMemoryBalloon)
|
|
|
|
|
|
|
|
|
|
self.assertEqual(cfg.devices[3].target_name, "com.redhat.spice.0")
|
|
|
|
@@ -5167,7 +5179,7 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
|
|
|
|
|
|
|
|
|
cfg = drvr._get_guest_config(instance_ref, [],
|
|
|
|
|
image_meta, disk_info)
|
|
|
|
|
self.assertEqual(7, len(cfg.devices))
|
|
|
|
|
self.assertEqual(8, len(cfg.devices))
|
|
|
|
|
self.assertIsInstance(cfg.devices[0],
|
|
|
|
|
vconfig.LibvirtConfigGuestDisk)
|
|
|
|
|
self.assertIsInstance(cfg.devices[1],
|
|
|
|
@@ -5181,6 +5193,8 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
|
|
|
|
self.assertIsInstance(cfg.devices[5],
|
|
|
|
|
vconfig.LibvirtConfigGuestVideo)
|
|
|
|
|
self.assertIsInstance(cfg.devices[6],
|
|
|
|
|
vconfig.LibvirtConfigGuestRng)
|
|
|
|
|
self.assertIsInstance(cfg.devices[7],
|
|
|
|
|
vconfig.LibvirtConfigMemoryBalloon)
|
|
|
|
|
|
|
|
|
|
self.assertEqual("tcp", cfg.devices[2].type)
|
|
|
|
@@ -5201,7 +5215,7 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
|
|
|
|
|
|
|
|
|
cfg = drvr._get_guest_config(instance_ref, [],
|
|
|
|
|
image_meta, disk_info)
|
|
|
|
|
self.assertEqual(9, len(cfg.devices))
|
|
|
|
|
self.assertEqual(10, len(cfg.devices))
|
|
|
|
|
self.assertIsInstance(cfg.devices[0],
|
|
|
|
|
vconfig.LibvirtConfigGuestDisk)
|
|
|
|
|
self.assertIsInstance(cfg.devices[1],
|
|
|
|
@@ -5219,6 +5233,8 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
|
|
|
|
self.assertIsInstance(cfg.devices[7],
|
|
|
|
|
vconfig.LibvirtConfigGuestVideo)
|
|
|
|
|
self.assertIsInstance(cfg.devices[8],
|
|
|
|
|
vconfig.LibvirtConfigGuestRng)
|
|
|
|
|
self.assertIsInstance(cfg.devices[9],
|
|
|
|
|
vconfig.LibvirtConfigMemoryBalloon)
|
|
|
|
|
|
|
|
|
|
self.assertEqual("tcp", cfg.devices[2].type)
|
|
|
|
@@ -5259,7 +5275,7 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
|
|
|
|
image_meta)
|
|
|
|
|
cfg = drvr._get_guest_config(instance_ref, [], image_meta,
|
|
|
|
|
disk_info)
|
|
|
|
|
self.assertEqual(9, len(cfg.devices), cfg.devices)
|
|
|
|
|
self.assertEqual(10, len(cfg.devices), cfg.devices)
|
|
|
|
|
self.assertIsInstance(cfg.devices[0],
|
|
|
|
|
vconfig.LibvirtConfigGuestDisk)
|
|
|
|
|
self.assertIsInstance(cfg.devices[1],
|
|
|
|
@@ -5277,6 +5293,8 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
|
|
|
|
self.assertIsInstance(cfg.devices[7],
|
|
|
|
|
vconfig.LibvirtConfigGuestVideo)
|
|
|
|
|
self.assertIsInstance(cfg.devices[8],
|
|
|
|
|
vconfig.LibvirtConfigGuestRng)
|
|
|
|
|
self.assertIsInstance(cfg.devices[9],
|
|
|
|
|
vconfig.LibvirtConfigMemoryBalloon)
|
|
|
|
|
|
|
|
|
|
self.assertEqual("tcp", cfg.devices[2].type)
|
|
|
|
@@ -5632,7 +5650,7 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
|
|
|
|
image_meta)
|
|
|
|
|
cfg = drvr._get_guest_config(instance_ref, [],
|
|
|
|
|
image_meta, disk_info)
|
|
|
|
|
self.assertEqual(len(cfg.devices), 9)
|
|
|
|
|
self.assertEqual(len(cfg.devices), 10)
|
|
|
|
|
self.assertIsInstance(cfg.devices[0],
|
|
|
|
|
vconfig.LibvirtConfigGuestDisk)
|
|
|
|
|
self.assertIsInstance(cfg.devices[1],
|
|
|
|
@@ -5650,6 +5668,8 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
|
|
|
|
self.assertIsInstance(cfg.devices[7],
|
|
|
|
|
vconfig.LibvirtConfigGuestVideo)
|
|
|
|
|
self.assertIsInstance(cfg.devices[8],
|
|
|
|
|
vconfig.LibvirtConfigGuestRng)
|
|
|
|
|
self.assertIsInstance(cfg.devices[9],
|
|
|
|
|
vconfig.LibvirtConfigMemoryBalloon)
|
|
|
|
|
|
|
|
|
|
self.assertEqual(cfg.devices[3].type, "tablet")
|
|
|
|
@@ -5672,7 +5692,7 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
|
|
|
|
image_meta)
|
|
|
|
|
|
|
|
|
|
cfg = drvr._get_guest_config(instance_ref, [], image_meta, disk_info)
|
|
|
|
|
self.assertEqual(len(cfg.devices), 8)
|
|
|
|
|
self.assertEqual(len(cfg.devices), 9)
|
|
|
|
|
self.assertIsInstance(cfg.devices[0],
|
|
|
|
|
vconfig.LibvirtConfigGuestDisk)
|
|
|
|
|
self.assertIsInstance(cfg.devices[1],
|
|
|
|
@@ -5686,11 +5706,13 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
|
|
|
|
self.assertIsInstance(cfg.devices[5],
|
|
|
|
|
vconfig.LibvirtConfigGuestVideo)
|
|
|
|
|
self.assertIsInstance(cfg.devices[6],
|
|
|
|
|
vconfig.LibvirtConfigGuestWatchdog)
|
|
|
|
|
vconfig.LibvirtConfigGuestRng)
|
|
|
|
|
self.assertIsInstance(cfg.devices[7],
|
|
|
|
|
vconfig.LibvirtConfigGuestWatchdog)
|
|
|
|
|
self.assertIsInstance(cfg.devices[8],
|
|
|
|
|
vconfig.LibvirtConfigMemoryBalloon)
|
|
|
|
|
|
|
|
|
|
self.assertEqual("none", cfg.devices[6].action)
|
|
|
|
|
self.assertEqual("none", cfg.devices[7].action)
|
|
|
|
|
|
|
|
|
|
def _test_get_guest_usb_tablet(self, vnc_enabled, spice_enabled, os_type,
|
|
|
|
|
agent_enabled=False, image_meta=None):
|
|
|
|
@@ -5824,7 +5846,7 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
|
|
|
|
cfg = drvr._get_guest_config(instance_ref, [],
|
|
|
|
|
image_meta, disk_info)
|
|
|
|
|
|
|
|
|
|
self.assertEqual(8, len(cfg.devices))
|
|
|
|
|
self.assertEqual(9, len(cfg.devices))
|
|
|
|
|
self.assertIsInstance(cfg.devices[0],
|
|
|
|
|
vconfig.LibvirtConfigGuestDisk)
|
|
|
|
|
self.assertIsInstance(cfg.devices[1],
|
|
|
|
@@ -5838,11 +5860,13 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
|
|
|
|
self.assertIsInstance(cfg.devices[5],
|
|
|
|
|
vconfig.LibvirtConfigGuestVideo)
|
|
|
|
|
self.assertIsInstance(cfg.devices[6],
|
|
|
|
|
vconfig.LibvirtConfigGuestWatchdog)
|
|
|
|
|
vconfig.LibvirtConfigGuestRng)
|
|
|
|
|
self.assertIsInstance(cfg.devices[7],
|
|
|
|
|
vconfig.LibvirtConfigGuestWatchdog)
|
|
|
|
|
self.assertIsInstance(cfg.devices[8],
|
|
|
|
|
vconfig.LibvirtConfigMemoryBalloon)
|
|
|
|
|
|
|
|
|
|
self.assertEqual("none", cfg.devices[6].action)
|
|
|
|
|
self.assertEqual("none", cfg.devices[7].action)
|
|
|
|
|
|
|
|
|
|
def test_get_guest_config_with_watchdog_overrides_flavor(self):
|
|
|
|
|
self.flags(virt_type='kvm', group='libvirt')
|
|
|
|
@@ -5862,7 +5886,7 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
|
|
|
|
cfg = drvr._get_guest_config(instance_ref, [],
|
|
|
|
|
image_meta, disk_info)
|
|
|
|
|
|
|
|
|
|
self.assertEqual(8, len(cfg.devices))
|
|
|
|
|
self.assertEqual(9, len(cfg.devices))
|
|
|
|
|
self.assertIsInstance(cfg.devices[0],
|
|
|
|
|
vconfig.LibvirtConfigGuestDisk)
|
|
|
|
|
self.assertIsInstance(cfg.devices[1],
|
|
|
|
@@ -5876,11 +5900,12 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
|
|
|
|
self.assertIsInstance(cfg.devices[5],
|
|
|
|
|
vconfig.LibvirtConfigGuestVideo)
|
|
|
|
|
self.assertIsInstance(cfg.devices[6],
|
|
|
|
|
vconfig.LibvirtConfigGuestWatchdog)
|
|
|
|
|
vconfig.LibvirtConfigGuestRng)
|
|
|
|
|
self.assertIsInstance(cfg.devices[7],
|
|
|
|
|
vconfig.LibvirtConfigGuestWatchdog)
|
|
|
|
|
self.assertIsInstance(cfg.devices[8],
|
|
|
|
|
vconfig.LibvirtConfigMemoryBalloon)
|
|
|
|
|
|
|
|
|
|
self.assertEqual("pause", cfg.devices[6].action)
|
|
|
|
|
self.assertEqual("pause", cfg.devices[7].action)
|
|
|
|
|
|
|
|
|
|
def test_get_guest_config_with_video_driver_image_meta(self):
|
|
|
|
|
self.flags(virt_type='kvm', group='libvirt')
|
|
|
|
@@ -5891,43 +5916,45 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
|
|
|
|
"disk_format": "raw",
|
|
|
|
|
"properties": {"hw_video_model": "vmvga"}})
|
|
|
|
|
|
|
|
|
|
disk_info = blockinfo.get_disk_info(CONF.libvirt.virt_type,
|
|
|
|
|
instance_ref,
|
|
|
|
|
image_meta)
|
|
|
|
|
cfg = drvr._get_guest_config(instance_ref, [], image_meta, disk_info)
|
|
|
|
|
self.assertEqual(len(cfg.devices), 7)
|
|
|
|
|
self.assertIsInstance(cfg.devices[0],
|
|
|
|
|
vconfig.LibvirtConfigGuestDisk)
|
|
|
|
|
self.assertIsInstance(cfg.devices[1],
|
|
|
|
|
vconfig.LibvirtConfigGuestDisk)
|
|
|
|
|
self.assertIsInstance(cfg.devices[2],
|
|
|
|
|
vconfig.LibvirtConfigGuestSerial)
|
|
|
|
|
self.assertIsInstance(cfg.devices[3],
|
|
|
|
|
vconfig.LibvirtConfigGuestInput)
|
|
|
|
|
self.assertIsInstance(cfg.devices[4],
|
|
|
|
|
vconfig.LibvirtConfigGuestGraphics)
|
|
|
|
|
self.assertIsInstance(cfg.devices[5],
|
|
|
|
|
vconfig.LibvirtConfigGuestVideo)
|
|
|
|
|
self.assertIsInstance(cfg.devices[6],
|
|
|
|
|
vconfig.LibvirtConfigMemoryBalloon)
|
|
|
|
|
|
|
|
|
|
self.assertEqual(cfg.devices[4].type, "vnc")
|
|
|
|
|
self.assertEqual(cfg.devices[5].type, "vmvga")
|
|
|
|
|
|
|
|
|
|
def test_get_guest_config_with_qga_through_image_meta(self):
|
|
|
|
|
self.flags(virt_type='kvm', group='libvirt')
|
|
|
|
|
|
|
|
|
|
drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), True)
|
|
|
|
|
instance_ref = objects.Instance(**self.test_instance)
|
|
|
|
|
image_meta = objects.ImageMeta.from_dict({
|
|
|
|
|
"disk_format": "raw",
|
|
|
|
|
"properties": {"hw_qemu_guest_agent": "yes"}})
|
|
|
|
|
|
|
|
|
|
disk_info = blockinfo.get_disk_info(CONF.libvirt.virt_type,
|
|
|
|
|
instance_ref,
|
|
|
|
|
image_meta)
|
|
|
|
|
cfg = drvr._get_guest_config(instance_ref, [], image_meta, disk_info)
|
|
|
|
|
self.assertEqual(len(cfg.devices), 8)
|
|
|
|
|
self.assertIsInstance(cfg.devices[0],
|
|
|
|
|
vconfig.LibvirtConfigGuestDisk)
|
|
|
|
|
self.assertIsInstance(cfg.devices[1],
|
|
|
|
|
vconfig.LibvirtConfigGuestDisk)
|
|
|
|
|
self.assertIsInstance(cfg.devices[2],
|
|
|
|
|
vconfig.LibvirtConfigGuestSerial)
|
|
|
|
|
self.assertIsInstance(cfg.devices[3],
|
|
|
|
|
vconfig.LibvirtConfigGuestInput)
|
|
|
|
|
self.assertIsInstance(cfg.devices[4],
|
|
|
|
|
vconfig.LibvirtConfigGuestGraphics)
|
|
|
|
|
self.assertIsInstance(cfg.devices[5],
|
|
|
|
|
vconfig.LibvirtConfigGuestVideo)
|
|
|
|
|
self.assertIsInstance(cfg.devices[6],
|
|
|
|
|
vconfig.LibvirtConfigGuestRng)
|
|
|
|
|
self.assertIsInstance(cfg.devices[7],
|
|
|
|
|
vconfig.LibvirtConfigMemoryBalloon)
|
|
|
|
|
|
|
|
|
|
self.assertEqual(cfg.devices[4].type, "vnc")
|
|
|
|
|
self.assertEqual(cfg.devices[5].type, "vmvga")
|
|
|
|
|
|
|
|
|
|
def test_get_guest_config_with_qga_through_image_meta(self):
|
|
|
|
|
self.flags(virt_type='kvm', group='libvirt')
|
|
|
|
|
|
|
|
|
|
drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), True)
|
|
|
|
|
instance_ref = objects.Instance(**self.test_instance)
|
|
|
|
|
image_meta = objects.ImageMeta.from_dict({
|
|
|
|
|
"disk_format": "raw",
|
|
|
|
|
"properties": {"hw_qemu_guest_agent": "yes"}})
|
|
|
|
|
|
|
|
|
|
disk_info = blockinfo.get_disk_info(CONF.libvirt.virt_type,
|
|
|
|
|
instance_ref,
|
|
|
|
|
image_meta)
|
|
|
|
|
cfg = drvr._get_guest_config(instance_ref, [], image_meta, disk_info)
|
|
|
|
|
self.assertEqual(len(cfg.devices), 9)
|
|
|
|
|
self.assertIsInstance(cfg.devices[0],
|
|
|
|
|
vconfig.LibvirtConfigGuestDisk)
|
|
|
|
|
self.assertIsInstance(cfg.devices[1],
|
|
|
|
@@ -5943,6 +5970,8 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
|
|
|
|
self.assertIsInstance(cfg.devices[6],
|
|
|
|
|
vconfig.LibvirtConfigGuestChannel)
|
|
|
|
|
self.assertIsInstance(cfg.devices[7],
|
|
|
|
|
vconfig.LibvirtConfigGuestRng)
|
|
|
|
|
self.assertIsInstance(cfg.devices[8],
|
|
|
|
|
vconfig.LibvirtConfigMemoryBalloon)
|
|
|
|
|
|
|
|
|
|
self.assertEqual(cfg.devices[3].type, "tablet")
|
|
|
|
@@ -5989,7 +6018,7 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
|
|
|
|
|
|
|
|
|
cfg = drvr._get_guest_config(instance_ref, [],
|
|
|
|
|
image_meta, disk_info)
|
|
|
|
|
self.assertEqual(len(cfg.devices), 7)
|
|
|
|
|
self.assertEqual(len(cfg.devices), 8)
|
|
|
|
|
self.assertIsInstance(cfg.devices[0],
|
|
|
|
|
vconfig.LibvirtConfigGuestDisk)
|
|
|
|
|
self.assertIsInstance(cfg.devices[1],
|
|
|
|
@@ -6003,6 +6032,8 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
|
|
|
|
self.assertIsInstance(cfg.devices[5],
|
|
|
|
|
vconfig.LibvirtConfigGuestVideo)
|
|
|
|
|
self.assertIsInstance(cfg.devices[6],
|
|
|
|
|
vconfig.LibvirtConfigGuestRng)
|
|
|
|
|
self.assertIsInstance(cfg.devices[7],
|
|
|
|
|
vconfig.LibvirtConfigMemoryBalloon)
|
|
|
|
|
|
|
|
|
|
self.assertEqual(cfg.devices[4].type, "spice")
|
|
|
|
@@ -6172,7 +6203,7 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
|
|
|
|
instance_ref,
|
|
|
|
|
image_meta)
|
|
|
|
|
cfg = drvr._get_guest_config(instance_ref, [], image_meta, disk_info)
|
|
|
|
|
self.assertEqual(len(cfg.devices), 7)
|
|
|
|
|
self.assertEqual(len(cfg.devices), 8)
|
|
|
|
|
self.assertIsInstance(cfg.devices[0],
|
|
|
|
|
vconfig.LibvirtConfigGuestDisk)
|
|
|
|
|
self.assertIsInstance(cfg.devices[1],
|
|
|
|
@@ -6186,6 +6217,8 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
|
|
|
|
self.assertIsInstance(cfg.devices[5],
|
|
|
|
|
vconfig.LibvirtConfigGuestVideo)
|
|
|
|
|
self.assertIsInstance(cfg.devices[6],
|
|
|
|
|
vconfig.LibvirtConfigGuestRng)
|
|
|
|
|
self.assertIsInstance(cfg.devices[7],
|
|
|
|
|
vconfig.LibvirtConfigMemoryBalloon)
|
|
|
|
|
|
|
|
|
|
self.assertEqual(cfg.devices[3].type, "tablet")
|
|
|
|
@@ -6197,10 +6230,8 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
|
|
|
|
|
|
|
|
|
drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), True)
|
|
|
|
|
instance_ref = objects.Instance(**self.test_instance)
|
|
|
|
|
instance_ref.flavor.extra_specs = {'hw_rng:allowed': 'True'}
|
|
|
|
|
image_meta = objects.ImageMeta.from_dict({
|
|
|
|
|
"disk_format": "raw",
|
|
|
|
|
"properties": {"hw_rng_model": "virtio"}})
|
|
|
|
|
"disk_format": "raw"})
|
|
|
|
|
|
|
|
|
|
disk_info = blockinfo.get_disk_info(CONF.libvirt.virt_type,
|
|
|
|
|
instance_ref,
|
|
|
|
@@ -6235,9 +6266,9 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
|
|
|
|
|
|
|
|
|
drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), True)
|
|
|
|
|
instance_ref = objects.Instance(**self.test_instance)
|
|
|
|
|
instance_ref.flavor.extra_specs = {'hw_rng:allowed': 'False'}
|
|
|
|
|
image_meta = objects.ImageMeta.from_dict({
|
|
|
|
|
"disk_format": "raw",
|
|
|
|
|
"properties": {"hw_rng_model": "virtio"}})
|
|
|
|
|
"disk_format": "raw"})
|
|
|
|
|
|
|
|
|
|
disk_info = blockinfo.get_disk_info(CONF.libvirt.virt_type,
|
|
|
|
|
instance_ref,
|
|
|
|
@@ -6265,12 +6296,10 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
|
|
|
|
|
|
|
|
|
drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), True)
|
|
|
|
|
instance_ref = objects.Instance(**self.test_instance)
|
|
|
|
|
instance_ref.flavor.extra_specs = {'hw_rng:allowed': 'True',
|
|
|
|
|
'hw_rng:rate_bytes': '1024',
|
|
|
|
|
instance_ref.flavor.extra_specs = {'hw_rng:rate_bytes': '1024',
|
|
|
|
|
'hw_rng:rate_period': '2'}
|
|
|
|
|
image_meta = objects.ImageMeta.from_dict({
|
|
|
|
|
"disk_format": "raw",
|
|
|
|
|
"properties": {"hw_rng_model": "virtio"}})
|
|
|
|
|
"disk_format": "raw"})
|
|
|
|
|
|
|
|
|
|
disk_info = blockinfo.get_disk_info(CONF.libvirt.virt_type,
|
|
|
|
|
instance_ref,
|
|
|
|
@@ -6310,10 +6339,8 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
|
|
|
|
|
|
|
|
|
drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), True)
|
|
|
|
|
instance_ref = objects.Instance(**self.test_instance)
|
|
|
|
|
instance_ref.flavor.extra_specs = {'hw_rng:allowed': 'True'}
|
|
|
|
|
image_meta = objects.ImageMeta.from_dict({
|
|
|
|
|
"disk_format": "raw",
|
|
|
|
|
"properties": {"hw_rng_model": "virtio"}})
|
|
|
|
|
"disk_format": "raw"})
|
|
|
|
|
|
|
|
|
|
disk_info = blockinfo.get_disk_info(CONF.libvirt.virt_type,
|
|
|
|
|
instance_ref,
|
|
|
|
@@ -6352,10 +6379,8 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
|
|
|
|
|
|
|
|
|
drvr = libvirt_driver.LibvirtDriver(fake.FakeVirtAPI(), True)
|
|
|
|
|
instance_ref = objects.Instance(**self.test_instance)
|
|
|
|
|
instance_ref.flavor.extra_specs = {'hw_rng:allowed': 'True'}
|
|
|
|
|
image_meta = objects.ImageMeta.from_dict({
|
|
|
|
|
"disk_format": "raw",
|
|
|
|
|
"properties": {"hw_rng_model": "virtio"}})
|
|
|
|
|
"disk_format": "raw"})
|
|
|
|
|
|
|
|
|
|
disk_info = blockinfo.get_disk_info(CONF.libvirt.virt_type,
|
|
|
|
|
instance_ref,
|
|
|
|
@@ -7013,8 +7038,9 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
|
|
|
|
_fake_network_info(self),
|
|
|
|
|
image_meta, disk_info)
|
|
|
|
|
self.assertTrue(mock_path_exists.called)
|
|
|
|
|
mock_path_exists.assert_any_call(
|
|
|
|
|
libvirt_driver.DEFAULT_UEFI_LOADER_PATH['aarch64'][0])
|
|
|
|
|
expected = mock.call(libvirt_driver.
|
|
|
|
|
DEFAULT_UEFI_LOADER_PATH['aarch64'][0])
|
|
|
|
|
self.assertIn(expected, mock_path_exists.mock_calls)
|
|
|
|
|
self.assertEqual(cfg.os_mach_type, "virt")
|
|
|
|
|
|
|
|
|
|
num_ports = 0
|
|
|
|
@@ -7059,8 +7085,9 @@ class LibvirtConnTestCase(test.NoDBTestCase,
|
|
|
|
|
cfg = self._get_guest_config_with_graphics()
|
|
|
|
|
|
|
|
|
|
self.assertTrue(mock_path_exists.called)
|
|
|
|
|
mock_path_exists.assert_any_call(
|
|
|
|
|
libvirt_driver.DEFAULT_UEFI_LOADER_PATH['aarch64'][0])
|
|
|
|
|
expected = mock.call(libvirt_driver.
|
|
|
|
|
DEFAULT_UEFI_LOADER_PATH['aarch64'][0])
|
|
|
|
|
self.assertIn(expected, mock_path_exists.mock_calls)
|
|
|
|
|
self.assertEqual(cfg.os_mach_type, "virt")
|
|
|
|
|
|
|
|
|
|
usbhost_exists = False
|
|
|
|
|