Merge "Adds two new configuration files"
diff --git a/HACKING.rst b/HACKING.rst
index a40af54..6bd24b0 100644
--- a/HACKING.rst
+++ b/HACKING.rst
@@ -355,7 +355,7 @@
* **Should this be upstream** -- DevStack generally does not override
default choices provided by projects and attempts to not
- unexpectedly modify behaviour.
+ unexpectedly modify behavior.
* **Context in commit messages** -- DevStack touches many different
areas and reviewers need context around changes to make good
diff --git a/doc/source/plugins.rst b/doc/source/plugins.rst
index 1b6f5e3..803dd08 100644
--- a/doc/source/plugins.rst
+++ b/doc/source/plugins.rst
@@ -15,7 +15,7 @@
Plugin Interface
================
-DevStack supports a standard mechansim for including plugins from
+DevStack supports a standard mechanism for including plugins from
external repositories. The plugin interface assumes the following:
An external git repository that includes a ``devstack/`` top level
@@ -49,7 +49,7 @@
[[local|localrc]]
enable_plugin <NAME> <GITURL> [GITREF]
-- ``name`` - an arbitrary name. (ex: glustfs, docker, zaqar, congress)
+- ``name`` - an arbitrary name. (ex: glusterfs, docker, zaqar, congress)
- ``giturl`` - a valid git url that can be cloned
- ``gitref`` - an optional git ref (branch / ref / tag) that will be
cloned. Defaults to master.
@@ -209,7 +209,7 @@
Ideally a plugin will be included within the ``devstack`` directory of
the project they are being tested. For example, the stackforge/ec2-api
-project has its pluggin support in its own tree.
+project has its plugin support in its own tree.
However, some times a DevStack plugin might be used solely to
configure a backend service that will be used by the rest of
diff --git a/functions b/functions
index 1668e16..5bbe18f 100644
--- a/functions
+++ b/functions
@@ -219,6 +219,23 @@
return
fi
+ if [[ "$image_url" =~ '.hds' ]]; then
+ image_name="${image_fname%.hds}"
+ vm_mode=${image_name##*-}
+ if [[ $vm_mode != 'exe' && $vm_mode != 'hvm' ]]; then
+ die $LINENO "Unknown vm_mode=${vm_mode} for Virtuozzo image"
+ fi
+
+ openstack \
+ --os-token $token \
+ --os-url $GLANCE_SERVICE_PROTOCOL://$GLANCE_HOSTPORT \
+ image create \
+ "$image_name" --public \
+ --container-format=bare --disk-format=ploop \
+ --property vm_mode=$vm_mode < "${image}"
+ return
+ fi
+
local kernel=""
local ramdisk=""
local disk_format=""
diff --git a/inc/ini-config b/inc/ini-config
index 26401f3..8e7c018 100644
--- a/inc/ini-config
+++ b/inc/ini-config
@@ -104,7 +104,10 @@
local option=$3
local value=$4
- [[ -z $section || -z $option ]] && return
+ if [[ -z $section || -z $option ]]; then
+ $xtrace
+ return
+ fi
# Add it
sed -i -e "/^\[$section\]/ a\\
@@ -123,7 +126,10 @@
local section=$2
local option=$3
- [[ -z $section || -z $option ]] && return
+ if [[ -z $section || -z $option ]]; then
+ $xtrace
+ return
+ fi
# Remove old values
sed -i -e "/^\[$section\]/,/^\[.*\]/ { /^$option[ \t]*=/ d; }" "$file"
@@ -141,7 +147,10 @@
local option=$3
local value=$4
- [[ -z $section || -z $option ]] && return
+ if [[ -z $section || -z $option ]]; then
+ $xtrace
+ return
+ fi
if ! grep -q "^\[$section\]" "$file" 2>/dev/null; then
# Add section at the end
diff --git a/lib/ceph b/lib/ceph
index 6cf481e..910b427 100644
--- a/lib/ceph
+++ b/lib/ceph
@@ -267,6 +267,7 @@
sudo ceph -c ${CEPH_CONF_FILE} auth get-or-create client.${GLANCE_CEPH_USER} mon "allow r" osd "allow class-read object_prefix rbd_children, allow rwx pool=${GLANCE_CEPH_POOL}" | sudo tee ${CEPH_CONF_DIR}/ceph.client.${GLANCE_CEPH_USER}.keyring
sudo chown ${STACK_USER}:$(id -g -n $whoami) ${CEPH_CONF_DIR}/ceph.client.${GLANCE_CEPH_USER}.keyring
+ iniset $GLANCE_API_CONF DEFAULT show_image_direct_url True
iniset $GLANCE_API_CONF glance_store default_store rbd
iniset $GLANCE_API_CONF glance_store stores "file, http, rbd"
iniset $GLANCE_API_CONF glance_store rbd_store_ceph_conf $CEPH_CONF_FILE
@@ -295,7 +296,7 @@
iniset $NOVA_CONF libvirt images_rbd_ceph_conf ${CEPH_CONF_FILE}
if ! is_service_enabled cinder; then
- sudo ceph -c ${CEPH_CONF_FILE} auth get-or-create client.${CINDER_CEPH_USER} mon "allow r" osd "allow class-read object_prefix rbd_children, allow rwx pool=${CINDER_CEPH_POOL}, allow rwx pool=${NOVA_CEPH_POOL},allow rx pool=${GLANCE_CEPH_POOL}" | sudo tee ${CEPH_CONF_DIR}/ceph.client.${CINDER_CEPH_USER}.keyring > /dev/null
+ sudo ceph -c ${CEPH_CONF_FILE} auth get-or-create client.${CINDER_CEPH_USER} mon "allow r" osd "allow class-read object_prefix rbd_children, allow rwx pool=${CINDER_CEPH_POOL}, allow rwx pool=${NOVA_CEPH_POOL},allow rwx pool=${GLANCE_CEPH_POOL}" | sudo tee ${CEPH_CONF_DIR}/ceph.client.${CINDER_CEPH_USER}.keyring > /dev/null
sudo chown ${STACK_USER}:$(id -g -n $whoami) ${CEPH_CONF_DIR}/ceph.client.${CINDER_CEPH_USER}.keyring
fi
}
diff --git a/lib/neutron-legacy b/lib/neutron-legacy
index 2c9dd1a..4069439 100644
--- a/lib/neutron-legacy
+++ b/lib/neutron-legacy
@@ -999,7 +999,6 @@
}
function _configure_neutron_l3_agent {
- local cfg_file
Q_L3_ENABLED=True
# for l3-agent, only use per tenant router if we have namespaces
Q_L3_ROUTER_PER_TENANT=$Q_USE_NAMESPACE
diff --git a/tests/test_ini_config.sh b/tests/test_ini_config.sh
index b2529ac..3aef6f3 100755
--- a/tests/test_ini_config.sh
+++ b/tests/test_ini_config.sh
@@ -13,7 +13,13 @@
echo "Testing INI functions"
-cat >test.ini <<EOF
+INI_TMP_DIR=$(mktemp -d)
+INI_TMP_ETC_DIR=$INI_TMP_DIR/etc
+TEST_INI=${INI_TMP_ETC_DIR}/test.ini
+mkdir ${INI_TMP_ETC_DIR}
+
+echo "Creating $TEST_INI"
+cat >${TEST_INI} <<EOF
[default]
# comment an option
#log_file=./log.conf
@@ -67,204 +73,98 @@
# Test with missing arguments
-BEFORE=$(cat test.ini)
+BEFORE=$(cat ${TEST_INI})
-echo -n "iniset: test missing attribute argument: "
-iniset test.ini aaa
-NO_ATTRIBUTE=$(cat test.ini)
-if [[ "$BEFORE" == "$NO_ATTRIBUTE" ]]; then
- passed
-else
- failed "failed"
-fi
+iniset ${TEST_INI} aaa
+NO_ATTRIBUTE=$(cat ${TEST_INI})
+assert_equal "$BEFORE" "$NO_ATTRIBUTE" "test missing attribute argument"
-echo -n "iniset: test missing section argument: "
-iniset test.ini
-NO_SECTION=$(cat test.ini)
-if [[ "$BEFORE" == "$NO_SECTION" ]]; then
- passed
-else
- failed "failed"
-fi
+iniset ${TEST_INI}
+NO_SECTION=$(cat ${TEST_INI})
+assert_equal "$BEFORE" "$NO_SECTION" "missing section argument"
-# Test with spaces
+# Test with spaces in values
+VAL=$(iniget ${TEST_INI} aaa handlers)
+assert_equal "$VAL" "aa, bb" "iniget spaces in option"
-VAL=$(iniget test.ini aaa handlers)
-if [[ "$VAL" == "aa, bb" ]]; then
- passed "OK: $VAL"
-else
- failed "iniget failed: $VAL"
-fi
-
-iniset test.ini aaa handlers "11, 22"
-
-VAL=$(iniget test.ini aaa handlers)
-if [[ "$VAL" == "11, 22" ]]; then
- passed "OK: $VAL"
-else
- failed "iniget failed: $VAL"
-fi
+iniset ${TEST_INI} aaa handlers "11, 22"
+VAL=$(iniget ${TEST_INI} aaa handlers)
+assert_equal "$VAL" "11, 22" "iniset spaces in option"
# Test with spaces in section header
+VAL=$(iniget ${TEST_INI} " ccc " spaces)
+assert_equal "$VAL" "yes" "iniget with section header space"
-VAL=$(iniget test.ini " ccc " spaces)
-if [[ "$VAL" == "yes" ]]; then
- passed "OK: $VAL"
-else
- failed "iniget failed: $VAL"
-fi
-
-iniset test.ini "b b" opt_ion 42
-
-VAL=$(iniget test.ini "b b" opt_ion)
-if [[ "$VAL" == "42" ]]; then
- passed "OK: $VAL"
-else
- failed "iniget failed: $VAL"
-fi
+iniset ${TEST_INI} "b b" opt_ion 42
+VAL=$(iniget ${TEST_INI} "b b" opt_ion)
+assert_equal "$VAL" "42" "iniset with section header space"
# Test without spaces, end of file
+VAL=$(iniget ${TEST_INI} bbb handlers)
+assert_equal "$VAL" "ee,ff" "iniget at EOF"
-VAL=$(iniget test.ini bbb handlers)
-if [[ "$VAL" == "ee,ff" ]]; then
- passed "OK: $VAL"
-else
- failed "iniget failed: $VAL"
-fi
-
-iniset test.ini bbb handlers "33,44"
-
-VAL=$(iniget test.ini bbb handlers)
-if [[ "$VAL" == "33,44" ]]; then
- passed "OK: $VAL"
-else
- failed "iniget failed: $VAL"
-fi
+iniset ${TEST_INI} bbb handlers "33,44"
+VAL=$(iniget ${TEST_INI} bbb handlers)
+assert_equal "$VAL" "33,44" "inset at EOF"
# test empty option
-if ini_has_option test.ini ddd empty; then
- passed "OK: ddd.empty present"
+if ini_has_option ${TEST_INI} ddd empty; then
+ passed "ini_has_option: ddd.empty present"
else
failed "ini_has_option failed: ddd.empty not found"
fi
# test non-empty option
-if ini_has_option test.ini bbb handlers; then
- passed "OK: bbb.handlers present"
+if ini_has_option ${TEST_INI} bbb handlers; then
+ passed "ini_has_option: bbb.handlers present"
else
failed "ini_has_option failed: bbb.handlers not found"
fi
# test changing empty option
-iniset test.ini ddd empty "42"
-
-VAL=$(iniget test.ini ddd empty)
-if [[ "$VAL" == "42" ]]; then
- passed "OK: $VAL"
-else
- failed "iniget failed: $VAL"
-fi
+iniset ${TEST_INI} ddd empty "42"
+VAL=$(iniget ${TEST_INI} ddd empty)
+assert_equal "$VAL" "42" "change empty option"
# test pipe in option
-iniset test.ini aaa handlers "a|b"
-
-VAL=$(iniget test.ini aaa handlers)
-if [[ "$VAL" == "a|b" ]]; then
- passed "OK: $VAL"
-else
- failed "iniget failed: $VAL"
-fi
-
-# test space in option
-iniset test.ini aaa handlers "a b"
-
-VAL="$(iniget test.ini aaa handlers)"
-if [[ "$VAL" == "a b" ]]; then
- passed "OK: $VAL"
-else
- failed "iniget failed: $VAL"
-fi
+iniset ${TEST_INI} aaa handlers "a|b"
+VAL=$(iniget ${TEST_INI} aaa handlers)
+assert_equal "$VAL" "a|b" "pipe in option"
# Test section not exist
-
-VAL=$(iniget test.ini zzz handlers)
-if [[ -z "$VAL" ]]; then
- passed "OK: zzz not present"
-else
- failed "iniget failed: $VAL"
-fi
-
-iniset test.ini zzz handlers "999"
-
-VAL=$(iniget test.ini zzz handlers)
-if [[ -n "$VAL" ]]; then
- passed "OK: zzz not present"
-else
- failed "iniget failed: $VAL"
-fi
+VAL=$(iniget ${TEST_INI} zzz handlers)
+assert_empty VAL "section does not exist"
# Test option not exist
+VAL=$(iniget ${TEST_INI} aaa debug)
+assert_empty VAL "option does not exist"
-VAL=$(iniget test.ini aaa debug)
-if [[ -z "$VAL" ]]; then
- passed "OK aaa.debug not present"
-else
- failed "iniget failed: $VAL"
-fi
-
-if ! ini_has_option test.ini aaa debug; then
- passed "OK aaa.debug not present"
+if ! ini_has_option ${TEST_INI} aaa debug; then
+ passed "ini_has_option: aaa.debug not present"
else
failed "ini_has_option failed: aaa.debug"
fi
-iniset test.ini aaa debug "999"
-
-VAL=$(iniget test.ini aaa debug)
-if [[ -n "$VAL" ]]; then
- passed "OK aaa.debug present"
-else
- failed "iniget failed: $VAL"
-fi
-
# Test comments
-
-inicomment test.ini aaa handlers
-
-VAL=$(iniget test.ini aaa handlers)
-if [[ -z "$VAL" ]]; then
- passed "OK"
-else
- failed "inicomment failed: $VAL"
-fi
+inicomment ${TEST_INI} aaa handlers
+VAL=$(iniget ${TEST_INI} aaa handlers)
+assert_empty VAL "test inicomment"
# Test multiple line iniset/iniget
-iniset_multiline test.ini eee multi bar1 bar2
+iniset_multiline ${TEST_INI} eee multi bar1 bar2
-VAL=$(iniget_multiline test.ini eee multi)
-if [[ "$VAL" == "bar1 bar2" ]]; then
- echo "OK: iniset_multiline"
-else
- failed "iniset_multiline failed: $VAL"
-fi
+VAL=$(iniget_multiline ${TEST_INI} eee multi)
+assert_equal "$VAL" "bar1 bar2" "iniget_multiline"
# Test iniadd with exiting values
-iniadd test.ini eee multi bar3
-VAL=$(iniget_multiline test.ini eee multi)
-if [[ "$VAL" == "bar1 bar2 bar3" ]]; then
- passed "OK: iniadd"
-else
- failed "iniadd failed: $VAL"
-fi
+iniadd ${TEST_INI} eee multi bar3
+VAL=$(iniget_multiline ${TEST_INI} eee multi)
+assert_equal "$VAL" "bar1 bar2 bar3" "iniadd with existing values"
# Test iniadd with non-exiting values
-iniadd test.ini eee non-multi foobar1 foobar2
-VAL=$(iniget_multiline test.ini eee non-multi)
-if [[ "$VAL" == "foobar1 foobar2" ]]; then
- passed "OK: iniadd with non-exiting value"
-else
- failed "iniadd with non-exsting failed: $VAL"
-fi
+iniadd ${TEST_INI} eee non-multi foobar1 foobar2
+VAL=$(iniget_multiline ${TEST_INI} eee non-multi)
+assert_equal "$VAL" "foobar1 foobar2" "iniadd non-existing values"
# Test inidelete
del_cases="
@@ -276,25 +176,21 @@
del_no_section"
for x in $del_cases; do
- inidelete test.ini $x a
- VAL=$(iniget_multiline test.ini $x a)
- if [ -z "$VAL" ]; then
- passed "OK: inidelete $x"
- else
- failed "inidelete $x failed: $VAL"
- fi
+ inidelete ${TEST_INI} $x a
+ VAL=$(iniget_multiline ${TEST_INI} $x a)
+ assert_empty VAL "inidelete $x"
if [ "$x" = "del_separate_options" -o \
"$x" = "del_missing_option" -o \
"$x" = "del_missing_option_multi" ]; then
- VAL=$(iniget_multiline test.ini $x b)
+ VAL=$(iniget_multiline ${TEST_INI} $x b)
if [ "$VAL" = "c" -o "$VAL" = "c d" ]; then
- passed "OK: inidelete other_options $x"
+ passed "inidelete other_options $x"
else
- failed "inidelete other_option $x failed: $VAL"
+ failed "inidelete other_option $x: $VAL"
fi
fi
done
-rm test.ini
+rm -rf ${INI_TMP_DIR}
report_results
diff --git a/tests/unittest.sh b/tests/unittest.sh
index 93aa5fc..603652a 100644
--- a/tests/unittest.sh
+++ b/tests/unittest.sh
@@ -27,7 +27,7 @@
msg="OK"
fi
PASS=$((PASS+1))
- echo "PASS: $function:L$lineno $msg"
+ echo "PASS: $function:L$lineno - $msg"
}
# fail a test, printing out MSG
@@ -63,6 +63,27 @@
fi
}
+# assert variable is empty/blank, printing out msg
+# usage: assert_empty VAR msg
+function assert_empty {
+ local lineno=`caller 0 | awk '{print $1}'`
+ local function=`caller 0 | awk '{print $2}'`
+ local msg=$2
+
+ if [ -z "$msg" ]; then
+ msg="OK"
+ fi
+ if [[ ! -z ${!1} ]]; then
+ FAILED_FUNCS+="$function:L$lineno\n"
+ echo "ERROR: $1 not empty in $function:L$lineno!"
+ echo " $msg"
+ ERROR=$((ERROR+1))
+ else
+ PASS=$((PASS+1))
+ echo "PASS: $function:L$lineno - $msg"
+ fi
+}
+
# print a summary of passing and failing tests, exiting
# with an error if we have failed tests
# usage: report_results
diff --git a/tools/ping_neutron.sh b/tools/ping_neutron.sh
index d36b7f6..dba7502 100755
--- a/tools/ping_neutron.sh
+++ b/tools/ping_neutron.sh
@@ -51,15 +51,15 @@
usage
fi
-REMANING_ARGS="${@:2}"
+REMAINING_ARGS="${@:2}"
# BUG: with duplicate network names, this fails pretty hard.
-NET_ID=$(neutron net-list $NET_NAME | grep "$NET_NAME" | awk '{print $2}')
+NET_ID=$(neutron net-list | grep "$NET_NAME" | awk '{print $2}')
PROBE_ID=$(neutron-debug probe-list -c id -c network_id | grep "$NET_ID" | awk '{print $2}' | head -n 1)
# This runs a command inside the specific netns
NET_NS_CMD="ip netns exec qprobe-$PROBE_ID"
-PING_CMD="sudo $NET_NS_CMD ping $REMAING_ARGS"
+PING_CMD="sudo $NET_NS_CMD ping $REMAINING_ARGS"
echo "Running $PING_CMD"
$PING_CMD