Enable support for auto-converge and post-copy

Implement missing configuration options and context to support
configuration of:

  live_migration_permit_auto_converge
  live_migration_permit_post_copy

in nova.conf. The configuration parameters are only added to the
nova.conf template when live-migration is actually enabled, since they
have no purpose without live-migration enabled. The options are added to
version Newton and upwards as that is the Nova version since they were
first supported.

Change-Id: I1bb3cee4ac532d0867b4297c742707668566a527
Closes-Bug: #1799916
(cherry picked from commit 1fa2a8023c)
This commit is contained in:
Niels van Adrichem 2018-10-24 14:07:33 +00:00 committed by Edward Hope-Morley
parent 685a2e54e1
commit 0043d38223
6 changed files with 80 additions and 0 deletions

View File

@ -108,6 +108,18 @@ options:
description: |
TCP authentication scheme for libvirt live migration. Available options
include ssh.
live-migration-permit-post-copy:
type: boolean
default: False
description: |
If live-migration is enabled, this option allows Nova to switch an on-
going live migration to post-copy mode.
live-migration-permit-auto-converge:
type: boolean
default: False
description: |
If live-migration is enabled, this option allows Nova to throttle down
CPU when an on-going live migration is slow.
authorized-keys-path:
type: string
default: '{homedir}/.ssh/authorized_keys'

View File

@ -198,6 +198,12 @@ class NovaComputeLibvirtContext(context.OSContextGenerator):
# nova.conf
ctxt['live_migration_uri'] = 'qemu+ssh://%s/system'
if config('enable-live-migration'):
ctxt['live_migration_permit_post_copy'] = \
config('live-migration-permit-post-copy')
ctxt['live_migration_permit_auto_converge'] = \
config('live-migration-permit-auto-converge')
if config('instances-path') is not None:
ctxt['instances_path'] = config('instances-path')

View File

@ -199,6 +199,12 @@ rbd_secret_uuid = {{ rbd_secret_uuid }}
{% if live_migration_uri -%}
live_migration_uri = {{ live_migration_uri }}
{% endif -%}
{% if live_migration_permit_post_copy -%}
live_migration_permit_post_copy = {{ live_migration_permit_post_copy }}
{% endif -%}
{% if live_migration_permit_auto_converge -%}
live_migration_permit_auto_converge = {{ live_migration_permit_auto_converge }}
{% endif -%}
{% if disk_cachemodes -%}
disk_cachemodes = {{ disk_cachemodes }}
{% endif %}

View File

@ -203,6 +203,12 @@ rbd_secret_uuid = {{ rbd_secret_uuid }}
{% if live_migration_uri -%}
live_migration_uri = {{ live_migration_uri }}
{% endif -%}
{% if live_migration_permit_post_copy -%}
live_migration_permit_post_copy = {{ live_migration_permit_post_copy }}
{% endif -%}
{% if live_migration_permit_auto_converge -%}
live_migration_permit_auto_converge = {{ live_migration_permit_auto_converge }}
{% endif -%}
{% if disk_cachemodes -%}
disk_cachemodes = {{ disk_cachemodes }}
{% endif %}

View File

@ -211,6 +211,12 @@ rbd_secret_uuid = {{ rbd_secret_uuid }}
{% if live_migration_uri -%}
live_migration_uri = {{ live_migration_uri }}
{% endif -%}
{% if live_migration_permit_post_copy -%}
live_migration_permit_post_copy = {{ live_migration_permit_post_copy }}
{% endif -%}
{% if live_migration_permit_auto_converge -%}
live_migration_permit_auto_converge = {{ live_migration_permit_auto_converge }}
{% endif -%}
{% if disk_cachemodes -%}
disk_cachemodes = {{ disk_cachemodes }}
{% endif %}

View File

@ -250,6 +250,50 @@ class NovaComputeContextTests(CharmTestCase):
'listen_tls': 0,
'host_uuid': self.host_uuid,
'live_migration_uri': 'qemu+ssh://%s/system',
'live_migration_permit_auto_converge': False,
'live_migration_permit_post_copy': False,
'force_raw_images': True,
'reserved_host_memory': 512}, libvirt())
def test_libvirt_bin_context_migration_tcp_listen_with_auto_converge(self):
self.kv.return_value = FakeUnitdata(**{'host_uuid': self.host_uuid})
self.lsb_release.return_value = {'DISTRIB_CODENAME': 'lucid'}
self.test_config.set('enable-live-migration', True)
self.test_config.set('live-migration-permit-auto-converge', True)
libvirt = context.NovaComputeLibvirtContext()
self.assertEqual(
{'libvirtd_opts': '-d -l',
'libvirt_user': 'libvirtd',
'arch': platform.machine(),
'ksm': 'AUTO',
'kvm_hugepages': 0,
'listen_tls': 0,
'host_uuid': self.host_uuid,
'live_migration_uri': 'qemu+ssh://%s/system',
'live_migration_permit_auto_converge': True,
'live_migration_permit_post_copy': False,
'force_raw_images': True,
'reserved_host_memory': 512}, libvirt())
def test_libvirt_bin_context_migration_tcp_listen_with_post_copy(self):
self.kv.return_value = FakeUnitdata(**{'host_uuid': self.host_uuid})
self.lsb_release.return_value = {'DISTRIB_CODENAME': 'lucid'}
self.test_config.set('enable-live-migration', True)
self.test_config.set('live-migration-permit-post-copy', True)
libvirt = context.NovaComputeLibvirtContext()
self.assertEqual(
{'libvirtd_opts': '-d -l',
'libvirt_user': 'libvirtd',
'arch': platform.machine(),
'ksm': 'AUTO',
'kvm_hugepages': 0,
'listen_tls': 0,
'host_uuid': self.host_uuid,
'live_migration_uri': 'qemu+ssh://%s/system',
'live_migration_permit_auto_converge': False,
'live_migration_permit_post_copy': True,
'force_raw_images': True,
'reserved_host_memory': 512}, libvirt())