aarch64: set default cpu_mode to host-passthrough

Unless explicit configuration is supplied by the charm user, set
the cpu_mode configuration on the aarch64 architecture to
host-passthrough; host-model is not supported by the underlying
hypervisor.

Change-Id: I6df2d70e7b5fed7e614ca981864f6f737a1a90eb
Closes-Bug: 1673467
This commit is contained in:
James Page 2017-07-26 14:35:33 +01:00
parent ce7f164e7f
commit b5d9b18c0a
2 changed files with 12 additions and 1 deletions

View File

@ -197,7 +197,7 @@ class NovaComputeLibvirtContext(context.OSContextGenerator):
if config('cpu-mode'):
ctxt['cpu_mode'] = config('cpu-mode')
elif ctxt['arch'] in ['ppc64el', 'ppc64le']:
elif ctxt['arch'] in ('ppc64el', 'ppc64le', 'aarch64'):
ctxt['cpu_mode'] = 'host-passthrough'
elif ctxt['arch'] == 's390x':
ctxt['cpu_mode'] = 'none'

View File

@ -364,6 +364,17 @@ class NovaComputeContextTests(CharmTestCase):
self.assertEqual(libvirt()['cpu_mode'],
'none')
@patch.object(context, 'platform')
@patch.object(context.uuid, 'uuid4')
def test_libvirt_cpu_mode_aarch64(self, mock_uuid, mock_platform):
self.lsb_release.return_value = {'DISTRIB_CODENAME': 'xenial'}
mock_uuid.return_value = 'e46e530d-18ae-4a67-9ff0-e6e2ba7c60a7'
mock_platform.machine.return_value = 'aarch64'
libvirt = context.NovaComputeLibvirtContext()
self.assertEqual(libvirt()['cpu_mode'],
'host-passthrough')
def test_libvirt_vnf_configs(self):
self.kv.return_value = FakeUnitdata(**{'host_uuid': self.host_uuid})
self.lsb_release.return_value = {'DISTRIB_CODENAME': 'lucid'}