From c9f6327844c794789ea3c3905cc8e04523262f71 Mon Sep 17 00:00:00 2001 From: Matt Riedemann Date: Tue, 30 Aug 2016 17:21:30 -0400 Subject: [PATCH] Remove lib/ceph All jobs using ceph as a storage backend have been moved over to using the devstack-plugin-ceph repo in project-config so we should be safe to remove the now unused lib/ceph file. The files are left in place because the devstack plugin does not install xfsprogs but it's used by the create_disk function. And the ceph cinder backend file is left in place since the devstack-plugin-ceph repo uses that by setting CINDER_ENABLED_BACKENDS=${CINDER_ENABLED_BACKENDS:-ceph}. Change-Id: I3fb09fc92bc6ab614e86d701ea46d5741a76b7a8 --- extras.d/60-ceph.sh | 75 --------- functions-common | 2 +- lib/ceph | 381 -------------------------------------------- 3 files changed, 1 insertion(+), 457 deletions(-) delete mode 100644 extras.d/60-ceph.sh delete mode 100644 lib/ceph diff --git a/extras.d/60-ceph.sh b/extras.d/60-ceph.sh deleted file mode 100644 index cc90128176..0000000000 --- a/extras.d/60-ceph.sh +++ /dev/null @@ -1,75 +0,0 @@ -# ceph.sh - DevStack extras script to install Ceph - -if is_service_enabled ceph; then - if [[ "$1" == "source" ]]; then - # Initial source - source $TOP_DIR/lib/ceph - elif [[ "$1" == "stack" && "$2" == "pre-install" ]]; then - echo_summary "Installing Ceph" - check_os_support_ceph - if [ "$REMOTE_CEPH" = "False" ]; then - install_ceph - echo_summary "Configuring Ceph" - configure_ceph - # NOTE (leseb): Do everything here because we need to have Ceph started before the main - # OpenStack components. Ceph OSD must start here otherwise we can't upload any images. - echo_summary "Initializing Ceph" - init_ceph - start_ceph - else - install_ceph_remote - fi - elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then - if is_service_enabled glance; then - echo_summary "Configuring Glance for Ceph" - configure_ceph_glance - fi - if is_service_enabled nova; then - echo_summary "Configuring Nova for Ceph" - configure_ceph_nova - fi - if is_service_enabled cinder; then - echo_summary "Configuring Cinder for Ceph" - configure_ceph_cinder - fi - if is_service_enabled n-cpu; then - # NOTE (leseb): the part below is a requirement to attach Ceph block devices - echo_summary "Configuring libvirt secret" - import_libvirt_secret_ceph - fi - - if [ "$REMOTE_CEPH" = "False" ]; then - if is_service_enabled glance; then - echo_summary "Configuring Glance for Ceph" - configure_ceph_embedded_glance - fi - if is_service_enabled nova; then - echo_summary "Configuring Nova for Ceph" - configure_ceph_embedded_nova - fi - if is_service_enabled cinder; then - echo_summary "Configuring Cinder for Ceph" - configure_ceph_embedded_cinder - fi - fi - fi - - if [[ "$1" == "unstack" ]]; then - if [ "$REMOTE_CEPH" = "True" ]; then - cleanup_ceph_remote - else - cleanup_ceph_embedded - stop_ceph - fi - cleanup_ceph_general - fi - - if [[ "$1" == "clean" ]]; then - if [ "$REMOTE_CEPH" = "True" ]; then - cleanup_ceph_remote - else - cleanup_ceph_embedded - fi - cleanup_ceph_general - fi -fi diff --git a/functions-common b/functions-common index 3fdd71bffc..6312188ea8 100644 --- a/functions-common +++ b/functions-common @@ -1880,7 +1880,7 @@ function run_phase { # white listed elements in tree. We want these to move out # over time as well, but they are in tree, so we need to # manage that. - local exceptions="60-ceph.sh 80-tempest.sh" + local exceptions="80-tempest.sh" local extra extra=$(basename $extra_plugin_file_name) if [[ ! ( $exceptions =~ "$extra" ) ]]; then diff --git a/lib/ceph b/lib/ceph deleted file mode 100644 index 1e55c48d68..0000000000 --- a/lib/ceph +++ /dev/null @@ -1,381 +0,0 @@ -#!/bin/bash -# -# lib/ceph -# Functions to control the configuration and operation of the **Ceph** storage service - -# Dependencies: -# -# - ``functions`` file -# - ``CEPH_DATA_DIR`` or ``DATA_DIR`` must be defined - -# ``stack.sh`` calls the entry points in this order (via ``extras.d/60-ceph.sh``): -# -# - install_ceph -# - configure_ceph -# - init_ceph -# - start_ceph -# - stop_ceph -# - cleanup_ceph - -# Save trace setting -_XTRACE_LIB_CEPH=$(set +o | grep xtrace) -set +o xtrace - - -# Defaults -# -------- - -# Set ``CEPH_DATA_DIR`` to the location of Ceph drives and objects. -# Default is the common DevStack data directory. -CEPH_DATA_DIR=${CEPH_DATA_DIR:-/var/lib/ceph} -CEPH_DISK_IMAGE=${CEPH_DATA_DIR}/drives/images/ceph.img - -# Set ``CEPH_CONF_DIR`` to the location of the configuration files. -# Default is ``/etc/ceph``. -CEPH_CONF_DIR=${CEPH_CONF_DIR:-/etc/ceph} - -# DevStack will create a loop-back disk formatted as XFS to store the -# Ceph data. Set ``CEPH_LOOPBACK_DISK_SIZE`` to the disk size in -# kilobytes. -# Default is 1 gigabyte. -CEPH_LOOPBACK_DISK_SIZE_DEFAULT=4G -CEPH_LOOPBACK_DISK_SIZE=${CEPH_LOOPBACK_DISK_SIZE:-$CEPH_LOOPBACK_DISK_SIZE_DEFAULT} - -# Common -CEPH_FSID=$(uuidgen) -CEPH_CONF_FILE=${CEPH_CONF_DIR}/ceph.conf - -# Glance -GLANCE_CEPH_USER=${GLANCE_CEPH_USER:-glance} -GLANCE_CEPH_POOL=${GLANCE_CEPH_POOL:-images} -GLANCE_CEPH_POOL_PG=${GLANCE_CEPH_POOL_PG:-8} -GLANCE_CEPH_POOL_PGP=${GLANCE_CEPH_POOL_PGP:-8} - -# Nova -NOVA_CEPH_POOL=${NOVA_CEPH_POOL:-vms} -NOVA_CEPH_POOL_PG=${NOVA_CEPH_POOL_PG:-8} -NOVA_CEPH_POOL_PGP=${NOVA_CEPH_POOL_PGP:-8} - -# Cinder -CINDER_CEPH_POOL=${CINDER_CEPH_POOL:-volumes} -CINDER_CEPH_POOL_PG=${CINDER_CEPH_POOL_PG:-8} -CINDER_CEPH_POOL_PGP=${CINDER_CEPH_POOL_PGP:-8} -CINDER_CEPH_USER=${CINDER_CEPH_USER:-cinder} -CINDER_CEPH_UUID=${CINDER_CEPH_UUID:-$(uuidgen)} - -# Set ``CEPH_REPLICAS`` to configure how many replicas are to be -# configured for your Ceph cluster. By default we are configuring -# only one replica since this is way less CPU and memory intensive. If -# you are planning to test Ceph replication feel free to increase this value -CEPH_REPLICAS=${CEPH_REPLICAS:-1} -CEPH_REPLICAS_SEQ=$(seq ${CEPH_REPLICAS}) - -# Connect to an existing Ceph cluster -REMOTE_CEPH=$(trueorfalse False REMOTE_CEPH) -REMOTE_CEPH_ADMIN_KEY_PATH=${REMOTE_CEPH_ADMIN_KEY_PATH:-$CEPH_CONF_DIR/ceph.client.admin.keyring} - -# Cinder encrypted volume tests are not supported with a Ceph backend due to -# bug 1463525. -ATTACH_ENCRYPTED_VOLUME_AVAILABLE=False - - -# Functions -# ------------ - -function get_ceph_version { - local ceph_version_str - ceph_version_str=$(sudo ceph daemon mon.$(hostname) version | cut -d '"' -f 4 | cut -f 1,2 -d '.') - echo $ceph_version_str -} - -# import_libvirt_secret_ceph() - Imports Cinder user key into libvirt -# so it can connect to the Ceph cluster while attaching a Cinder block device -function import_libvirt_secret_ceph { - cat > secret.xml < - ${CINDER_CEPH_UUID} - - client.${CINDER_CEPH_USER} secret - - -EOF - sudo virsh secret-define --file secret.xml - sudo virsh secret-set-value --secret ${CINDER_CEPH_UUID} --base64 $(sudo ceph -c ${CEPH_CONF_FILE} auth get-key client.${CINDER_CEPH_USER}) - 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 - 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 - fi -} - - -# check_os_support_ceph() - Check if the operating system provides a decent version of Ceph -function check_os_support_ceph { - if [[ ! ${DISTRO} =~ (trusty|f23|f24) ]]; then - echo "WARNING: your distro $DISTRO does not provide (at least) the Firefly release. Please use Ubuntu Trusty or Fedora 20 (and higher)" - if [[ "$FORCE_CEPH_INSTALL" != "yes" ]]; then - die $LINENO "If you wish to install Ceph on this distribution anyway run with FORCE_CEPH_INSTALL=yes" - fi - NO_UPDATE_REPOS=False - fi -} - -# cleanup_ceph() - Remove residual data files, anything left over from previous -# 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 - 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 - 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 - 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 - 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 - fi -} - -function cleanup_ceph_embedded { - sudo killall -w -9 ceph-mon - sudo killall -w -9 ceph-osd - sudo rm -rf ${CEPH_DATA_DIR}/*/* - if egrep -q ${CEPH_DATA_DIR} /proc/mounts; then - sudo umount ${CEPH_DATA_DIR} - fi - if [[ -e ${CEPH_DISK_IMAGE} ]]; then - sudo rm -f ${CEPH_DISK_IMAGE} - fi - - # purge ceph config file and keys - sudo rm -rf ${CEPH_CONF_DIR}/* -} - -function cleanup_ceph_general { - undefine_virsh_secret -} - - -# configure_ceph() - Set config files, create data dirs, etc -function configure_ceph { - local count=0 - - # create a backing file disk - create_disk ${CEPH_DISK_IMAGE} ${CEPH_DATA_DIR} ${CEPH_LOOPBACK_DISK_SIZE} - - # populate ceph directory - sudo mkdir -p ${CEPH_DATA_DIR}/{bootstrap-mds,bootstrap-osd,mds,mon,osd,tmp} - - # create ceph monitor initial key and directory - sudo ceph-authtool /var/lib/ceph/tmp/keyring.mon.$(hostname) \ - --create-keyring --name=mon. --add-key=$(ceph-authtool --gen-print-key) \ - --cap mon 'allow *' - sudo mkdir /var/lib/ceph/mon/ceph-$(hostname) - - # create a default ceph configuration file - sudo tee ${CEPH_CONF_FILE} > /dev/null < /dev/null - sudo chown ${STACK_USER}:$(id -g -n $whoami) ${CEPH_CONF_DIR}/ceph.client.${CINDER_CEPH_USER}.keyring - fi -} - -function configure_ceph_embedded_cinder { - # Configure Cinder service options, ceph pool, ceph user and ceph key - sudo ceph -c ${CEPH_CONF_FILE} osd pool set ${CINDER_CEPH_POOL} size ${CEPH_REPLICAS} - if [[ $CEPH_REPLICAS -ne 1 ]]; then - sudo ceph -c ${CEPH_CONF_FILE} osd pool set ${CINDER_CEPH_POOL} crush_ruleset ${RULE_ID} - fi -} - -# configure_ceph_cinder() - Cinder config needs to come after Cinder is set up -function configure_ceph_cinder { - sudo ceph -c ${CEPH_CONF_FILE} osd pool create ${CINDER_CEPH_POOL} ${CINDER_CEPH_POOL_PG} ${CINDER_CEPH_POOL_PGP} - sudo ceph -c ${CEPH_CONF_FILE} auth get-or-create client.${CINDER_CEPH_USER} \ - mon "allow r" \ - osd "allow class-read object_prefix rbd_children, allow rwx pool=${CINDER_CEPH_POOL}, allow rwx pool=${NOVA_CEPH_POOL},allow rwx pool=${GLANCE_CEPH_POOL}" | \ - sudo tee ${CEPH_CONF_DIR}/ceph.client.${CINDER_CEPH_USER}.keyring - sudo chown ${STACK_USER}:$(id -g -n $whoami) ${CEPH_CONF_DIR}/ceph.client.${CINDER_CEPH_USER}.keyring -} - -# init_ceph() - Initialize databases, etc. -function init_ceph { - # clean up from previous (possibly aborted) runs - # make sure to kill all ceph processes first - sudo pkill -f ceph-mon || true - sudo pkill -f ceph-osd || true -} - -# install_ceph() - Collect source and prepare -function install_ceph_remote { - install_package ceph-common -} - -function install_ceph { - install_package ceph -} - -# start_ceph() - Start running processes, including screen -function start_ceph { - if is_ubuntu; then - sudo initctl emit ceph-mon id=$(hostname) - for id in $(sudo ceph -c ${CEPH_CONF_FILE} osd ls); do - sudo start ceph-osd id=${id} - done - else - sudo service ceph start - fi -} - -# stop_ceph() - Stop running processes (non-screen) -function stop_ceph { - if is_ubuntu; then - sudo service ceph-mon-all stop > /dev/null 2>&1 - sudo service ceph-osd-all stop > /dev/null 2>&1 - else - sudo service ceph stop > /dev/null 2>&1 - fi -} - - -# Restore xtrace -$_XTRACE_LIB_CEPH - -## Local variables: -## mode: shell-script -## End: