summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Page <james.page@ubuntu.com>2017-07-26 14:35:33 +0100
committerJames Page <james.page@ubuntu.com>2017-07-26 14:35:33 +0100
commitb5d9b18c0afd06b721d78bced96b4c6c19f77834 (patch)
tree2e7703aa55fd694ffbb01e77a8a9559ab1c59e31
parentce7f164e7f88e17e44aea292a6e0b35402dcafa8 (diff)
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
Notes
Notes (review): Verified+1: Canonical CI <uosci-testing-bot@ubuntu.com> Code-Review+2: Chris MacNaughton <chris.macnaughton@canonical.com> Code-Review+2: Alex Kavanagh <alex.kavanagh@canonical.com> Workflow+1: Alex Kavanagh <alex.kavanagh@canonical.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Thu, 27 Jul 2017 09:23:10 +0000 Reviewed-on: https://review.openstack.org/487422 Project: openstack/charm-nova-compute Branch: refs/heads/master
-rw-r--r--hooks/nova_compute_context.py2
-rw-r--r--unit_tests/test_nova_compute_contexts.py11
2 files changed, 12 insertions, 1 deletions
diff --git a/hooks/nova_compute_context.py b/hooks/nova_compute_context.py
index 528740d..78902b6 100644
--- a/hooks/nova_compute_context.py
+++ b/hooks/nova_compute_context.py
@@ -197,7 +197,7 @@ class NovaComputeLibvirtContext(context.OSContextGenerator):
197 197
198 if config('cpu-mode'): 198 if config('cpu-mode'):
199 ctxt['cpu_mode'] = config('cpu-mode') 199 ctxt['cpu_mode'] = config('cpu-mode')
200 elif ctxt['arch'] in ['ppc64el', 'ppc64le']: 200 elif ctxt['arch'] in ('ppc64el', 'ppc64le', 'aarch64'):
201 ctxt['cpu_mode'] = 'host-passthrough' 201 ctxt['cpu_mode'] = 'host-passthrough'
202 elif ctxt['arch'] == 's390x': 202 elif ctxt['arch'] == 's390x':
203 ctxt['cpu_mode'] = 'none' 203 ctxt['cpu_mode'] = 'none'
diff --git a/unit_tests/test_nova_compute_contexts.py b/unit_tests/test_nova_compute_contexts.py
index 31dae26..dfdca4a 100644
--- a/unit_tests/test_nova_compute_contexts.py
+++ b/unit_tests/test_nova_compute_contexts.py
@@ -364,6 +364,17 @@ class NovaComputeContextTests(CharmTestCase):
364 self.assertEqual(libvirt()['cpu_mode'], 364 self.assertEqual(libvirt()['cpu_mode'],
365 'none') 365 'none')
366 366
367 @patch.object(context, 'platform')
368 @patch.object(context.uuid, 'uuid4')
369 def test_libvirt_cpu_mode_aarch64(self, mock_uuid, mock_platform):
370 self.lsb_release.return_value = {'DISTRIB_CODENAME': 'xenial'}
371 mock_uuid.return_value = 'e46e530d-18ae-4a67-9ff0-e6e2ba7c60a7'
372 mock_platform.machine.return_value = 'aarch64'
373 libvirt = context.NovaComputeLibvirtContext()
374
375 self.assertEqual(libvirt()['cpu_mode'],
376 'host-passthrough')
377
367 def test_libvirt_vnf_configs(self): 378 def test_libvirt_vnf_configs(self):
368 self.kv.return_value = FakeUnitdata(**{'host_uuid': self.host_uuid}) 379 self.kv.return_value = FakeUnitdata(**{'host_uuid': self.host_uuid})
369 self.lsb_release.return_value = {'DISTRIB_CODENAME': 'lucid'} 380 self.lsb_release.return_value = {'DISTRIB_CODENAME': 'lucid'}