Allow storage backend to be configurable
Add configurables so that one need not have Ceph be the storage backend for Cinder, Cinder-backup, Glance and Nova. Let Ceph be the default storage backend for Cinder, Cinder backup, Glance, and Nova. Allow the default setting to be overriden when the global config, ENABLE_CEPH_{CINDER,C_BAK,GLANCE,NOVA} is set to False in the local.conf/localrc file. Closes Bug: #1521278 Change-Id: I3afe7c57d5d56f15fe533ad5b1dbe36ccd369e6b
This commit is contained in:
parent
6c8db15670
commit
dacdc8df02
11
README.md
11
README.md
@ -25,8 +25,19 @@ This plugin also gets used to configure Ceph as the storage backend for the upst
|
||||
|
||||
```enable_plugin devstack-plugin-ceph git://git.openstack.org/openstack/devstack-plugin-ceph```
|
||||
|
||||
_Note: Ceph can be disabled as the storage backend for a service with the
|
||||
following setting in the ```localrc``` file,_
|
||||
|
||||
```
|
||||
ENABLE_CEPH_$SERVICE=False
|
||||
```
|
||||
|
||||
_where $SERVICE can be CINDER, C_BAK, GLANCE, or NOVA corresponding to
|
||||
Cinder, Cinder Backup, Glance, and Nova services respectively._
|
||||
|
||||
* Then run ```stack.sh``` and wait for the _magic_ to happen :)
|
||||
|
||||
|
||||
# TODOs
|
||||
|
||||
* Configuring Rados Gateway with Keystone for Swift
|
||||
|
@ -90,6 +90,24 @@ ATTACH_ENCRYPTED_VOLUME_AVAILABLE=False
|
||||
# Functions
|
||||
# ------------
|
||||
|
||||
# is_ceph_enabled_for_service() - checks whether the OpenStack service
|
||||
# specified as an argument is enabled with Ceph as its storage backend.
|
||||
function is_ceph_enabled_for_service {
|
||||
local config config_name enabled service
|
||||
enabled=1
|
||||
service=$1
|
||||
# Construct the global variable ENABLE_CEPH_.* corresponding to a
|
||||
# $service.
|
||||
config_name=ENABLE_CEPH_$(echo $service | \
|
||||
tr '[:lower:]' '[:upper:]' | tr '-' '_')
|
||||
config=$(eval echo "\$$config_name")
|
||||
|
||||
if (is_service_enabled $service) && [[ $config == 'True' ]]; then
|
||||
enabled=0
|
||||
fi
|
||||
return $enabled
|
||||
}
|
||||
|
||||
function get_ceph_version {
|
||||
local ceph_version_str
|
||||
ceph_version_str=$(sudo ceph daemon mon.$(hostname) version\
|
||||
@ -119,7 +137,8 @@ sudo rm -f secret.xml
|
||||
|
||||
# undefine_virsh_secret() - Undefine Cinder key secret from libvirt
|
||||
function undefine_virsh_secret {
|
||||
if is_service_enabled cinder || is_service_enabled nova; then
|
||||
if is_ceph_enabled_for_service cinder || \
|
||||
is_ceph_enabled_for_service nova; then
|
||||
local virsh_uuid
|
||||
virsh_uuid=$(sudo virsh secret-list | awk '/^ ?[0-9a-z]/ { print $1 }')
|
||||
sudo virsh secret-undefine ${virsh_uuid} >/dev/null 2>&1
|
||||
@ -145,25 +164,25 @@ fi
|
||||
# runs that a clean run would need to clean up
|
||||
function cleanup_ceph_remote {
|
||||
# do a proper cleanup from here to avoid leftover on the remote Ceph cluster
|
||||
if is_service_enabled glance; then
|
||||
if is_ceph_enabled_for_service glance; then
|
||||
sudo ceph osd pool delete $GLANCE_CEPH_POOL $GLANCE_CEPH_POOL \
|
||||
--yes-i-really-really-mean-it > /dev/null 2>&1
|
||||
|
||||
sudo ceph auth del client.$GLANCE_CEPH_USER > /dev/null 2>&1
|
||||
fi
|
||||
if is_service_enabled cinder; then
|
||||
if is_ceph_enabled_for_service cinder; then
|
||||
sudo ceph osd pool delete $CINDER_CEPH_POOL $CINDER_CEPH_POOL \
|
||||
--yes-i-really-really-mean-it > /dev/null 2>&1
|
||||
|
||||
sudo ceph auth del client.$CINDER_CEPH_USER > /dev/null 2>&1
|
||||
fi
|
||||
if is_service_enabled c-bak; then
|
||||
if is_ceph_enabled_for_service c-bak; then
|
||||
sudo ceph osd pool delete $CINDER_BAK_CEPH_POOL $CINDER_BAK_CEPH_POOL \
|
||||
--yes-i-really-really-mean-it > /dev/null 2>&1
|
||||
|
||||
sudo ceph auth del client.$CINDER_BAK_CEPH_USER > /dev/null 2>&1
|
||||
fi
|
||||
if is_service_enabled nova; then
|
||||
if is_ceph_enabled_for_service nova; then
|
||||
iniset $NOVA_CONF libvirt rbd_secret_uuid ""
|
||||
sudo ceph osd pool delete $NOVA_CEPH_POOL $NOVA_CEPH_POOL \
|
||||
--yes-i-really-really-mean-it > /dev/null 2>&1
|
||||
@ -431,7 +450,7 @@ iniset $NOVA_CONF libvirt images_type rbd
|
||||
iniset $NOVA_CONF libvirt images_rbd_pool ${NOVA_CEPH_POOL}
|
||||
iniset $NOVA_CONF libvirt images_rbd_ceph_conf ${CEPH_CONF_FILE}
|
||||
|
||||
if ! is_service_enabled cinder; then
|
||||
if ! is_ceph_enabled_for_service cinder; then
|
||||
sudo ceph -c ${CEPH_CONF_FILE} \
|
||||
auth get-or-create client.${CINDER_CEPH_USER} \
|
||||
mon "allow r" \
|
||||
|
@ -1,4 +1,11 @@
|
||||
# Plug-in overrides
|
||||
|
||||
CINDER_DRIVER=ceph
|
||||
CINDER_ENABLED_BACKENDS=ceph
|
||||
ENABLE_CEPH_CINDER=$(trueorfalse True ENABLE_CEPH_CINDER)
|
||||
ENABLE_CEPH_C_BAK=$(trueorfalse True ENABLE_CEPH_C_BAK)
|
||||
ENABLE_CEPH_GLANCE=$(trueorfalse True ENABLE_CEPH_GLANCE)
|
||||
ENABLE_CEPH_NOVA=$(trueorfalse True ENABLE_CEPH_NOVA)
|
||||
|
||||
if [[ $ENABLE_CEPH_CINDER == "True" ]]; then
|
||||
CINDER_DRIVER=ceph
|
||||
CINDER_ENABLED_BACKENDS=ceph
|
||||
fi
|
||||
|
@ -21,19 +21,20 @@ elif [[ "$1" == "stack" && "$2" == "pre-install" ]]; then
|
||||
install_ceph_remote
|
||||
fi
|
||||
elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
|
||||
if is_service_enabled glance; then
|
||||
if is_ceph_enabled_for_service glance; then
|
||||
echo_summary "Configuring Glance for Ceph"
|
||||
configure_ceph_glance
|
||||
fi
|
||||
if is_service_enabled nova; then
|
||||
if is_ceph_enabled_for_service nova; then
|
||||
echo_summary "Configuring Nova for Ceph"
|
||||
configure_ceph_nova
|
||||
fi
|
||||
if is_service_enabled cinder; then
|
||||
if is_ceph_enabled_for_service cinder; then
|
||||
echo_summary "Configuring Cinder for Ceph"
|
||||
configure_ceph_cinder
|
||||
fi
|
||||
if is_service_enabled cinder || is_service_enabled nova; then
|
||||
if is_ceph_enabled_for_service cinder || \
|
||||
is_ceph_enabled_for_service nova; then
|
||||
# NOTE (leseb): the part below is a requirement
|
||||
# to attach Ceph block devices
|
||||
echo_summary "Configuring libvirt secret"
|
||||
@ -41,15 +42,15 @@ elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
|
||||
fi
|
||||
|
||||
if [ "$REMOTE_CEPH" = "False" ]; then
|
||||
if is_service_enabled glance; then
|
||||
if is_ceph_enabled_for_service glance; then
|
||||
echo_summary "Configuring Glance for Ceph"
|
||||
configure_ceph_embedded_glance
|
||||
fi
|
||||
if is_service_enabled nova; then
|
||||
if is_ceph_enabled_for_service nova; then
|
||||
echo_summary "Configuring Nova for Ceph"
|
||||
configure_ceph_embedded_nova
|
||||
fi
|
||||
if is_service_enabled cinder; then
|
||||
if is_ceph_enabled_for_service cinder; then
|
||||
echo_summary "Configuring Cinder for Ceph"
|
||||
configure_ceph_embedded_cinder
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user