[hopem,r=gnuoy]

Ensure libvirt image backend pool is configured if
RBDImageBackend enabled post-deploy.
Closes-Bug: 1489463
This commit is contained in:
Liam Young 2016-02-22 09:33:49 +00:00
commit 1bea39d454
2 changed files with 17 additions and 13 deletions

View File

@ -8,6 +8,7 @@ from charmhelpers.core.hookenv import (
log,
ERROR,
relation_ids,
related_units,
relation_get,
relation_set,
service_name,
@ -161,6 +162,12 @@ def config_changed():
if config('hugepages'):
install_hugepages()
if (config('libvirt-image-backend') == 'rbd' and
assert_libvirt_imagebackend_allowed()):
for rid in relation_ids('ceph'):
for unit in related_units(rid):
ceph_changed(rid=rid, unit=unit)
CONFIGS.write_all()
@ -291,7 +298,7 @@ def get_ceph_request():
@hooks.hook('ceph-relation-changed')
@restart_on_change(restart_map())
def ceph_changed():
def ceph_changed(rid=None, unit=None):
if 'ceph' not in CONFIGS.complete_contexts():
log('ceph relation incomplete. Peer not ready?')
return
@ -307,10 +314,10 @@ def ceph_changed():
# With some refactoring, this can move into NovaComputeCephContext
# and allow easily extended to support other compute flavors.
if config('virt-type') in ['kvm', 'qemu', 'lxc'] and relation_get('key'):
key = relation_get(attribute='key', rid=rid, unit=unit)
if config('virt-type') in ['kvm', 'qemu', 'lxc'] and key:
create_libvirt_secret(secret_file=CEPH_SECRET,
secret_uuid=CEPH_SECRET_UUID,
key=relation_get('key'))
secret_uuid=CEPH_SECRET_UUID, key=key)
if (config('libvirt-image-backend') == 'rbd' and
assert_libvirt_imagebackend_allowed()):

View File

@ -147,7 +147,7 @@ html5proxy_base_url = {{ spice_proxy_address }}
keymap = {{ console_keymap }}
server_listen = 0.0.0.0
server_proxyclient_address = {{ console_listen_addr }}
{% endif -%}
{% endif %}
[libvirt]
{% if cpu_mode -%}
@ -156,25 +156,22 @@ cpu_mode = {{ cpu_mode }}
{% if cpu_model -%}
cpu_model = {{ cpu_model }}
{% endif -%}
{% if libvirt_images_type -%}
{% if libvirt_images_type and rbd_pool -%}
images_type = {{ libvirt_images_type }}
images_rbd_pool = {{ rbd_pool }}
images_rbd_ceph_conf = {{ libvirt_rbd_images_ceph_conf }}
inject_password=false
inject_key=false
inject_partition=-2
inject_password = false
inject_key = false
inject_partition = -2
{% endif -%}
{% if rbd_pool -%}
rbd_pool = {{ rbd_pool }}
rbd_user = {{ rbd_user }}
rbd_secret_uuid = {{ rbd_secret_uuid }}
{% endif -%}
{% if live_migration_uri -%}
live_migration_uri = {{ live_migration_uri }}
{% endif -%}
{% if disk_cachemodes -%}
disk_cachemodes = {{ disk_cachemodes }}
{% endif -%}
{% endif %}
{% include "parts/section-database" %}