From ce6b8d59dd6bf3c3373f1c62d4a7de383e201806 Mon Sep 17 00:00:00 2001 From: Matt Thompson Date: Thu, 13 Aug 2015 11:17:57 +0100 Subject: [PATCH] Add nova_libvirt_live_migration_flag variable Currently live_migration_flag is only written to nova.conf if Ceph is in use. However, there may be other use cases using live migrations where being able to override this is necessary. This commit introduces a new variable called nova_libvirt_live_migration_flag and writes live_migration_flag to nova.conf irrespective of whether Ceph is in use. We also relocate nova_libvirt_disk_cachemodes and nova_libvirt_hw_disk_discard in defaults/main.yml so that these defaults sit with the other nova_libvirt defaults. NOTE: We change the live_migration_flag defaults here to match nova's defaults. Several Ceph resources suggest to use VIR_MIGRATE_PERSIST_DEST however in my limited testing this did not appear to be necessary. We can update the default or amend it when using Ceph if we find that it is in fact necessary. Closes-Bug: #1484439 Change-Id: I1baa9d590ae90ca45c763c8a5e6546c4825eabfe --- defaults/main.yml | 5 +++-- templates/nova.conf.j2 | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 22281eec..a2303066 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -182,6 +182,9 @@ nova_libvirt_inject_key: False # -2 => disable, -1 => inspect (libguestfs only), 0 => not partitioned, >0 => partition number nova_libvirt_inject_partition: -2 nova_libvirt_inject_password: False +nova_libvirt_disk_cachemodes: '{{ nova_libvirt_images_rbd_pool is defined | ternary("network=writeback", "") }}' +nova_libvirt_hw_disk_discard: '{{ nova_libvirt_images_rbd_pool is defined | ternary("unmap", "ignore") }}' +nova_libvirt_live_migration_flag: "VIR_MIGRATE_UNDEFINE_SOURCE,VIR_MIGRATE_PEER2PEER,VIR_MIGRATE_LIVE,VIR_MIGRATE_TUNNELLED" ## Nova conductor nova_conductor_program_name: nova-conductor @@ -250,8 +253,6 @@ nova_recreate_keys: False #nova_libvirt_images_rbd_pool: vms nova_ceph_client: '{{ cinder_ceph_client }}' nova_ceph_client_uuid: 517a4663-3927-44bc-9ea7-4a90e1cd4c66 -nova_libvirt_disk_cachemodes: '{{ nova_libvirt_images_rbd_pool is defined | ternary("network=writeback", "") }}' -nova_libvirt_hw_disk_discard: '{{ nova_libvirt_images_rbd_pool is defined | ternary("unmap", "ignore") }}' ## General Neutron configuration # If ``nova_osapi_compute_workers`` is unset the system will use half the number of available VCPUS to diff --git a/templates/nova.conf.j2 b/templates/nova.conf.j2 index c1c31dd6..560179e6 100644 --- a/templates/nova.conf.j2 +++ b/templates/nova.conf.j2 @@ -252,7 +252,7 @@ rbd_secret_uuid = {{ nova_ceph_client_uuid }} images_type = rbd images_rbd_pool = {{ nova_libvirt_images_rbd_pool }} images_rbd_ceph_conf = /etc/ceph/ceph.conf -live_migration_flag="VIR_MIGRATE_UNDEFINE_SOURCE,VIR_MIGRATE_PEER2PEER,VIR_MIGRATE_LIVE,VIR_MIGRATE_PERSIST_DEST" {% endif %} +live_migration_flag = "{{ nova_libvirt_live_migration_flag }}" hw_disk_discard = {{ nova_libvirt_hw_disk_discard }} disk_cachemodes = {{ nova_libvirt_disk_cachemodes }}