grenade/from-grizzly/upgrade-cinder
Sean Dague c6a3491452 do xtrace in include scripts correctly
the included upgrade scripts were turning off xtrace, not
restoring it like we should have been doing. This makes debugging
many of the upgrade issues very difficult.

fix this with the standard xtrace restore.

Change-Id: I922d139b83644a2584c46fecb51b346b05feeec8
2014-01-16 16:23:06 -05:00

47 lines
2.0 KiB
Bash
Executable File

#!/usr/bin/env bash
# ``upgrade-cinder``
function configure_cinder_upgrade(){
# Print the commands being run so that we can see the command that triggers
# an error. It is also useful for following allowing as the install occurs.
XTRACE=$(set +o | grep xtrace)
set -o xtrace
CINDER_POLICY_JSON=$CINDER_CONF_DIR/policy.json
# add rules needed for live volume migration
policy_add ${CINDER_POLICY_JSON} 'volume_extension:volume_admin_actions:migrate_volume_completion' '[["rule:admin_api"]]'
policy_add ${CINDER_POLICY_JSON} 'volume_extension:volume_mig_status_attribute' '[["rule:admin_api"]]'
source $TARGET_DEVSTACK_DIR/openrc admin admin
if [[ "$ENABLED_SERVICES" =~ "c-api" && "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then
CINDER_V2_SERVICE=$(keystone service-create \
--name=cinder \
--type=volumev2 \
--description="Cinder Volume Service V2" \
| grep " id " | get_field 2)
keystone endpoint-create \
--region RegionOne \
--service_id $CINDER_V2_SERVICE \
--publicurl "$CINDER_SERVICE_PROTOCOL://$CINDER_SERVICE_HOST:$CINDER_SERVICE_PORT/v2/\$(tenant_id)s" \
--adminurl "$CINDER_SERVICE_PROTOCOL://$CINDER_SERVICE_HOST:$CINDER_SERVICE_PORT/v2/\$(tenant_id)s" \
--internalurl "$CINDER_SERVICE_PROTOCOL://$CINDER_SERVICE_HOST:$CINDER_SERVICE_PORT/v2/\$(tenant_id)s"
fi
if [[ "$KEYSTONE_CATALOG_BACKEND" != 'sql' && -f "$KEYSTONE_CATALOG" ]]; then
stop_keystone
echo -e "
catalog.RegionOne.volumev2.publicURL = http://%SERVICE_HOST%:8776/v2/$(tenant_id)s
catalog.RegionOne.volumev2.adminURL = http://%SERVICE_HOST%:8776/v2/$(tenant_id)s
catalog.RegionOne.volumev2.internalURL = http://%SERVICE_HOST%:8776/v2/$(tenant_id)s
catalog.RegionOne.volumev2.name = Volume Service V2
" >> $KEYSTONE_CATALOG
start_keystone
fi
# reset to previous state
$XTRACE
}