libvirt: Use 'virt' as the default machine type for ARMv7

The existing Nova's default machine type for ARMv7 ('vexpress-15') was
added more than four years ago (in commit: 5b27fe7: "libvirt: Allow
specification of default machine type").  The 'vexpress-15' board is a
specific development board, which has hardware limitations (like only
single ethernet adapter).

The upstream QEMU recommendation[1] for the past couple of years is to
use the 'virt' machine type for both ARMv7, and AArch64, which was
specifically designed to be used with virutal machines.  Quoting a
write-up[2] from QEMU's ARM subsystem maintainer:

    "Why the 'virt' board?

    "QEMU has models of nearly 50 different ARM boards, which makes it
    difficult for new users to pick one which is right for their
    purposes.  This wild profusion reflects a similar diversity in the
    real hardware world: ARM systems come in many different flavours
    with very different hardware components and capabilities. A kernel
    which is expecting to run on one system will likely not run on
    another. Many of QEMU’s models are annoyingly limited because the
    real hardware was also limited — there’s no PCI bus on most mobile
    devices, after all, and a fifteen year old development board
    wouldn’t have had a gigabyte of RAM on it.

    "My recommendation is that if you don’t know for certain that you
    want a model of a specific device, you should choose the “virt”
    board. This is a purely virtual platform designed for use in virtual
    machines, and it supports PCI, virtio, a recent ARM CPU and large
    amounts of RAM. The only thing it doesn’t have out of the box is
    graphics, but graphical programs on a fully emulated system run very
    slowly anyway so are best avoided."

So, change the default machine type for ARMv7 arch to be 'virt'.

[1] https://wiki.qemu.org/Documentation/Platforms/ARM
[2] https://translatedcode.wordpress.com/2016/11/03/installing-debian-on-qemus-32-bit-arm-virt-board/

Change-Id: If9ffa5a019f67734a9f30ccaf3ab96ff41262dc8
Signed-off-by: Kashyap Chamarthy <kchamart@redhat.com>
This commit is contained in:
Kashyap Chamarthy 2018-09-14 11:49:08 +02:00
parent ffdd809838
commit e155baefb0
3 changed files with 23 additions and 10 deletions

View File

@ -6221,7 +6221,7 @@ class LibvirtConnTestCase(test.NoDBTestCase,
cfg = drvr._get_guest_config(instance_ref,
_fake_network_info(self, 1),
image_meta, disk_info)
self.assertEqual(cfg.os_mach_type, "vexpress-a15")
self.assertEqual(cfg.os_mach_type, "virt")
@mock.patch.object(libvirt_driver.LibvirtDriver,
"_get_guest_storage_config")

View File

@ -4169,20 +4169,21 @@ class LibvirtDriver(driver.ComputeDriver):
return mappings
def _get_machine_type(self, image_meta, caps):
# The underlying machine type can be set as an image attribute,
# or otherwise based on some architecture specific defaults
# The guest machine type can be set as an image metadata
# property, or otherwise based on architecture-specific
# defaults.
mach_type = None
if image_meta.properties.get('hw_machine_type') is not None:
mach_type = image_meta.properties.hw_machine_type
else:
# For ARM systems we will default to vexpress-a15 for armv7
# and virt for aarch64
if caps.host.cpu.arch == fields.Architecture.ARMV7:
mach_type = "vexpress-a15"
if caps.host.cpu.arch == fields.Architecture.AARCH64:
# NOTE(kchamart): For ARMv7 and AArch64, use the 'virt'
# board as the default machine type. It is the recommended
# board, which is designed to be used with virtual machines.
# The 'virt' board is more flexible, supports PCI, 'virtio',
# has decent RAM limits, etc.
if caps.host.cpu.arch in (fields.Architecture.ARMV7,
fields.Architecture.AARCH64):
mach_type = "virt"
if caps.host.cpu.arch in (fields.Architecture.S390,

View File

@ -0,0 +1,12 @@
---
upgrade:
- |
The default QEMU machine type for ARMv7 architecture is now changed
to ``virt`` (from the older ``vexpress-a15``, which is a particular
ARM development board). The ``virt`` board is the recommended
default for ARMv7, which is explicitly designed to be
used with virtual machines. It is more flexible, supports PCI and
'virtio' devices, has decent RAM limits, and so forth. For
pre-existing Nova guests on ARMv7 to acquire the ``virt`` machine
type: (a) upgrade Nova with this fix; (b) explicitly start and stop
the guests, then they will pick up the 'virt' machine type.