From a531b77267cd19f138efbf0ea3d5619dd7f73677 Mon Sep 17 00:00:00 2001 From: Anthony Young Date: Tue, 20 Sep 2011 09:59:54 -0700 Subject: [PATCH] fixes to glance configuration so that we aren't creating files outside of /opt --- files/glance-api.conf | 2 +- files/glance-registry.conf | 7 +++++-- stack.sh | 16 ++++++++-------- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/files/glance-api.conf b/files/glance-api.conf index ac2ee946b9..a2edde8f53 100644 --- a/files/glance-api.conf +++ b/files/glance-api.conf @@ -24,7 +24,7 @@ registry_port = 9191 # Log to this file. Make sure you do not set the same log # file for both the API and registry servers! -log_file = /var/log/glance/api.log +log_file = %DEST%/glance/api.log # Send logs to syslog (/dev/log) instead of to file specified by `log_file` use_syslog = False diff --git a/files/glance-registry.conf b/files/glance-registry.conf index 20a29cd360..fc209880c2 100644 --- a/files/glance-registry.conf +++ b/files/glance-registry.conf @@ -3,7 +3,7 @@ verbose = True # Show debugging output in logs (sets DEBUG log level output) -debug = False +debug = True # Address to bind the registry server bind_host = 0.0.0.0 @@ -13,7 +13,10 @@ bind_port = 9191 # Log to this file. Make sure you do not set the same log # file for both the API and registry servers! -log_file = /var/log/glance/registry.log +log_file = %DEST%/glance/registry.log + +# Where to store images +filesystem_store_datadir %DEST%/glance/images # Send logs to syslog (/dev/log) instead of to file specified by `log_file` use_syslog = False diff --git a/stack.sh b/stack.sh index 39e026f7c0..d3b1c52dd1 100755 --- a/stack.sh +++ b/stack.sh @@ -267,15 +267,13 @@ fi # ------ if [[ "$ENABLED_SERVICES" =~ "g-reg" ]]; then - # Glance uses ``/var/lib/glance`` and ``/var/log/glance`` by default, so - # we need to insure that our user has permissions to use them. - sudo mkdir -p /var/log/glance - sudo chown -R `whoami` /var/log/glance - sudo mkdir -p /var/lib/glance - sudo chown -R `whoami` /var/lib/glance + GLANCE_IMAGE_DIR= $DEST/glance/images + # Delete existing images + rm -rf $GLANCE_IMAGE_DIR + + # Use local glance directories + mkdir -p $GLANCE_IMAGE_DIR - # Delete existing images/database as glance will recreate the db on startup - rm -rf /var/lib/glance/images/* # (re)create glance database mysql -u$MYSQL_USER -p$MYSQL_PASS -e 'DROP DATABASE glance;' || true mysql -u$MYSQL_USER -p$MYSQL_PASS -e 'CREATE DATABASE glance;' @@ -283,9 +281,11 @@ if [[ "$ENABLED_SERVICES" =~ "g-reg" ]]; then GLANCE_CONF=$GLANCE_DIR/etc/glance-registry.conf cp $FILES/glance-registry.conf $GLANCE_CONF sudo sed -e "s,%SQL_CONN%,$BASE_SQL_CONN/glance,g" -i $GLANCE_CONF + sudo sed -e "s,%DEST%,$DEST,g" -i $GLANCE_CONF GLANCE_API_CONF=$GLANCE_DIR/etc/glance-api.conf cp $FILES/glance-api.conf $GLANCE_API_CONF + sudo sed -e "s,%DEST%,$DEST,g" -i $GLANCE_API_CONF fi # Nova