Use UEFI as the default boot for AArch64

There are two ways of booting VM on AArch64 architecture:

1. UEFI
2. kernel+initrd

No one sane goes for 2nd option so hw_firmware_type=uefi has to be set
for every image. Otherwise they simply hang. So let's set is as default
if no other value for hw_firmware_type is set.

If someone will implement own way then they can set hw_firmware_type to
own value and add support to Nova.

Closes-Bug: #1740824

Co-authored-by: Kevin Zhao <Kevin.Zhao@arm.com>
Change-Id: I70ad5ecb420b7d469854e8743e38ba27fd204747
This commit is contained in:
Kevin Zhao 2017-08-02 17:50:28 +08:00 committed by Marcin Juszkiewicz
parent f95f165b49
commit 6f54f5c1e3
2 changed files with 9 additions and 1 deletions

View File

@ -5558,7 +5558,9 @@ class LibvirtConnTestCase(test.NoDBTestCase,
@mock.patch.object(libvirt_driver.LibvirtDriver,
"_get_guest_storage_config")
@mock.patch.object(libvirt_driver.LibvirtDriver, "_has_numa_support")
def test_get_guest_config_aarch64(self, mock_numa, mock_storage):
@mock.patch('os.path.exists', return_value=True)
def test_get_guest_config_aarch64(self, mock_path_exists,
mock_numa, mock_storage):
def get_host_capabilities_stub(self):
cpu = vconfig.LibvirtConfigGuestCPU()
cpu.arch = fields.Architecture.AARCH64
@ -5585,6 +5587,9 @@ class LibvirtConnTestCase(test.NoDBTestCase,
cfg = drvr._get_guest_config(instance_ref,
_fake_network_info(self, 1),
image_meta, disk_info)
self.assertTrue(mock_path_exists.called)
mock_path_exists.assert_called_with(
libvirt_driver.DEFAULT_UEFI_LOADER_PATH['aarch64'])
self.assertEqual(cfg.os_mach_type, "virt")
def test_get_guest_config_machine_type_s390(self):

View File

@ -4502,6 +4502,9 @@ class LibvirtDriver(driver.ComputeDriver):
guest.sysinfo = self._get_guest_config_sysinfo(instance)
guest.os_smbios = vconfig.LibvirtConfigGuestSMBIOS()
hw_firmware_type = image_meta.properties.get('hw_firmware_type')
if caps.host.cpu.arch == fields.Architecture.AARCH64:
if not hw_firmware_type:
hw_firmware_type = fields.FirmwareType.UEFI
if hw_firmware_type == fields.FirmwareType.UEFI:
if self._has_uefi_support():
global uefi_logged