From 0718568b1203bd11058d3cd28402f84841c01dda Mon Sep 17 00:00:00 2001 From: Thierry Carrez Date: Fri, 13 Dec 2013 15:20:26 +0100 Subject: [PATCH] Support oslo-rootwrap in lib/cinder Make lib/cinder support both cinder-rootwrap (current case) and oslo-rootwrap (future case) to handle the Cinder transition towards oslo-rootwrap usage peacefully. Related blueprint: https://blueprints.launchpad.net/cinder/+spec/cinder-oslo-rootwrap Change-Id: I663986304bd74cb6d72d51c553540fb5f9db1d1d --- lib/cinder | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/cinder b/lib/cinder index ef3bd81a1f..cbe732e9b0 100644 --- a/lib/cinder +++ b/lib/cinder @@ -174,6 +174,12 @@ function configure_cinder() { # Set the paths of certain binaries CINDER_ROOTWRAP=$(get_rootwrap_location cinder) + if [[ ! -x $CINDER_ROOTWRAP ]]; then + CINDER_ROOTWRAP=$(get_rootwrap_location oslo) + if [[ ! -x $CINDER_ROOTWRAP ]]; then + die $LINENO "No suitable rootwrap found." + fi + fi # If Cinder ships the new rootwrap filters files, deploy them # (owned by root) and add a parameter to $CINDER_ROOTWRAP @@ -189,11 +195,16 @@ function configure_cinder() { sudo chown -R root:root $CINDER_CONF_DIR/rootwrap.d sudo chmod 644 $CINDER_CONF_DIR/rootwrap.d/* # Set up rootwrap.conf, pointing to /etc/cinder/rootwrap.d - sudo cp $CINDER_DIR/etc/cinder/rootwrap.conf $CINDER_CONF_DIR/ + if [[ -f $CINDER_DIR/etc/cinder/rootwrap.conf ]]; then + sudo cp $CINDER_DIR/etc/cinder/rootwrap.conf $CINDER_CONF_DIR/ + else + # rootwrap.conf is no longer shipped in Cinder itself + echo "filters_path=" | sudo tee $CINDER_CONF_DIR/rootwrap.conf > /dev/null + fi sudo sed -e "s:^filters_path=.*$:filters_path=$CINDER_CONF_DIR/rootwrap.d:" -i $CINDER_CONF_DIR/rootwrap.conf sudo chown root:root $CINDER_CONF_DIR/rootwrap.conf sudo chmod 0644 $CINDER_CONF_DIR/rootwrap.conf - # Specify rootwrap.conf as first parameter to cinder-rootwrap + # Specify rootwrap.conf as first parameter to rootwrap CINDER_ROOTWRAP="$CINDER_ROOTWRAP $CINDER_CONF_DIR/rootwrap.conf" ROOTWRAP_CINDER_SUDOER_CMD="$CINDER_ROOTWRAP *" fi