[hopem,r=gnuoy]
Ensure libvirt image backend pool is configured if RBDImageBackend enabled post-deploy. Closes-Bug: 1489463
This commit is contained in:
commit
1bea39d454
@ -8,6 +8,7 @@ from charmhelpers.core.hookenv import (
|
|||||||
log,
|
log,
|
||||||
ERROR,
|
ERROR,
|
||||||
relation_ids,
|
relation_ids,
|
||||||
|
related_units,
|
||||||
relation_get,
|
relation_get,
|
||||||
relation_set,
|
relation_set,
|
||||||
service_name,
|
service_name,
|
||||||
@ -161,6 +162,12 @@ def config_changed():
|
|||||||
if config('hugepages'):
|
if config('hugepages'):
|
||||||
install_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()
|
CONFIGS.write_all()
|
||||||
|
|
||||||
|
|
||||||
@ -291,7 +298,7 @@ def get_ceph_request():
|
|||||||
|
|
||||||
@hooks.hook('ceph-relation-changed')
|
@hooks.hook('ceph-relation-changed')
|
||||||
@restart_on_change(restart_map())
|
@restart_on_change(restart_map())
|
||||||
def ceph_changed():
|
def ceph_changed(rid=None, unit=None):
|
||||||
if 'ceph' not in CONFIGS.complete_contexts():
|
if 'ceph' not in CONFIGS.complete_contexts():
|
||||||
log('ceph relation incomplete. Peer not ready?')
|
log('ceph relation incomplete. Peer not ready?')
|
||||||
return
|
return
|
||||||
@ -307,10 +314,10 @@ def ceph_changed():
|
|||||||
|
|
||||||
# With some refactoring, this can move into NovaComputeCephContext
|
# With some refactoring, this can move into NovaComputeCephContext
|
||||||
# and allow easily extended to support other compute flavors.
|
# 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,
|
create_libvirt_secret(secret_file=CEPH_SECRET,
|
||||||
secret_uuid=CEPH_SECRET_UUID,
|
secret_uuid=CEPH_SECRET_UUID, key=key)
|
||||||
key=relation_get('key'))
|
|
||||||
|
|
||||||
if (config('libvirt-image-backend') == 'rbd' and
|
if (config('libvirt-image-backend') == 'rbd' and
|
||||||
assert_libvirt_imagebackend_allowed()):
|
assert_libvirt_imagebackend_allowed()):
|
||||||
|
@ -147,7 +147,7 @@ html5proxy_base_url = {{ spice_proxy_address }}
|
|||||||
keymap = {{ console_keymap }}
|
keymap = {{ console_keymap }}
|
||||||
server_listen = 0.0.0.0
|
server_listen = 0.0.0.0
|
||||||
server_proxyclient_address = {{ console_listen_addr }}
|
server_proxyclient_address = {{ console_listen_addr }}
|
||||||
{% endif -%}
|
{% endif %}
|
||||||
|
|
||||||
[libvirt]
|
[libvirt]
|
||||||
{% if cpu_mode -%}
|
{% if cpu_mode -%}
|
||||||
@ -156,25 +156,22 @@ cpu_mode = {{ cpu_mode }}
|
|||||||
{% if cpu_model -%}
|
{% if cpu_model -%}
|
||||||
cpu_model = {{ cpu_model }}
|
cpu_model = {{ cpu_model }}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if libvirt_images_type -%}
|
{% if libvirt_images_type and rbd_pool -%}
|
||||||
images_type = {{ libvirt_images_type }}
|
images_type = {{ libvirt_images_type }}
|
||||||
images_rbd_pool = {{ rbd_pool }}
|
images_rbd_pool = {{ rbd_pool }}
|
||||||
images_rbd_ceph_conf = {{ libvirt_rbd_images_ceph_conf }}
|
images_rbd_ceph_conf = {{ libvirt_rbd_images_ceph_conf }}
|
||||||
inject_password=false
|
inject_password = false
|
||||||
inject_key=false
|
inject_key = false
|
||||||
inject_partition=-2
|
inject_partition = -2
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if rbd_pool -%}
|
|
||||||
rbd_pool = {{ rbd_pool }}
|
|
||||||
rbd_user = {{ rbd_user }}
|
rbd_user = {{ rbd_user }}
|
||||||
rbd_secret_uuid = {{ rbd_secret_uuid }}
|
rbd_secret_uuid = {{ rbd_secret_uuid }}
|
||||||
{% endif -%}
|
|
||||||
{% if live_migration_uri -%}
|
{% if live_migration_uri -%}
|
||||||
live_migration_uri = {{ live_migration_uri }}
|
live_migration_uri = {{ live_migration_uri }}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
{% if disk_cachemodes -%}
|
{% if disk_cachemodes -%}
|
||||||
disk_cachemodes = {{ disk_cachemodes }}
|
disk_cachemodes = {{ disk_cachemodes }}
|
||||||
{% endif -%}
|
{% endif %}
|
||||||
|
|
||||||
{% include "parts/section-database" %}
|
{% include "parts/section-database" %}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user