Browse code

Cleanup cinder-rootwrap support

cinder_rootwrap support in devstack handled a number of now-abandoned
use cases:

- no $CINDER_DIR/etc/cinder/rootwrap.d (old-style rootwrap)
- using oslo-rootwrap instead of cinder-rootwrap (abandoned experiment)

This change removes unused code paths and aligns
configure_cinder_rootwrap() with configure_nova_rootwrap().

Change-Id: I387808dae0e064cc9c894c74ab78e86124f08dd2

Thierry Carrez authored on 2014/02/07 00:00:08
Showing 1 changed files
... ...
@@ -170,43 +170,28 @@ function cleanup_cinder() {
170 170
 function configure_cinder_rootwrap() {
171 171
     # Set the paths of certain binaries
172 172
     CINDER_ROOTWRAP=$(get_rootwrap_location cinder)
173
-    if [[ ! -x $CINDER_ROOTWRAP ]]; then
174
-        CINDER_ROOTWRAP=$(get_rootwrap_location oslo)
175
-        if [[ ! -x $CINDER_ROOTWRAP ]]; then
176
-            die $LINENO "No suitable rootwrap found."
177
-        fi
178
-    fi
179 173
 
180
-    # If Cinder ships the new rootwrap filters files, deploy them
181
-    # (owned by root) and add a parameter to $CINDER_ROOTWRAP
182
-    ROOTWRAP_CINDER_SUDOER_CMD="$CINDER_ROOTWRAP"
183
-    if [[ -d $CINDER_DIR/etc/cinder/rootwrap.d ]]; then
184
-        # Wipe any existing rootwrap.d files first
185
-        if [[ -d $CINDER_CONF_DIR/rootwrap.d ]]; then
186
-            sudo rm -rf $CINDER_CONF_DIR/rootwrap.d
187
-        fi
188
-        # Deploy filters to /etc/cinder/rootwrap.d
189
-        sudo mkdir -m 755 $CINDER_CONF_DIR/rootwrap.d
190
-        sudo cp $CINDER_DIR/etc/cinder/rootwrap.d/*.filters $CINDER_CONF_DIR/rootwrap.d
191
-        sudo chown -R root:root $CINDER_CONF_DIR/rootwrap.d
192
-        sudo chmod 644 $CINDER_CONF_DIR/rootwrap.d/*
193
-        # Set up rootwrap.conf, pointing to /etc/cinder/rootwrap.d
194
-        if [[ -f $CINDER_DIR/etc/cinder/rootwrap.conf ]]; then
195
-            sudo cp $CINDER_DIR/etc/cinder/rootwrap.conf $CINDER_CONF_DIR/
196
-        else
197
-            # rootwrap.conf is no longer shipped in Cinder itself
198
-            echo "filters_path=" | sudo tee $CINDER_CONF_DIR/rootwrap.conf > /dev/null
199
-        fi
200
-        sudo sed -e "s:^filters_path=.*$:filters_path=$CINDER_CONF_DIR/rootwrap.d:" -i $CINDER_CONF_DIR/rootwrap.conf
201
-        sudo chown root:root $CINDER_CONF_DIR/rootwrap.conf
202
-        sudo chmod 0644 $CINDER_CONF_DIR/rootwrap.conf
203
-        # Specify rootwrap.conf as first parameter to rootwrap
204
-        CINDER_ROOTWRAP="$CINDER_ROOTWRAP $CINDER_CONF_DIR/rootwrap.conf"
205
-        ROOTWRAP_CINDER_SUDOER_CMD="$CINDER_ROOTWRAP *"
174
+    # Deploy new rootwrap filters files (owned by root).
175
+    # Wipe any existing rootwrap.d files first
176
+    if [[ -d $CINDER_CONF_DIR/rootwrap.d ]]; then
177
+        sudo rm -rf $CINDER_CONF_DIR/rootwrap.d
206 178
     fi
207
-
179
+    # Deploy filters to /etc/cinder/rootwrap.d
180
+    sudo mkdir -m 755 $CINDER_CONF_DIR/rootwrap.d
181
+    sudo cp $CINDER_DIR/etc/cinder/rootwrap.d/*.filters $CINDER_CONF_DIR/rootwrap.d
182
+    sudo chown -R root:root $CINDER_CONF_DIR/rootwrap.d
183
+    sudo chmod 644 $CINDER_CONF_DIR/rootwrap.d/*
184
+    # Set up rootwrap.conf, pointing to /etc/cinder/rootwrap.d
185
+    sudo cp $CINDER_DIR/etc/cinder/rootwrap.conf $CINDER_CONF_DIR/
186
+    sudo sed -e "s:^filters_path=.*$:filters_path=$CINDER_CONF_DIR/rootwrap.d:" -i $CINDER_CONF_DIR/rootwrap.conf
187
+    sudo chown root:root $CINDER_CONF_DIR/rootwrap.conf
188
+    sudo chmod 0644 $CINDER_CONF_DIR/rootwrap.conf
189
+    # Specify rootwrap.conf as first parameter to rootwrap
190
+    ROOTWRAP_CSUDOER_CMD="$CINDER_ROOTWRAP $CINDER_CONF_DIR/rootwrap.conf *"
191
+
192
+    # Set up the rootwrap sudoers for cinder
208 193
     TEMPFILE=`mktemp`
209
-    echo "$STACK_USER ALL=(root) NOPASSWD: $ROOTWRAP_CINDER_SUDOER_CMD" >$TEMPFILE
194
+    echo "$STACK_USER ALL=(root) NOPASSWD: $ROOTWRAP_CSUDOER_CMD" >$TEMPFILE
210 195
     chmod 0440 $TEMPFILE
211 196
     sudo chown root:root $TEMPFILE
212 197
     sudo mv $TEMPFILE /etc/sudoers.d/cinder-rootwrap