Address feedback from glance-remote patch

This cleans up some of the quote and variable handling that was
pointed out in review of the previous patch. This is non-critical,
so I'm putting it in a subsequent patch to avoid disturbing the
careful alignment of patches across three projects that are mostly
approved.

Change-Id: I9b281efd74ba5cd78f97b84e5704b41fd040e481
This commit is contained in:
Dan Smith 2021-03-09 08:05:37 -08:00
parent 802259a496
commit 61b4fbf143
2 changed files with 23 additions and 20 deletions

View File

@ -130,8 +130,9 @@ function is_glance_enabled {
# cleanup_glance() - Remove residual data files, anything left over from previous
# runs that a clean run would need to clean up
function cleanup_glance {
# delete image files (glance)
sudo rm -rf $GLANCE_CACHE_DIR $GLANCE_IMAGE_DIR $(glance_remote_conf '')
# delete image files (glance) and all of the glance-remote temporary
# storage
sudo rm -rf $GLANCE_CACHE_DIR $GLANCE_IMAGE_DIR "${DATA_DIR}/glance-remote"
# Cleanup multiple stores directories
if [[ "$GLANCE_ENABLE_MULTIPLE_STORES" == "True" ]]; then
@ -468,39 +469,41 @@ function install_glance {
# glance_remote_conf() - Return the path to an alternate config file for
# the remote glance clone
function glance_remote_conf {
echo "$(dirname ${GLANCE_CONF_DIR})/glance-remote/"$(basename "$1")
echo $(dirname "${GLANCE_CONF_DIR}")/glance-remote/$(basename "$1")
}
# start_glance_remote_clone() - Clone the regular glance api worker
function start_glance_remote_clone {
local glance_remote_conf glance_remote_port
local glance_remote_conf_dir glance_remote_port remote_data
local glance_remote_uwsgi
glance_remote_conf_dir=$(glance_remote_conf '')
glance_remote_conf_dir="$(glance_remote_conf "")"
glance_remote_port=$(get_random_port)
glance_remote_uwsgi="$(glance_remote_conf $GLANCE_UWSGI_CONF)"
# Clone the existing ready-to-go glance-api setup
sudo rm -Rf $glance_remote_conf_dir
sudo cp -r "$GLANCE_CONF_DIR" $glance_remote_conf_dir
sudo chown $STACK_USER -R $glance_remote_conf_dir
sudo rm -Rf "$glance_remote_conf_dir"
sudo cp -r "$GLANCE_CONF_DIR" "$glance_remote_conf_dir"
sudo chown $STACK_USER -R "$glance_remote_conf_dir"
# Point this worker at different data dirs
remote_data="${DATA_DIR}/glance-remote"
mkdir -p $remote_data/os_glance_tasks_store \
$remote_data/os_glance_staging_store
iniset $(glance_remote_conf 'glance-api.conf') os_glance_staging_store \
filesystem_store_datadir ${remote_data}/os_glance_staging_store
iniset $(glance_remote_conf 'glance-api.conf') os_glance_tasks_store \
filesystem_store_datadir ${remote_data}/os_glance_tasks_store
"${remote_data}/os_glance_staging_store"
iniset $(glance_remote_conf "$GLANCE_API_CONF") os_glance_staging_store \
filesystem_store_datadir "${remote_data}/os_glance_staging_store"
iniset $(glance_remote_conf "$GLANCE_API_CONF") os_glance_tasks_store \
filesystem_store_datadir "${remote_data}/os_glance_tasks_store"
# Change our uwsgi to our new port
sed -ri "s/^(http-socket.*):[0-9]+/\1:$glance_remote_port/" \
$(glance_remote_conf $GLANCE_UWSGI_CONF)
"$glance_remote_uwsgi"
# Update the self-reference url with our new port
iniset $(glance_remote_conf $GLANCE_API_CONF) DEFAULT \
worker_self_reference_url \
$(awk '-F= ' '/^http-socket/ { print "http://"$2 }' \
$(glance_remote_conf $GLANCE_UWSGI_CONF))
"$glance_remote_uwsgi")
# We need to create the systemd service for the clone, but then
# change it to include an Environment line to point the WSGI app
@ -508,10 +511,11 @@ function start_glance_remote_clone {
write_uwsgi_user_unit_file devstack@g-api-r.service "$(which uwsgi) \
--procname-prefix \
glance-api-remote \
--ini $(glance_remote_conf $GLANCE_UWSGI_CONF)" \
--ini $glance_remote_uwsgi" \
"" "$STACK_USER"
iniset -sudo ${SYSTEMD_DIR}/devstack@g-api-r.service \
"Service" "Environment" "OS_GLANCE_CONFIG_DIR=$glance_remote_conf_dir"
"Service" "Environment" \
"OS_GLANCE_CONFIG_DIR=$glance_remote_conf_dir"
# Reload and restart with the new config
$SYSTEMCTL daemon-reload
@ -520,7 +524,7 @@ function start_glance_remote_clone {
get_or_create_service glance_remote image_remote "Alternate glance"
get_or_create_endpoint image_remote $REGION_NAME \
$(awk '-F= ' '/^http-socket/ { print "http://"$2 }' \
$(glance_remote_conf $GLANCE_UWSGI_CONF))
$glance_remote_uwsgi)
}
# start_glance() - Start running processes

View File

@ -353,8 +353,7 @@ function configure_tempest {
iniset $TEMPEST_CONFIG image-feature-enabled import_image $GLANCE_USE_IMPORT_WORKFLOW
iniset $TEMPEST_CONFIG image-feature-enabled os_glance_reserved True
if is_service_enabled g-api-r; then
iniset $TEMPEST_CONFIG image alternate_image_endpoint \
"image_remote"
iniset $TEMPEST_CONFIG image alternate_image_endpoint image_remote
fi
# Compute