[clark-laughlin, r=gnuoy]

This change allows the nova-compute charm to deploy on arm64 machines without requiring a different configuration to be used. To deploy nova-compute on arm64 requires 2 settings in nova.conf, which are not required for amd64:

libvirt_use_virtio_for_bridges = False
libvirt_disk_prefix = vd

Since juju configuration is specified at the service level, there is not a way to provide a separate configuration when deploying an amd64 unit and an arm64 unit -- preventing deployment of openstack with a mixture of arm64 and amd64 nova-compute nodes.

This change simply detects the machine architecture, and adds the two configuration settings to nova.conf when running on an arm64 (aarch64) machine. Behavior when running on other architectures is unchanged.
This commit is contained in:
Liam Young 2015-03-30 16:01:25 +01:00
commit b65683f201
5 changed files with 30 additions and 3 deletions

View File

@ -1,5 +1,5 @@
import uuid
import platform
from charmhelpers.contrib.openstack import context
from charmhelpers.core.host import service_running, service_start
from charmhelpers.fetch import apt_install, filter_installed_packages
@ -104,6 +104,9 @@ class NovaComputeLibvirtContext(context.OSContextGenerator):
'listen_tls': 0,
}
# get the processor architecture to use in the nova.conf template
ctxt['arch'] = platform.machine()
# enable tcp listening if configured for live migration.
if config('enable-live-migration'):
ctxt['libvirtd_opts'] += ' -l'

View File

@ -13,7 +13,14 @@ logdir=/var/log/nova
state_path=/var/lib/nova
lock_path=/var/lock/nova
force_dhcp_release=True
{% if arch == 'aarch64' -%}
libvirt_use_virtio_for_bridges=False
libvirt_disk_prefix=vd
{% else -%}
libvirt_use_virtio_for_bridges=True
{% endif -%}
verbose=True
use_syslog = {{ use_syslog }}
ec2_private_dns_show_ip=True

View File

@ -13,7 +13,14 @@ logdir=/var/log/nova
state_path=/var/lib/nova
lock_path=/var/lock/nova
force_dhcp_release=True
{% if arch == 'aarch64' -%}
libvirt_use_virtio_for_bridges=False
libvirt_disk_prefix=vd
{% else -%}
libvirt_use_virtio_for_bridges=True
{% endif -%}
verbose=True
use_syslog = {{ use_syslog }}
ec2_private_dns_show_ip=True

View File

@ -21,6 +21,11 @@ auth_strategy=keystone
compute_driver=libvirt.LibvirtDriver
my_ip = {{ host_ip }}
{% if arch == 'aarch64' -%}
libvirt_use_virtio_for_bridges=False
libvirt_disk_prefix=vd
{% endif -%}
{% if console_vnc_type -%}
vnc_enabled = True
novnc_enabled = True

View File

@ -1,3 +1,5 @@
import platform
from mock import patch
from test_utils import CharmTestCase
@ -179,6 +181,7 @@ class NovaComputeContextTests(CharmTestCase):
self.assertEqual(
{'libvirtd_opts': '-d',
'arch': platform.machine(),
'listen_tls': 0,
'host_uuid': 'e46e530d-18ae-4a67-9ff0-e6e2ba7c60a7'}, libvirt())
@ -190,6 +193,7 @@ class NovaComputeContextTests(CharmTestCase):
self.assertEqual(
{'libvirtd_opts': '-d -l',
'arch': platform.machine(),
'listen_tls': 0,
'host_uuid': 'e46e530d-18ae-4a67-9ff0-e6e2ba7c60a7'}, libvirt())
@ -201,9 +205,10 @@ class NovaComputeContextTests(CharmTestCase):
self.assertEqual(
{'libvirtd_opts': '-d',
'disk_cachemodes': 'file=unsafe,block=none',
'arch': platform.machine(),
'listen_tls': 0,
'host_uuid': 'e46e530d-18ae-4a67-9ff0-e6e2ba7c60a7',
'disk_cachemodes': 'file=unsafe,block=none'}, libvirt())
'host_uuid': 'e46e530d-18ae-4a67-9ff0-e6e2ba7c60a7'}, libvirt())
@patch.object(context.NeutronComputeContext, 'network_manager')
@patch.object(context.NeutronComputeContext, 'plugin')