[hopem] added support for libvirt RBD imagebackend

This commit is contained in:
Edward Hope-Morley 2014-06-02 19:37:32 +01:00
parent 5c74e3c9d1
commit bf7ea55983
4 changed files with 31 additions and 3 deletions

View File

@ -105,3 +105,8 @@ options:
juju-myservice-0
If you're running multiple environments with the same services in them
this allows you to differentiate between them.
libvirt_image_backend:
type: string
description:
Tell Nova which libvirt image backend to use. Supported backends are rbd and lvm.
If no backend is specified, the Nova default is used (probably qcow2).

View File

@ -12,10 +12,16 @@ from charmhelpers.core.hookenv import (
related_units,
service_name,
unit_get,
WARNING,
ERROR,
)
from charmhelpers.contrib.openstack.utils import get_host_ip, os_release
from charmhelpers.contrib.openstack.utils import (
get_host_ip,
os_release,
get_os_version_package,
get_os_version_codename
)
from charmhelpers.contrib.network.ovs import add_bridge
@ -128,6 +134,16 @@ class NovaComputeCephContext(context.CephContext):
ctxt['rbd_secret_uuid'] = CEPH_SECRET_UUID
ctxt['rbd_pool'] = 'nova'
if config('libvirt_image_backend') == 'rbd':
os_ver = get_os_version_package('ceph-common')
if float(os_ver) >= float(get_os_version_codename('havana')):
ctxt['libvirt_images_type'] = 'rbd'
else:
log("RBD imagebackend only supported in openstack >= Havana "
"- ignoring", level=WARNING)
elif config('libvirt_image_backend') == 'lvm':
ctxt['libvirt_images_type'] = 'lvm'
return ctxt

View File

@ -1 +1 @@
132
133

View File

@ -35,11 +35,18 @@ glance_api_servers = {{ glance_api_servers }}
{% endif -%}
{% if rbd_pool -%}
rbd_pool = {{ rbd_pool }}
libvirt_images_rbd_pool = {{ rbd_pool }}
rbd_user = {{ rbd_user }}
rbd_secret_uuid = {{ rbd_secret_uuid }}
{% endif -%}
{% if libvirt_image_backend -%}
libvirt_images_type = {{ libvirt_images_type }}
libvirt_inject_password=false
libvirt_inject_key=false
libvirt_inject_partition=-2
{% endif -%}
{% if neutron_plugin and neutron_plugin == 'ovs' -%}
libvirt_vif_driver = nova.virt.libvirt.vif.LibvirtGenericVIFDriver
{% if neutron_security_groups -%}