From f0f09530ee9169eb29bc28d4f118676d7dc6640e Mon Sep 17 00:00:00 2001 From: Kevin Zhao Date: Tue, 15 Aug 2017 09:52:09 +0000 Subject: [PATCH] Add video type virtio for AArch64 Currently only "virtio" type is supported on AArch64, and the other "virrus", "qxl" and "vga" don't work on AArch64 according to libvirt upstream: https://www.redhat.com/archives/libvir-list/2016-September/msg00546.html Then this patch adds the virtio for AArch64 and tweaks the related test cases. Closes-bug: #1710766 Change-Id: Iba8a1e671f2b5759b3d9178aa1871d0cf888b26b Signed-off-by: Kevin Zhao --- nova/tests/unit/virt/libvirt/test_driver.py | 5 ++++- nova/virt/libvirt/driver.py | 7 ++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/nova/tests/unit/virt/libvirt/test_driver.py b/nova/tests/unit/virt/libvirt/test_driver.py index c837d02b6141..c19d73f5cc79 100644 --- a/nova/tests/unit/virt/libvirt/test_driver.py +++ b/nova/tests/unit/virt/libvirt/test_driver.py @@ -3685,6 +3685,9 @@ class LibvirtConnTestCase(test.NoDBTestCase, cfg = self._get_guest_config_with_graphics() + expect = {"ppc": "vga", "ppc64": "vga", + "ppc64le": "vga", "aarch64": "virtio"} + video_type = expect.get(blockinfo.libvirt_utils.get_arch({}), "qxl") self.assertEqual(len(cfg.devices), 8) self.assertIsInstance(cfg.devices[0], vconfig.LibvirtConfigGuestDisk) @@ -3706,7 +3709,7 @@ class LibvirtConnTestCase(test.NoDBTestCase, self.assertEqual(cfg.devices[4].target_name, "com.redhat.spice.0") self.assertEqual(cfg.devices[4].type, 'spicevmc') self.assertEqual(cfg.devices[5].type, "spice") - self.assertEqual(cfg.devices[6].type, "qxl") + self.assertEqual(cfg.devices[6].type, video_type) def test_get_guest_config_with_vnc_no_keymap(self): self.flags(virt_type='kvm', group='libvirt') diff --git a/nova/virt/libvirt/driver.py b/nova/virt/libvirt/driver.py index a46b6a69d9b1..637935b1fb0b 100644 --- a/nova/virt/libvirt/driver.py +++ b/nova/virt/libvirt/driver.py @@ -4342,7 +4342,8 @@ class LibvirtDriver(driver.ComputeDriver): allowed=ALLOWED_QEMU_SERIAL_PORTS, virt_type=virt_type) def _add_video_driver(self, guest, image_meta, flavor): - VALID_VIDEO_DEVICES = ("vga", "cirrus", "vmvga", "xen", "qxl") + VALID_VIDEO_DEVICES = ("vga", "cirrus", "vmvga", + "xen", "qxl", "virtio") video = vconfig.LibvirtConfigGuestVideo() # NOTE(ldbragst): The following logic sets the video.type # depending on supported defaults given the architecture, @@ -4360,6 +4361,10 @@ class LibvirtDriver(driver.ComputeDriver): # NOTE(ldbragst): PowerKVM doesn't support 'cirrus' be default # so use 'vga' instead when running on Power hardware. video.type = 'vga' + elif guestarch in (fields.Architecture.AARCH64): + # NOTE(kevinz): Only virtio device type is supported by AARCH64 + # so use 'virtio' instead when running on AArch64 hardware. + video.type = 'virtio' elif CONF.spice.enabled: video.type = 'qxl' if image_meta.properties.get('hw_video_model'):