From 0e0fedb05b70a6e51257ab8966499434ac79c2f9 Mon Sep 17 00:00:00 2001 From: Paul Bourke Date: Tue, 11 Oct 2016 15:29:00 +0100 Subject: [PATCH] Allow operators to change hw_disk_discard in Nova Some base image distros don't ship new enough versions of libvirt/qemu to support hw_disk_discard in Nova (libvirt (1, 0, 6) or later and qemu (1, 6, 0) or later). When deploying Nova with Ceph enabled this config item is automatically turned on, we should give operators a chance to disable it. Change-Id: I0b2615c64a9569c09567bf456815f93254d90ade Closes-Bug: #1632348 --- ansible/roles/nova/defaults/main.yml | 4 ++++ ansible/roles/nova/templates/nova.conf.j2 | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ansible/roles/nova/defaults/main.yml b/ansible/roles/nova/defaults/main.yml index 2d80abf33e..bf24c02f78 100644 --- a/ansible/roles/nova/defaults/main.yml +++ b/ansible/roles/nova/defaults/main.yml @@ -13,6 +13,10 @@ nova_pool_name: "{{ ceph_nova_pool_name }}" nova_pool_type: "{{ ceph_nova_pool_type }}" nova_cache_mode: "{{ ceph_nova_cache_mode }}" +# Discard option for nova managed disks. Requires libvirt (1, 0, 6) or later and +# qemu (1, 6, 0) or later. Set to "" to disable. +nova_hw_disk_discard: "unmap" + #################### # Database diff --git a/ansible/roles/nova/templates/nova.conf.j2 b/ansible/roles/nova/templates/nova.conf.j2 index 82c991e94f..5a00bc6d9e 100644 --- a/ansible/roles/nova/templates/nova.conf.j2 +++ b/ansible/roles/nova/templates/nova.conf.j2 @@ -175,7 +175,9 @@ images_rbd_pool = {{ ceph_nova_pool_name }} images_rbd_ceph_conf = /etc/ceph/ceph.conf rbd_user = nova disk_cachemodes="network=writeback" -hw_disk_discard = unmap +{% if nova_hw_disk_discard != '' %} +hw_disk_discard = {{ nova_hw_disk_discard }} +{% endif %} {% endif %} {% if nova_backend == "rbd" %} rbd_secret_uuid = {{ rbd_secret_uuid }}