Merge "Run glance-manage db_sync."
diff --git a/files/swift/account-server.conf b/files/swift/account-server.conf
deleted file mode 100644
index 763c306..0000000
--- a/files/swift/account-server.conf
+++ /dev/null
@@ -1,20 +0,0 @@
-[DEFAULT]
-devices = %NODE_PATH%/node
-mount_check = false
-bind_port = %BIND_PORT%
-user = %USER%
-log_facility = LOG_LOCAL%LOG_FACILITY%
-swift_dir = %SWIFT_CONFIG_DIR%
-
-[pipeline:main]
-pipeline = account-server
-
-[app:account-server]
-use = egg:swift#account
-
-[account-replicator]
-vm_test_mode = yes
-
-[account-auditor]
-
-[account-reaper]
diff --git a/files/swift/container-server.conf b/files/swift/container-server.conf
deleted file mode 100644
index 106dcab..0000000
--- a/files/swift/container-server.conf
+++ /dev/null
@@ -1,22 +0,0 @@
-[DEFAULT]
-devices = %NODE_PATH%/node
-mount_check = false
-bind_port = %BIND_PORT%
-user = %USER%
-log_facility = LOG_LOCAL%LOG_FACILITY%
-swift_dir = %SWIFT_CONFIG_DIR%
-
-[pipeline:main]
-pipeline = container-server
-
-[app:container-server]
-use = egg:swift#container
-
-[container-replicator]
-vm_test_mode = yes
-
-[container-updater]
-
-[container-auditor]
-
-[container-sync]
diff --git a/files/swift/object-server.conf b/files/swift/object-server.conf
deleted file mode 100644
index 7eea67d..0000000
--- a/files/swift/object-server.conf
+++ /dev/null
@@ -1,22 +0,0 @@
-[DEFAULT]
-devices = %NODE_PATH%/node
-mount_check = false
-bind_port = %BIND_PORT%
-user = %USER%
-log_facility = LOG_LOCAL%LOG_FACILITY%
-swift_dir = %SWIFT_CONFIG_DIR%
-
-[pipeline:main]
-pipeline = object-server
-
-[app:object-server]
-use = egg:swift#object
-
-[object-replicator]
-vm_test_mode = yes
-
-[object-updater]
-
-[object-auditor]
-
-[object-expirer]
diff --git a/files/swift/proxy-server.conf b/files/swift/proxy-server.conf
deleted file mode 100644
index 84bf9cd..0000000
--- a/files/swift/proxy-server.conf
+++ /dev/null
@@ -1,57 +0,0 @@
-[DEFAULT]
-bind_port = 8080
-user = %USER%
-swift_dir = %SWIFT_CONFIG_DIR%
-workers = 1
-log_name = swift
-log_facility = LOG_LOCAL1
-log_level = DEBUG
-
-[pipeline:main]
-pipeline = healthcheck cache swift3 %AUTH_SERVER% proxy-server
-
-[app:proxy-server]
-use = egg:swift#proxy
-allow_account_management = true
-account_autocreate = true
-
-[filter:keystone]
-paste.filter_factory = keystone.middleware.swift_auth:filter_factory
-operator_roles = Member,admin
-
-# NOTE(chmou): s3token middleware is not updated yet to use only
-# username and password.
-[filter:s3token]
-paste.filter_factory = keystone.middleware.s3_token:filter_factory
-auth_port = %KEYSTONE_AUTH_PORT%
-auth_host = %KEYSTONE_AUTH_HOST%
-auth_protocol = %KEYSTONE_AUTH_PROTOCOL%
-auth_token = %SERVICE_TOKEN%
-admin_token = %SERVICE_TOKEN%
-
-[filter:authtoken]
-paste.filter_factory = keystone.middleware.auth_token:filter_factory
-auth_host = %KEYSTONE_AUTH_HOST%
-auth_port = %KEYSTONE_AUTH_PORT%
-auth_protocol = %KEYSTONE_AUTH_PROTOCOL%
-auth_uri = %KEYSTONE_SERVICE_PROTOCOL%://%KEYSTONE_SERVICE_HOST%:%KEYSTONE_SERVICE_PORT%/
-admin_tenant_name = %SERVICE_TENANT_NAME%
-admin_user = %SERVICE_USERNAME%
-admin_password = %SERVICE_PASSWORD%
-
-[filter:swift3]
-use = egg:swift3#middleware
-
-[filter:tempauth]
-use = egg:swift#tempauth
-user_admin_admin = admin .admin .reseller_admin
-user_test_tester = testing .admin
-user_test2_tester2 = testing2 .admin
-user_test_tester3 = testing3
-bind_ip = 0.0.0.0
-
-[filter:healthcheck]
-use = egg:swift#healthcheck
-
-[filter:cache]
-use = egg:swift#memcache
diff --git a/files/swift/swift.conf b/files/swift/swift.conf
deleted file mode 100644
index 98df466..0000000
--- a/files/swift/swift.conf
+++ /dev/null
@@ -1,3 +0,0 @@
-[swift-hash]
-# random unique string that can never change (DO NOT LOSE)
-swift_hash_path_suffix = %SWIFT_HASH%
diff --git a/functions b/functions
index 7072fdd..32427a4 100644
--- a/functions
+++ b/functions
@@ -184,7 +184,7 @@
# Comment an option in an INI file
-# iniset config-file section option
+# inicomment config-file section option
function inicomment() {
local file=$1
local section=$2
@@ -192,6 +192,15 @@
sed -i -e "/^\[$section\]/,/^\[.*\]/ s|^\($option[ \t]*=.*$\)|#\1|" $file
}
+# Uncomment an option in an INI file
+# iniuncomment config-file section option
+function iniuncomment() {
+ local file=$1
+ local section=$2
+ local option=$3
+ sed -i -e "/^\[$section\]/,/^\[.*\]/ s|[^ \t]*#[ \t]*\($option[ \t]*=.*$\)|\1|" $file
+}
+
# Get an option from an INI file
# iniget config-file section option
@@ -309,6 +318,23 @@
}
+# pip install the dependencies of the package before we do the setup.py
+# develop, so that pip and not distutils process the dependency chain
+# setup_develop directory
+function setup_develop() {
+ (cd $1; \
+ python setup.py egg_info; \
+ raw_links=$(awk '/^.+/ {print "-f " $1}' *.egg-info/dependency_links.txt); \
+ depend_links=$(echo $raw_links | xargs); \
+ pip_install -r *-info/requires.txt $depend_links; \
+ sudo \
+ HTTP_PROXY=$http_proxy \
+ HTTPS_PROXY=$https_proxy \
+ python setup.py develop \
+ )
+}
+
+
# Service wrapper to start services
# start_service service-name
function start_service() {
diff --git a/stack.sh b/stack.sh
index e73d3e4..fcefbde 100755
--- a/stack.sh
+++ b/stack.sh
@@ -64,18 +64,23 @@
# repositories and branches to configure. ``stackrc`` sources ``localrc`` to
# allow you to safely override those settings without being overwritten
# when updating DevStack.
+if [[ ! -r $TOP_DIR/stackrc ]]; then
+ echo "ERROR: missing $TOP_DIR/stackrc - did you grab more than just stack.sh?"
+ exit 1
+fi
+source $TOP_DIR/stackrc
# HTTP and HTTPS proxy servers are supported via the usual environment variables
# ``http_proxy`` and ``https_proxy``. They can be set in ``localrc`` if necessary
# or on the command line::
#
# http_proxy=http://proxy.example.com:3128/ ./stack.sh
-
-if [[ ! -r $TOP_DIR/stackrc ]]; then
- echo "ERROR: missing $TOP_DIR/stackrc - did you grab more than just stack.sh?"
- exit 1
+if [[ -n "$http_proxy" ]]; then
+ export http_proxy=$http_proxy
fi
-source $TOP_DIR/stackrc
+if [[ -n "$https_proxy" ]]; then
+ export https_proxy=$https_proxy
+fi
# Destination path for installation ``DEST``
DEST=${DEST:-/opt/stack}
@@ -262,6 +267,9 @@
SYSLOG_HOST=${SYSLOG_HOST:-$HOST_IP}
SYSLOG_PORT=${SYSLOG_PORT:-516}
+# Use color for logging output
+LOG_COLOR=`trueorfalse True $LOG_COLOR`
+
# Service startup timeout
SERVICE_TIMEOUT=${SERVICE_TIMEOUT:-60}
@@ -626,13 +634,13 @@
continue
fi
- if [[ $line =~ (.*)#.*dist:([^ ]*) ]]; then # We are using BASH regexp matching feature.
- package=${BASH_REMATCH[1]}
- distros=${BASH_REMATCH[2]}
- for distro in ${distros//,/ }; do #In bash ${VAR,,} will lowecase VAR
- [[ ${distro,,} == ${DISTRO,,} ]] && echo $package
- done
- continue
+ if [[ $line =~ (.*)#.*dist:([^ ]*) ]]; then
+ # We are using BASH regexp matching feature.
+ package=${BASH_REMATCH[1]}
+ distros=${BASH_REMATCH[2]}
+ # In bash ${VAR,,} will lowecase VAR
+ [[ ${distros,,} =~ ${DISTRO,,} ]] && echo $package
+ continue
fi
echo ${line%#*}
@@ -641,16 +649,6 @@
done
}
-# pip install the dependencies of the package before we do the setup.py
-# develop, so that pip and not distutils process the dependency chain
-function setup_develop() {
- python setup.py egg_info
- raw_links=`cat *.egg-info/dependency_links.txt | awk '{print "-f " $1}'`
- depend_links=`echo $raw_links | xargs`
- sudo pip install -r *-info/requires.txt $depend_links
- sudo python setup.py develop
-}
-
# install package requirements
if [[ "$os_PACKAGE" = "deb" ]]; then
apt_get update
@@ -717,39 +715,37 @@
# setup our checkouts so they are installed into python path
# allowing ``import nova`` or ``import glance.client``
-cd $KEYSTONECLIENT_DIR; setup_develop
-cd $NOVACLIENT_DIR; setup_develop
-cd $OPENSTACKCLIENT_DIR; setup_develop
+setup_develop $KEYSTONECLIENT_DIR
+setup_develop $NOVACLIENT_DIR
+setup_develop $OPENSTACKCLIENT_DIR
if is_service_enabled key g-api n-api swift; then
- cd $KEYSTONE_DIR; setup_develop
+ setup_develop $KEYSTONE_DIR
fi
if is_service_enabled swift; then
- cd $SWIFT_DIR; setup_develop
- cd $SWIFTCLIENT_DIR; setup_develop
- cd $SWIFT3_DIR; setup_develop
+ setup_develop $SWIFT_DIR
+ setup_develop $SWIFTCLIENT_DIR
+ setup_develop $SWIFT3_DIR
fi
if is_service_enabled g-api n-api; then
- cd $GLANCE_DIR; setup_develop
+ setup_develop $GLANCE_DIR
fi
-cd $NOVA_DIR; setup_develop
+setup_develop $NOVA_DIR
if is_service_enabled horizon; then
- cd $HORIZON_DIR; setup_develop
+ setup_develop $HORIZON_DIR
fi
if is_service_enabled quantum; then
- cd $QUANTUM_CLIENT_DIR; setup_develop
-fi
-if is_service_enabled quantum; then
- cd $QUANTUM_DIR; setup_develop
+ setup_develop $QUANTUM_CLIENT_DIR
+ setup_develop $QUANTUM_DIR
fi
if is_service_enabled m-svc; then
- cd $MELANGE_DIR; setup_develop
+ setup_develop $MELANGE_DIR
fi
if is_service_enabled melange; then
- cd $MELANGECLIENT_DIR; setup_develop
+ setup_develop $MELANGECLIENT_DIR
fi
# Do this _after_ glance is installed to override the old binary
-cd $GLANCECLIENT_DIR; setup_develop
+setup_develop $GLANCECLIENT_DIR
# Syslog
@@ -1185,9 +1181,25 @@
cp -p $NOVA_DIR/etc/nova/policy.json $NOVA_CONF_DIR
+# If Nova ships the new rootwrap.d config files, deploy them
+# (owned by root) and add a parameter to $NOVA_ROOTWRAP
+ROOTWRAP_SUDOER_CMD="$NOVA_ROOTWRAP"
+if [[ -d $NOVA_DIR/etc/nova/rootwrap.d ]]; then
+ # Wipe any existing rootwrap.d files first
+ if [[ -d $NOVA_CONF_DIR/rootwrap.d ]]; then
+ sudo rm -rf $NOVA_CONF_DIR/rootwrap.d
+ fi
+ sudo mkdir -m 755 $NOVA_CONF_DIR/rootwrap.d
+ sudo cp $NOVA_DIR/etc/nova/rootwrap.d/* $NOVA_CONF_DIR/rootwrap.d
+ sudo chown -R root:root $NOVA_CONF_DIR/rootwrap.d
+ sudo chmod 644 $NOVA_CONF_DIR/rootwrap.d/*
+ NOVA_ROOTWRAP="$NOVA_ROOTWRAP $NOVA_CONF_DIR/rootwrap.d"
+ ROOTWRAP_SUDOER_CMD="$NOVA_ROOTWRAP *"
+fi
+
# Set up the rootwrap sudoers
TEMPFILE=`mktemp`
-echo "$USER ALL=(root) NOPASSWD: $NOVA_ROOTWRAP" >$TEMPFILE
+echo "$USER ALL=(root) NOPASSWD: $ROOTWRAP_SUDOER_CMD" >$TEMPFILE
chmod 0440 $TEMPFILE
sudo chown root:root $TEMPFILE
sudo mv $TEMPFILE /etc/sudoers.d/nova-rootwrap
@@ -1446,34 +1458,69 @@
sudo sed -i '/disable *= *yes/ { s/yes/no/ }' /etc/xinetd.d/rsync
fi
- # By default Swift will be installed with the tempauth middleware
- # which has some default username and password if you have
- # configured keystone it will checkout the directory.
- if is_service_enabled key; then
- swift_auth_server="s3token authtoken keystone"
- else
- swift_auth_server=tempauth
- fi
+ # By default Swift will be installed with the tempauth middleware
+ # which has some default username and password if you have
+ # configured keystone it will checkout the directory.
+ if is_service_enabled key; then
+ swift_auth_server="s3token authtoken keystone"
+ else
+ swift_auth_server=tempauth
+ fi
- # We do the install of the proxy-server and swift configuration
- # replacing a few directives to match our configuration.
- sed -e "
- s,%SWIFT_CONFIG_DIR%,${SWIFT_CONFIG_DIR},g;
- s,%USER%,$USER,g;
- s,%SERVICE_TENANT_NAME%,$SERVICE_TENANT_NAME,g;
- s,%SERVICE_USERNAME%,swift,g;
- s,%SERVICE_PASSWORD%,$SERVICE_PASSWORD,g;
- s,%KEYSTONE_SERVICE_PROTOCOL%,$KEYSTONE_SERVICE_PROTOCOL,g;
- s,%SERVICE_TOKEN%,${SERVICE_TOKEN},g;
- s,%KEYSTONE_API_PORT%,${KEYSTONE_API_PORT},g;
- s,%KEYSTONE_AUTH_HOST%,${KEYSTONE_AUTH_HOST},g;
- s,%KEYSTONE_AUTH_PORT%,${KEYSTONE_AUTH_PORT},g;
- s,%KEYSTONE_AUTH_PROTOCOL%,${KEYSTONE_AUTH_PROTOCOL},g;
- s/%AUTH_SERVER%/${swift_auth_server}/g;
- " $FILES/swift/proxy-server.conf | \
- sudo tee ${SWIFT_CONFIG_DIR}/proxy-server.conf
+ SWIFT_CONFIG_PROXY_SERVER=${SWIFT_CONFIG_DIR}/proxy-server.conf
+ cp ${SWIFT_DIR}/etc/proxy-server.conf-sample ${SWIFT_CONFIG_PROXY_SERVER}
- sed -e "s/%SWIFT_HASH%/$SWIFT_HASH/" $FILES/swift/swift.conf > ${SWIFT_CONFIG_DIR}/swift.conf
+ iniuncomment ${SWIFT_CONFIG_PROXY_SERVER} DEFAULT user
+ iniset ${SWIFT_CONFIG_PROXY_SERVER} DEFAULT user ${USER}
+
+ iniuncomment ${SWIFT_CONFIG_PROXY_SERVER} DEFAULT swift_dir
+ iniset ${SWIFT_CONFIG_PROXY_SERVER} DEFAULT swift_dir ${SWIFT_CONFIG_DIR}
+
+ iniuncomment ${SWIFT_CONFIG_PROXY_SERVER} DEFAULT workers
+ iniset ${SWIFT_CONFIG_PROXY_SERVER} DEFAULT workers 1
+
+ iniuncomment ${SWIFT_CONFIG_PROXY_SERVER} DEFAULT log_level
+ iniset ${SWIFT_CONFIG_PROXY_SERVER} DEFAULT log_level DEBUG
+
+ iniuncomment ${SWIFT_CONFIG_PROXY_SERVER} DEFAULT bind_port
+ iniset ${SWIFT_CONFIG_PROXY_SERVER} DEFAULT bind_port ${SWIFT_DEFAULT_BIND_PORT:-8080}
+
+ iniset ${SWIFT_CONFIG_PROXY_SERVER} pipeline:main pipeline "catch_errors healthcheck cache ratelimit swift3 ${swift_auth_server} proxy-logging proxy-server"
+
+ iniset ${SWIFT_CONFIG_PROXY_SERVER} app:proxy-server account_autocreate true
+
+ cat <<EOF>>${SWIFT_CONFIG_PROXY_SERVER}
+
+[filter:keystone]
+paste.filter_factory = keystone.middleware.swift_auth:filter_factory
+operator_roles = Member,admin
+
+# NOTE(chmou): s3token middleware is not updated yet to use only
+# username and password.
+[filter:s3token]
+paste.filter_factory = keystone.middleware.s3_token:filter_factory
+auth_port = ${KEYSTONE_AUTH_PORT}
+auth_host = ${KEYSTONE_AUTH_HOST}
+auth_protocol = ${KEYSTONE_AUTH_PROTOCOL}
+auth_token = ${SERVICE_TOKEN}
+admin_token = ${SERVICE_TOKEN}
+
+[filter:authtoken]
+paste.filter_factory = keystone.middleware.auth_token:filter_factory
+auth_host = ${KEYSTONE_AUTH_HOST}
+auth_port = ${KEYSTONE_AUTH_PORT}
+auth_protocol = ${KEYSTONE_AUTH_PROTOCOL}
+auth_uri = ${KEYSTONE_SERVICE_PROTOCOL}://${KEYSTONE_SERVICE_HOST}:${KEYSTONE_SERVICE_PORT}/
+admin_tenant_name = ${SERVICE_TENANT_NAME}
+admin_user = swift
+admin_password = ${SERVICE_PASSWORD}
+
+[filter:swift3]
+use = egg:swift3#middleware
+EOF
+
+ cp ${SWIFT_DIR}/etc/swift.conf-sample ${SWIFT_CONFIG_DIR}/swift.conf
+ iniset ${SWIFT_CONFIG_DIR}/swift.conf swift-hash swift_hash_path_suffix ${SWIFT_HASH}
# We need to generate a object/account/proxy configuration
# emulating 4 nodes on different ports we have a little function
@@ -1483,16 +1530,35 @@
local bind_port=$2
local log_facility=$3
local node_number
+ local swift_node_config
for node_number in $(seq ${SWIFT_REPLICAS}); do
node_path=${SWIFT_DATA_DIR}/${node_number}
- sed -e "
- s,%SWIFT_CONFIG_DIR%,${SWIFT_CONFIG_DIR},;
- s,%USER%,$USER,;
- s,%NODE_PATH%,${node_path},;
- s,%BIND_PORT%,${bind_port},;
- s,%LOG_FACILITY%,${log_facility},
- " $FILES/swift/${server_type}-server.conf > ${SWIFT_CONFIG_DIR}/${server_type}-server/${node_number}.conf
+ swift_node_config=${SWIFT_CONFIG_DIR}/${server_type}-server/${node_number}.conf
+
+ cp ${SWIFT_DIR}/etc/${server_type}-server.conf-sample ${swift_node_config}
+
+ iniuncomment ${swift_node_config} DEFAULT user
+ iniset ${swift_node_config} DEFAULT user ${USER}
+
+ iniuncomment ${swift_node_config} DEFAULT bind_port
+ iniset ${swift_node_config} DEFAULT bind_port ${bind_port}
+
+ iniuncomment ${swift_node_config} DEFAULT swift_dir
+ iniset ${swift_node_config} DEFAULT swift_dir ${SWIFT_CONFIG_DIR}
+
+ iniuncomment ${swift_node_config} DEFAULT devices
+ iniset ${swift_node_config} DEFAULT devices ${node_path}
+
+ iniuncomment ${swift_node_config} DEFAULT log_facility
+ iniset ${swift_node_config} DEFAULT log_facility LOG_LOCAL${log_facility}
+
+ iniuncomment ${swift_node_config} DEFAULT mount_check
+ iniset ${swift_node_config} DEFAULT mount_check false
+
+ iniuncomment ${swift_node_config} ${server_type}-replicator vm_test_mode
+ iniset ${swift_node_config} ${server_type}-replicator vm_test_mode yes
+
bind_port=$(( ${bind_port} + 10 ))
log_facility=$(( ${log_facility} + 1 ))
done
@@ -1501,48 +1567,47 @@
generate_swift_configuration container 6011 2
generate_swift_configuration account 6012 2
+ # We have some specific configuration for swift for rsyslog. See
+ # the file /etc/rsyslog.d/10-swift.conf for more info.
+ swift_log_dir=${SWIFT_DATA_DIR}/logs
+ rm -rf ${swift_log_dir}
+ mkdir -p ${swift_log_dir}/hourly
+ sudo chown -R $USER:adm ${swift_log_dir}
+ sed "s,%SWIFT_LOGDIR%,${swift_log_dir}," $FILES/swift/rsyslog.conf | sudo \
+ tee /etc/rsyslog.d/10-swift.conf
+ restart_service rsyslog
- # We have some specific configuration for swift for rsyslog. See
- # the file /etc/rsyslog.d/10-swift.conf for more info.
- swift_log_dir=${SWIFT_DATA_DIR}/logs
- rm -rf ${swift_log_dir}
- mkdir -p ${swift_log_dir}/hourly
- sudo chown -R $USER:adm ${swift_log_dir}
- sed "s,%SWIFT_LOGDIR%,${swift_log_dir}," $FILES/swift/rsyslog.conf | sudo \
- tee /etc/rsyslog.d/10-swift.conf
- restart_service rsyslog
+ # This is where we create three different rings for swift with
+ # different object servers binding on different ports.
+ pushd ${SWIFT_CONFIG_DIR} >/dev/null && {
- # This is where we create three different rings for swift with
- # different object servers binding on different ports.
- pushd ${SWIFT_CONFIG_DIR} >/dev/null && {
+ rm -f *.builder *.ring.gz backups/*.builder backups/*.ring.gz
- rm -f *.builder *.ring.gz backups/*.builder backups/*.ring.gz
+ port_number=6010
+ swift-ring-builder object.builder create ${SWIFT_PARTITION_POWER_SIZE} ${SWIFT_REPLICAS} 1
+ for x in $(seq ${SWIFT_REPLICAS}); do
+ swift-ring-builder object.builder add z${x}-127.0.0.1:${port_number}/sdb1 1
+ port_number=$[port_number + 10]
+ done
+ swift-ring-builder object.builder rebalance
- port_number=6010
- swift-ring-builder object.builder create ${SWIFT_PARTITION_POWER_SIZE} ${SWIFT_REPLICAS} 1
- for x in $(seq ${SWIFT_REPLICAS}); do
- swift-ring-builder object.builder add z${x}-127.0.0.1:${port_number}/sdb1 1
- port_number=$[port_number + 10]
- done
- swift-ring-builder object.builder rebalance
+ port_number=6011
+ swift-ring-builder container.builder create ${SWIFT_PARTITION_POWER_SIZE} ${SWIFT_REPLICAS} 1
+ for x in $(seq ${SWIFT_REPLICAS}); do
+ swift-ring-builder container.builder add z${x}-127.0.0.1:${port_number}/sdb1 1
+ port_number=$[port_number + 10]
+ done
+ swift-ring-builder container.builder rebalance
- port_number=6011
- swift-ring-builder container.builder create ${SWIFT_PARTITION_POWER_SIZE} ${SWIFT_REPLICAS} 1
- for x in $(seq ${SWIFT_REPLICAS}); do
- swift-ring-builder container.builder add z${x}-127.0.0.1:${port_number}/sdb1 1
- port_number=$[port_number + 10]
- done
- swift-ring-builder container.builder rebalance
+ port_number=6012
+ swift-ring-builder account.builder create ${SWIFT_PARTITION_POWER_SIZE} ${SWIFT_REPLICAS} 1
+ for x in $(seq ${SWIFT_REPLICAS}); do
+ swift-ring-builder account.builder add z${x}-127.0.0.1:${port_number}/sdb1 1
+ port_number=$[port_number + 10]
+ done
+ swift-ring-builder account.builder rebalance
- port_number=6012
- swift-ring-builder account.builder create ${SWIFT_PARTITION_POWER_SIZE} ${SWIFT_REPLICAS} 1
- for x in $(seq ${SWIFT_REPLICAS}); do
- swift-ring-builder account.builder add z${x}-127.0.0.1:${port_number}/sdb1 1
- port_number=$[port_number + 10]
- done
- swift-ring-builder account.builder rebalance
-
- } && popd >/dev/null
+ } && popd >/dev/null
# We then can start rsync.
if [[ "$os_PACKAGE" = "deb" ]]; then
@@ -1712,6 +1777,16 @@
if [ "$API_RATE_LIMIT" != "True" ]; then
add_nova_opt "api_rate_limit=False"
fi
+if [ "$LOG_COLOR" == "True" ] && [ "$SYSLOG" == "False" ]; then
+ # Add color to logging output
+ add_nova_opt "logging_context_format_string=%(asctime)s %(color)s%(levelname)s %(name)s [[01;36m%(request_id)s [00;36m%(user_name)s %(project_name)s%(color)s] [01;35m%(instance)s%(color)s%(message)s[00m"
+ add_nova_opt "logging_default_format_string=%(asctime)s %(color)s%(levelname)s %(name)s [[00;36m-%(color)s] [01;35m%(instance)s%(color)s%(message)s[00m"
+ add_nova_opt "logging_debug_format_suffix=[00;33mfrom (pid=%(process)d) %(funcName)s %(pathname)s:%(lineno)d[00m"
+ add_nova_opt "logging_exception_prefix=%(color)s%(asctime)s TRACE %(name)s [01;35m%(instance)s[00m"
+else
+ # Show user_name and project_name instead of user_id and project_id
+ add_nova_opt "logging_context_format_string=%(asctime)s %(levelname)s %(name)s [%(request_id)s %(user_name)s %(project_name)s] %(instance)s%(message)s"
+fi
# Provide some transition from EXTRA_FLAGS to EXTRA_OPTS
@@ -1945,7 +2020,7 @@
ADMIN_USER=admin
ADMIN_TENANT=admin
- TOKEN=`curl -s -d "{\"auth\":{\"passwordCredentials\": {\"username\": \"$ADMIN_USER\", \"password\": \"$ADMIN_PASSWORD\"}, \"tenantName\": \"$ADMIN_TENANT\"}}" -H "Content-type: application/json" http://$HOST_IP:5000/v2.0/tokens | python -c "import sys; import json; tok = json.loads(sys.stdin.read()); print tok['access']['token']['id'];"`
+ TOKEN=$(keystone --os_tenant_name $ADMIN_TENANT --os_username $ADMIN_USER --os_password $ADMIN_PASSWORD --os_auth_url http://$HOST_IP:5000/v2.0 token-get | grep ' id ' | get_field 2)
# Option to upload legacy ami-tty, which works with xenserver
if [[ -n "$UPLOAD_LEGACY_TTY" ]]; then
@@ -1955,7 +2030,7 @@
for image_url in ${IMAGE_URLS//,/ }; do
# Downloads the image (uec ami+aki style), then extracts it.
IMAGE_FNAME=`basename "$image_url"`
- if [ ! -f $FILES/$IMAGE_FNAME ]; then
+ if [[ ! -f $FILES/$IMAGE_FNAME || "$(stat -c "%s" $FILES/$IMAGE_FNAME)" = "0" ]]; then
wget -c $image_url -O $FILES/$IMAGE_FNAME
fi
diff --git a/stackrc b/stackrc
index 3c20c87..3387d43 100644
--- a/stackrc
+++ b/stackrc
@@ -93,8 +93,10 @@
#IMAGE_URLS="http://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-disk.img" # cirros full disk image
case "$LIBVIRT_TYPE" in
lxc) # the cirros root disk in the uec tarball is empty, so it will not work for lxc
+ DEFAULT_IMAGE_NAME=cirros-0.3.0-x86_64-rootfs
IMAGE_URLS="http://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-rootfs.img.gz";;
*) # otherwise, use the uec style image (with kernel, ramdisk, disk)
+ DEFAULT_IMAGE_NAME=cirros-0.3.0-x86_64-uec
IMAGE_URLS="http://launchpad.net/cirros/trunk/0.3.0/+download/cirros-0.3.0-x86_64-uec.tar.gz";;
esac
diff --git a/tools/rfc.sh b/tools/rfc.sh
deleted file mode 100755
index d4dc597..0000000
--- a/tools/rfc.sh
+++ /dev/null
@@ -1,145 +0,0 @@
-#!/bin/sh -e
-# Copyright (c) 2010-2011 Gluster, Inc. <http://www.gluster.com>
-# This initial version of this file was taken from the source tree
-# of GlusterFS. It was not directly attributed, but is assumed to be
-# Copyright (c) 2010-2011 Gluster, Inc and release GPLv3
-# Subsequent modifications are Copyright (c) 2011 OpenStack, LLC.
-#
-# GlusterFS is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published
-# by the Free Software Foundation; either version 3 of the License,
-# or (at your option) any later version.
-#
-# GlusterFS is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see
-# <http://www.gnu.org/licenses/>.
-
-
-branch="master";
-
-set_hooks_commit_msg()
-{
- top_dir=`git rev-parse --show-toplevel`
- f="${top_dir}/.git/hooks/commit-msg";
- u="https://review.openstack.org/tools/hooks/commit-msg";
-
- if [ -x "$f" ]; then
- return;
- fi
-
- curl -o $f $u || wget -O $f $u;
-
- chmod +x $f;
-
- GIT_EDITOR=true git commit --amend
-}
-
-add_remote()
-{
- username=$1
- project=$2
-
- echo "No remote set, testing ssh://$username@review.openstack.org:29418"
- if project_list=`ssh -p29418 -o StrictHostKeyChecking=no $username@review.openstack.org gerrit ls-projects 2>/dev/null`
- then
- echo "$username@review.openstack.org:29418 worked."
- if echo $project_list | grep $project >/dev/null
- then
- echo "Creating a git remote called gerrit that maps to:"
- echo " ssh://$username@review.openstack.org:29418/$project"
- git remote add gerrit ssh://$username@review.openstack.org:29418/$project
- else
- echo "The current project name, $project, is not a known project."
- echo "Please either reclone from github/gerrit or create a"
- echo "remote named gerrit that points to the intended project."
- return 1
- fi
-
- return 0
- fi
- return 1
-}
-
-check_remote()
-{
- if ! git remote | grep gerrit >/dev/null 2>&1
- then
- origin_project=`git remote show origin | grep 'Fetch URL' | perl -nle '@fields = split(m|[:/]|); $len = $#fields; print $fields[$len-1], "/", $fields[$len];'`
- if add_remote $USERNAME $origin_project
- then
- return 0
- else
- echo "Your local name doesn't work on Gerrit."
- echo -n "Enter Gerrit username (same as launchpad): "
- read gerrit_user
- if add_remote $gerrit_user $origin_project
- then
- return 0
- else
- echo "Can't infer where gerrit is - please set a remote named"
- echo "gerrit manually and then try again."
- echo
- echo "For more information, please see:"
- echo "\thttp://wiki.openstack.org/GerritWorkflow"
- exit 1
- fi
- fi
- fi
-}
-
-rebase_changes()
-{
- git fetch;
-
- GIT_EDITOR=true git rebase -i origin/$branch || exit $?;
-}
-
-
-assert_diverge()
-{
- if ! git diff origin/$branch..HEAD | grep -q .
- then
- echo "No changes between the current branch and origin/$branch."
- exit 1
- fi
-}
-
-
-main()
-{
- set_hooks_commit_msg;
-
- check_remote;
-
- rebase_changes;
-
- assert_diverge;
-
- bug=$(git show --format='%s %b' | perl -nle 'if (/\b([Bb]ug|[Ll][Pp])\s*[#:]?\s*(\d+)/) {print "$2"; exit}')
-
- bp=$(git show --format='%s %b' | perl -nle 'if (/\b([Bb]lue[Pp]rint|[Bb][Pp])\s*[#:]?\s*([0-9a-zA-Z-_]+)/) {print "$2"; exit}')
-
- if [ "$DRY_RUN" = 1 ]; then
- drier='echo -e Please use the following command to send your commits to review:\n\n'
- else
- drier=
- fi
-
- local_branch=`git branch | grep -Ei "\* (.*)" | cut -f2 -d' '`
- if [ -z "$bug" ]; then
- if [ -z "$bp" ]; then
- $drier git push gerrit HEAD:refs/for/$branch/$local_branch;
- else
- $drier git push gerrit HEAD:refs/for/$branch/bp/$bp;
- fi
- else
- $drier git push gerrit HEAD:refs/for/$branch/bug/$bug;
- fi
-}
-
-main "$@"
diff --git a/unstack.sh b/unstack.sh
index 7de0d74..341270d 100755
--- a/unstack.sh
+++ b/unstack.sh
@@ -25,9 +25,12 @@
fi
# Shut down devstack's screen to get the bulk of OpenStack services in one shot
-SESSION=$(screen -ls | grep "[0-9].stack" | awk '{ print $1 }')
-if [[ -n "$SESSION" ]]; then
- screen -X -S $SESSION quit
+SCREEN=$(which screen)
+if [[ -n "$SCREEN" ]]; then
+ SESSION=$(screen -ls | awk '/[0-9].stack/ { print $1 }')
+ if [[ -n "$SESSION" ]]; then
+ screen -X -S $SESSION quit
+ fi
fi
# Swift runs daemons