Merge "Add support for LXD live migration"

This commit is contained in:
Jenkins
2016-07-13 13:16:35 +00:00
committed by Gerrit Code Review
5 changed files with 35 additions and 2 deletions

View File

@@ -103,7 +103,10 @@ options:
enable-live-migration:
type: boolean
default: False
description: Configure libvirt for live migration.
description: |
Configure libvirt or lxd for live migration.
Live migration support for lxd is still considered experimental.
migration-auth-type:
type: string
default:

View File

@@ -209,7 +209,11 @@ class NovaComputeVirtContext(context.OSContextGenerator):
interfaces = []
def __call__(self):
return {}
ctxt = {}
if lsb_release()['DISTRIB_CODENAME'].lower() >= "yakkety":
ctxt['virt_type'] = config('virt-type')
ctxt['enable_live_migration'] = config('enable-live-migration')
return ctxt
def assert_libvirt_rbd_imagebackend_allowed():

View File

@@ -99,6 +99,7 @@ from nova_compute_context import (
ceph_config_file,
HostIPContext,
DesignateContext,
NovaComputeVirtContext,
)
CA_CERT_PATH = '/usr/local/share/ca-certificates/keystone_juju_ca_cert.crt'
@@ -203,6 +204,7 @@ BASE_RESOURCE_MAP = {
MetadataServiceContext(),
HostIPContext(),
DesignateContext(),
NovaComputeVirtContext(),
context.LogLevelContext(),
context.InternalEndpointContext()],
},

View File

@@ -200,6 +200,11 @@ disk_cachemodes = {{ disk_cachemodes }}
# live block migration can be supported.
live_migration_tunnelled = False
{% if virt_type == 'lxd' and enable_live_migration -%}
[lxd]
allow_live_migration = True
{% endif -%}
{% include "parts/section-database" %}
{% include "section-rabbitmq-oslo" %}

View File

@@ -244,6 +244,25 @@ class NovaComputeContextTests(CharmTestCase):
'host_uuid': self.host_uuid,
'reserved_host_memory': 512}, libvirt())
def test_lxd_live_migration_opts_xenial(self):
self.kv.return_value = FakeUnitdata(**{'host_uuid': self.host_uuid})
self.lsb_release.return_value = {'DISTRIB_CODENAME': 'xenial'}
self.test_config.set('enable-live-migration', False)
self.test_config.set('virt-type', 'lxd')
lxd = context.NovaComputeVirtContext()
self.assertEqual({}, lxd())
def test_lxd_live_migration_opts_yakkety(self):
self.kv.return_value = FakeUnitdata(**{'host_uuid': self.host_uuid})
self.lsb_release.return_value = {'DISTRIB_CODENAME': 'yakkety'}
self.test_config.set('enable-live-migration', True)
self.test_config.set('virt-type', 'lxd')
lxd = context.NovaComputeVirtContext()
self.assertEqual(
{'enable_live_migration': True, 'virt_type': 'lxd'}, lxd())
@patch.object(context.uuid, 'uuid4')
def test_libvirt_new_uuid(self, mock_uuid):
self.kv.return_value = FakeUnitdata()