Merge "Set default image for exercises"
diff --git a/AUTHORS b/AUTHORS
index f9aa9ea..ff05f82 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -26,6 +26,7 @@
Kiall Mac Innes <kiall@managedit.ie>
Russell Bryant <rbryant@redhat.com>
Scott Moser <smoser@ubuntu.com>
+Thierry Carrez <thierry@openstack.org>
Todd Willey <xtoddx@gmail.com>
Tres Henry <tres@treshenry.net>
Vishvananda Ishaya <vishvananda@gmail.com>
diff --git a/files/apts/horizon b/files/apts/horizon
index 9b1c9ee..53bddf0 100644
--- a/files/apts/horizon
+++ b/files/apts/horizon
@@ -1,5 +1,6 @@
apache2 # NOPRIME
libapache2-mod-wsgi # NOPRIME
+python-beautifulsoup
python-dateutil
python-paste
python-pastedeploy
@@ -18,8 +19,5 @@
python-kombu
python-coverage
python-cherrypy3 # why?
-python-django-mailer
-python-django-nose
-python-django-registration
python-migrate
nodejs
diff --git a/files/pips/general b/files/pips/general
deleted file mode 100644
index deb2d14..0000000
--- a/files/pips/general
+++ /dev/null
@@ -1 +0,0 @@
-prettytable
diff --git a/files/pips/horizon b/files/pips/horizon
deleted file mode 100644
index 309a5fe..0000000
--- a/files/pips/horizon
+++ /dev/null
@@ -1,6 +0,0 @@
-django>=1.4
-django-mailer # dist:f16
-django-nose # dist:f16
-django-nose-selenium
-pycrypto==2.3
-python-cloudfiles
diff --git a/files/pips/keystone b/files/pips/keystone
deleted file mode 100644
index 09636e4..0000000
--- a/files/pips/keystone
+++ /dev/null
@@ -1 +0,0 @@
-PassLib
diff --git a/files/pips/tempest b/files/pips/tempest
deleted file mode 100644
index 6eeb5b9..0000000
--- a/files/pips/tempest
+++ /dev/null
@@ -1,2 +0,0 @@
-pika
-nosexunit # For use by jenkins in producing reports
diff --git a/files/rpms/horizon b/files/rpms/horizon
index 3c5fbc1..5e36820 100644
--- a/files/rpms/horizon
+++ b/files/rpms/horizon
@@ -5,6 +5,7 @@
mod_wsgi # NOPRIME
pylint
python-anyjson
+python-BeautifulSoup
python-boto
python-coverage
python-dateutil
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 92a9567..71c2f9e 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}
@@ -187,13 +192,6 @@
sudo chown root:root $TEMPFILE
sudo mv $TEMPFILE /etc/sudoers.d/50_stack_sh
- # Set up the rootwrap sudoers
- TEMPFILE=`mktemp`
- echo "$USER ALL=(root) NOPASSWD: $NOVA_ROOTWRAP" >$TEMPFILE
- chmod 0440 $TEMPFILE
- sudo chown root:root $TEMPFILE
- sudo mv $TEMPFILE /etc/sudoers.d/nova-rootwrap
-
# Remove old file
sudo rm -f /etc/sudoers.d/stack_sh_nova
fi
@@ -215,6 +213,7 @@
NOVNC_DIR=$DEST/noVNC
SWIFT_DIR=$DEST/swift
SWIFT3_DIR=$DEST/swift3
+SWIFTCLIENT_DIR=$DEST/python-swiftclient
QUANTUM_DIR=$DEST/quantum
QUANTUM_CLIENT_DIR=$DEST/python-quantumclient
MELANGE_DIR=$DEST/melange
@@ -268,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}
@@ -632,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%#*}
@@ -674,6 +676,9 @@
if is_service_enabled swift; then
# storage service
git_clone $SWIFT_REPO $SWIFT_DIR $SWIFT_BRANCH
+ # storage service client and and Library
+ git_clone $SWIFTCLIENT_REPO $SWIFTCLIENT_DIR $SWIFTCLIENT_BRANCH
+ # swift3 middleware to provide S3 emulation to Swift
git_clone $SWIFT3_REPO $SWIFT3_DIR $SWIFT3_BRANCH
fi
if is_service_enabled g-api n-api; then
@@ -710,38 +715,37 @@
# setup our checkouts so they are installed into python path
# allowing ``import nova`` or ``import glance.client``
-cd $KEYSTONECLIENT_DIR; sudo python setup.py develop
-cd $NOVACLIENT_DIR; sudo python setup.py develop
-cd $OPENSTACKCLIENT_DIR; sudo python setup.py 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; sudo python setup.py develop
+ setup_develop $KEYSTONE_DIR
fi
if is_service_enabled swift; then
- cd $SWIFT_DIR; sudo python setup.py develop
- cd $SWIFT3_DIR; sudo python setup.py 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; sudo python setup.py develop
+ setup_develop $GLANCE_DIR
fi
-cd $NOVA_DIR; sudo python setup.py develop
+setup_develop $NOVA_DIR
if is_service_enabled horizon; then
- cd $HORIZON_DIR; sudo python setup.py develop
+ setup_develop $HORIZON_DIR
fi
if is_service_enabled quantum; then
- cd $QUANTUM_CLIENT_DIR; sudo python setup.py develop
-fi
-if is_service_enabled quantum; then
- cd $QUANTUM_DIR; sudo python setup.py develop
+ setup_develop $QUANTUM_CLIENT_DIR
+ setup_develop $QUANTUM_DIR
fi
if is_service_enabled m-svc; then
- cd $MELANGE_DIR; sudo python setup.py develop
+ setup_develop $MELANGE_DIR
fi
if is_service_enabled melange; then
- cd $MELANGECLIENT_DIR; sudo python setup.py develop
+ setup_develop $MELANGECLIENT_DIR
fi
# Do this _after_ glance is installed to override the old binary
-cd $GLANCECLIENT_DIR; sudo python setup.py develop
+setup_develop $GLANCECLIENT_DIR
# Syslog
@@ -1174,6 +1178,13 @@
cp -p $NOVA_DIR/etc/nova/policy.json $NOVA_CONF_DIR
+# Set up the rootwrap sudoers
+TEMPFILE=`mktemp`
+echo "$USER ALL=(root) NOPASSWD: $NOVA_ROOTWRAP" >$TEMPFILE
+chmod 0440 $TEMPFILE
+sudo chown root:root $TEMPFILE
+sudo mv $TEMPFILE /etc/sudoers.d/nova-rootwrap
+
if is_service_enabled n-api; then
# Use the sample http middleware configuration supplied in the
# Nova sources. This paste config adds the configuration required
@@ -1428,34 +1439,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
@@ -1465,16 +1511,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
@@ -1483,48 +1548,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
@@ -1694,6 +1758,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
@@ -1705,7 +1779,7 @@
# For Example: EXTRA_OPTS=(foo=true bar=2)
for I in "${EXTRA_OPTS[@]}"; do
# Attempt to convert flags to options
- add_nova_opt ${I//-}
+ add_nova_opt ${I//--}
done
@@ -1716,8 +1790,9 @@
read_password XENAPI_PASSWORD "ENTER A PASSWORD TO USE FOR XEN."
add_nova_opt "connection_type=xenapi"
XENAPI_CONNECTION_URL=${XENAPI_CONNECTION_URL:-"http://169.254.0.1"}
+ XENAPI_USER=${XENAPI_USER:-"root"}
add_nova_opt "xenapi_connection_url=$XENAPI_CONNECTION_URL"
- add_nova_opt "xenapi_connection_username=root"
+ add_nova_opt "xenapi_connection_username=$XENAPI_USER"
add_nova_opt "xenapi_connection_password=$XENAPI_PASSWORD"
add_nova_opt "flat_injected=False"
# Need to avoid crash due to new firewall support
@@ -1926,7 +2001,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
@@ -1936,7 +2011,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 62f6b87..3387d43 100644
--- a/stackrc
+++ b/stackrc
@@ -20,6 +20,10 @@
SWIFT3_BRANCH=master
+# python swift client library
+SWIFTCLIENT_REPO=https://github.com/openstack/python-swiftclient
+SWIFTCLIENT_BRANCH=master
+
# image catalog service
GLANCE_REPO=https://github.com/openstack/glance.git
GLANCE_BRANCH=master
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/tools/xen/README.md b/tools/xen/README.md
index d102b01..f20ad04 100644
--- a/tools/xen/README.md
+++ b/tools/xen/README.md
@@ -81,3 +81,9 @@
* Play with horizon
* Play with the CLI
* Log bugs to devstack and core projects, and submit fixes!
+
+Step 6: Run from snapshot
+-------------------------
+If you want to quicky re-run devstack from a clean state,
+using the same settings you used in your previous run,
+you can revert the DomU to the snapshot called "before_first_boot"
diff --git a/tools/xen/build_xva.sh b/tools/xen/build_xva.sh
index edc0db3..fdc6a60 100755
--- a/tools/xen/build_xva.sh
+++ b/tools/xen/build_xva.sh
@@ -1,46 +1,40 @@
#!/bin/bash
-set -e
+# This script is run by install_os_domU.sh
+#
+# It modifies the ubuntu image created by install_os_domU.sh
+# and previously moodified by prepare_guest_template.sh
+#
+# This script is responsible for:
+# - pushing in the DevStack code
+# - creating run.sh, to run the code on boot
+# It does this by mounting the disk image of the VM.
+#
+# The resultant image is then templated and started
+# by install_os_domU.sh
-declare -a on_exit_hooks
-
-on_exit()
-{
- for i in $(seq $((${#on_exit_hooks[*]} - 1)) -1 0)
- do
- eval "${on_exit_hooks[$i]}"
- done
-}
-
-add_on_exit()
-{
- local n=${#on_exit_hooks[*]}
- on_exit_hooks[$n]="$*"
- if [[ $n -eq 0 ]]
- then
- trap on_exit EXIT
- fi
-}
-
-# Abort if localrc is not set
-if [ ! -e ../../localrc ]; then
- echo "You must have a localrc with ALL necessary passwords defined before proceeding."
- echo "See the xen README for required passwords."
- exit 1
-fi
+# Exit on errors
+set -o errexit
+# Echo commands
+set -o xtrace
# This directory
TOP_DIR=$(cd $(dirname "$0") && pwd)
+# Include onexit commands
+. $TOP_DIR/scripts/on_exit.sh
+
# Source params - override xenrc params in your localrc to suite your taste
source xenrc
-# Echo commands
-set -o xtrace
-
+#
+# Parameters
+#
GUEST_NAME="$1"
-# Directory where we stage the build
+#
+# Mount the VDI
+#
STAGING_DIR=$($TOP_DIR/scripts/manage-vdi open $GUEST_NAME 0 1 | grep -o "/tmp/tmp.[[:alnum:]]*")
add_on_exit "$TOP_DIR/scripts/manage-vdi close $GUEST_NAME 0 1"
@@ -76,7 +70,7 @@
cat <<EOF >$STAGING_DIR/etc/rc.local
# network restart required for getting the right gateway
/etc/init.d/networking restart
-GUEST_PASSWORD=$GUEST_PASSWORD STAGING_DIR=/ DO_TGZ=0 bash /opt/stack/devstack/tools/xen/prepare_guest.sh > /opt/stack/prepare_guest.log 2>&1
+chown -R stack /opt/stack
su -c "/opt/stack/run.sh > /opt/stack/run.sh.log 2>&1" stack
exit 0
EOF
@@ -85,8 +79,12 @@
echo $GUEST_NAME > $STAGING_DIR/etc/hostname
# Hostname must resolve for rabbit
+HOSTS_FILE_IP=$PUB_IP
+if [ $MGT_IP != "dhcp" ]; then
+ HOSTS_FILE_IP=$MGT_IP
+fi
cat <<EOF >$STAGING_DIR/etc/hosts
-$MGT_IP $GUEST_NAME
+$HOSTS_FILE_IP $GUEST_NAME
127.0.0.1 localhost localhost.localdomain
EOF
@@ -120,6 +118,13 @@
sed -e "s,@ETH3_NETMASK@,$PUB_NETMASK,g" -i $INTERFACES
fi
+if [ "$ENABLE_GI" == "true" ]; then
+ cat <<EOF >>$INTERFACES
+auto eth0
+iface eth0 inet dhcp
+EOF
+fi
+
# Gracefully cp only if source file/dir exists
function cp_it {
if [ -e $1 ] || [ -d $1 ]; then
@@ -142,8 +147,6 @@
#!/bin/bash
cd /opt/stack/devstack
killall screen
-UPLOAD_LEGACY_TTY=yes HOST_IP=$PUB_IP VIRT_DRIVER=xenserver FORCE=yes MULTI_HOST=$MULTI_HOST HOST_IP_IFACE=$HOST_IP_IFACE $STACKSH_PARAMS ./stack.sh
+VIRT_DRIVER=xenserver FORCE=yes MULTI_HOST=$MULTI_HOST HOST_IP_IFACE=$HOST_IP_IFACE $STACKSH_PARAMS ./stack.sh
EOF
chmod 755 $STAGING_DIR/opt/stack/run.sh
-
-echo "Done"
diff --git a/tools/xen/install_domU_multi.sh b/tools/xen/install_domU_multi.sh
deleted file mode 100755
index 91129c5..0000000
--- a/tools/xen/install_domU_multi.sh
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/usr/bin/env bash
-
-# Echo commands
-set -o xtrace
-
-# Head node host, which runs glance, api, keystone
-HEAD_PUB_IP=${HEAD_PUB_IP:-192.168.1.57}
-HEAD_MGT_IP=${HEAD_MGT_IP:-172.16.100.57}
-
-COMPUTE_PUB_IP=${COMPUTE_PUB_IP:-192.168.1.58}
-COMPUTE_MGT_IP=${COMPUTE_MGT_IP:-172.16.100.58}
-
-# Networking params
-FLOATING_RANGE=${FLOATING_RANGE:-192.168.1.196/30}
-
-# Variables common amongst all hosts in the cluster
-COMMON_VARS="$STACKSH_PARAMS MYSQL_HOST=$HEAD_MGT_IP RABBIT_HOST=$HEAD_MGT_IP GLANCE_HOSTPORT=$HEAD_MGT_IP:9292 FLOATING_RANGE=$FLOATING_RANGE"
-
-# Helper to launch containers
-function install_domU {
- GUEST_NAME=$1 PUB_IP=$2 MGT_IP=$3 DO_SHUTDOWN=$4 TERMINATE=$TERMINATE STACKSH_PARAMS="$COMMON_VARS $5" ./build_domU.sh
-}
-
-# Launch the head node - headnode uses a non-ip domain name,
-# because rabbit won't launch with an ip addr hostname :(
-install_domU HEADNODE $HEAD_PUB_IP $HEAD_MGT_IP 1 "ENABLED_SERVICES=g-api,g-reg,key,n-api,n-sch,n-vnc,horizon,mysql,rabbit"
-
-if [ $HEAD_PUB_IP == "dhcp" ]
-then
- guestnet=$(xe vm-list --minimal name-label=HEADNODE params=networks)
- HEAD_PUB_IP=$(echo $guestnet | grep -w -o --only-matching "3/ip: [0-9,.]*;" | cut -d ':' -f2 | cut -d ';' -f 1)
-fi
-# Wait till the head node is up
-while ! curl -L http://$HEAD_PUB_IP | grep -q username; do
- echo "Waiting for head node ($HEAD_PUB_IP) to start..."
- sleep 5
-done
-
-# Build the HA compute host
-install_domU COMPUTENODE $COMPUTE_PUB_IP $COMPUTE_MGT_IP 0 "ENABLED_SERVICES=n-cpu,n-net,n-api"
diff --git a/tools/xen/install_os_domU.sh b/tools/xen/install_os_domU.sh
index 088748f..352f63a 100755
--- a/tools/xen/install_os_domU.sh
+++ b/tools/xen/install_os_domU.sh
@@ -1,7 +1,16 @@
#!/bin/bash
+# This script is a level script
+# It must be run on a XenServer or XCP machine
+#
+# It creates a DomU VM that runs OpenStack services
+#
+# For more details see: README.md
+
# Exit on errors
set -o errexit
+# Echo commands
+set -o xtrace
# Abort if localrc is not set
if [ ! -e ../../localrc ]; then
@@ -16,12 +25,17 @@
# Source lower level functions
. $TOP_DIR/../../functions
+# Include onexit commands
+. $TOP_DIR/scripts/on_exit.sh
+
+
+#
+# Get Settings
+#
+
# Source params - override xenrc params in your localrc to suit your taste
source xenrc
-# Echo commands
-set -o xtrace
-
xe_min()
{
local cmd="$1"
@@ -29,22 +43,38 @@
xe "$cmd" --minimal "$@"
}
+
+#
+# Prepare Dom0
+# including installing XenAPI plugins
+#
+
cd $TOP_DIR
if [ -f ./master ]
then
rm -rf ./master
rm -rf ./nova
fi
+
+# get nova
wget https://github.com/openstack/nova/zipball/master --no-check-certificate
unzip -o master -d ./nova
-cp -pr ./nova/*/plugins/xenserver/xenapi/etc/xapi.d /etc/
-chmod a+x /etc/xapi.d/plugins/*
+
+# install xapi plugins
+XAPI_PLUGIN_DIR=/etc/xapi.d/plugins/
+if [ ! -d $XAPI_PLUGIN_DIR ]; then
+ # the following is needed when using xcp-xapi
+ XAPI_PLUGIN_DIR=/usr/lib/xcp/plugins/
+fi
+cp -pr ./nova/*/plugins/xenserver/xenapi/etc/xapi.d/plugins/* $XAPI_PLUGIN_DIR
+chmod a+x ${XAPI_PLUGIN_DIR}*
mkdir -p /boot/guest
-GUEST_NAME=${GUEST_NAME:-"DevStackOSDomU"}
-SNAME="ubuntusnapshot"
-TNAME="ubuntuready"
+
+#
+# Configure Networking
+#
# Helper to create networks
# Uses echo trickery to return network uuid
@@ -84,7 +114,7 @@
fi
}
-# Create host, vm, mgmt, pub networks
+# Create host, vm, mgmt, pub networks on XenServer
VM_NET=$(create_network "$VM_BR" "$VM_DEV" "$VM_VLAN" "vmbr")
errorcheck
MGT_NET=$(create_network "$MGT_BR" "$MGT_DEV" "$MGT_VLAN" "mgtbr")
@@ -123,28 +153,48 @@
create_vlan $VM_DEV $VM_VLAN $VM_NET
create_vlan $MGT_DEV $MGT_VLAN $MGT_NET
-# dom0 ip
-HOST_IP=${HOST_IP:-`ifconfig xenbr0 | grep "inet addr" | cut -d ":" -f2 | sed "s/ .*//"`}
-
-# Set up ip forwarding
-if ! grep -q "FORWARD_IPV4=YES" /etc/sysconfig/network; then
- # FIXME: This doesn't work on reboot!
- echo "FORWARD_IPV4=YES" >> /etc/sysconfig/network
+# Get final bridge names
+if [ -z $VM_BR ]; then
+ VM_BR=$(xe_min network-list uuid=$VM_NET params=bridge)
+fi
+if [ -z $MGT_BR ]; then
+ MGT_BR=$(xe_min network-list uuid=$MGT_NET params=bridge)
+fi
+if [ -z $PUB_BR ]; then
+ PUB_BR=$(xe_min network-list uuid=$PUB_NET params=bridge)
fi
+# dom0 ip, XenAPI is assumed to be listening
+HOST_IP=${HOST_IP:-`ifconfig xenbr0 | grep "inet addr" | cut -d ":" -f2 | sed "s/ .*//"`}
+
+# Set up ip forwarding, but skip on xcp-xapi
+if [ -a /etc/sysconfig/network]; then
+ if ! grep -q "FORWARD_IPV4=YES" /etc/sysconfig/network; then
+ # FIXME: This doesn't work on reboot!
+ echo "FORWARD_IPV4=YES" >> /etc/sysconfig/network
+ fi
+fi
# Also, enable ip forwarding in rc.local, since the above trick isn't working
if ! grep -q "echo 1 >/proc/sys/net/ipv4/ip_forward" /etc/rc.local; then
echo "echo 1 >/proc/sys/net/ipv4/ip_forward" >> /etc/rc.local
fi
-
# Enable ip forwarding at runtime as well
echo 1 > /proc/sys/net/ipv4/ip_forward
+
+#
# Shutdown previous runs
+#
+
DO_SHUTDOWN=${DO_SHUTDOWN:-1}
+CLEAN_TEMPLATES=${CLEAN_TEMPLATES:-false}
if [ "$DO_SHUTDOWN" = "1" ]; then
# Shutdown all domU's that created previously
- xe_min vm-list name-label="$GUEST_NAME" | xargs ./scripts/uninstall-os-vpx.sh
+ clean_templates_arg=""
+ if $CLEAN_TEMPLATES; then
+ clean_templates_arg="--remove-templates"
+ fi
+ ./scripts/uninstall-os-vpx.sh $clean_templates_arg
# Destroy any instances that were launched
for uuid in `xe vm-list | grep -1 instance | grep uuid | sed "s/.*\: //g"`; do
@@ -160,34 +210,18 @@
done
fi
-# Start guest
-if [ -z $VM_BR ]; then
- VM_BR=$(xe_min network-list uuid=$VM_NET params=bridge)
-fi
-if [ -z $MGT_BR ]; then
- MGT_BR=$(xe_min network-list uuid=$MGT_NET params=bridge)
-fi
-if [ -z $PUB_BR ]; then
- PUB_BR=$(xe_min network-list uuid=$PUB_NET params=bridge)
-fi
-templateuuid=$(xe template-list name-label="$TNAME")
-if [ -n "$templateuuid" ]
-then
- vm_uuid=$(xe vm-install template="$TNAME" new-name-label="$GUEST_NAME")
-else
- template=$(xe_min template-list name-label="Ubuntu 11.10 (64-bit)")
- if [ -z "$template" ]
- then
- cp $TOP_DIR/devstackubuntupreseed.cfg /opt/xensource/www/
- $TOP_DIR/scripts/xenoneirictemplate.sh "${HOST_IP}/devstackubuntupreseed.cfg"
- MIRROR=${MIRROR:-archive.ubuntu.com}
- sed -e "s,d-i mirror/http/hostname string .*,d-i mirror/http/hostname string $MIRROR," \
- -i /opt/xensource/www/devstackubuntupreseed.cfg
- fi
- $TOP_DIR/scripts/install-os-vpx.sh -t "Ubuntu 11.10 (64-bit)" -v $VM_BR -m $MGT_BR -p $PUB_BR -l $GUEST_NAME -r $OSDOMU_MEM_MB -k "flat_network_bridge=${VM_BR}"
+#
+# Create Ubuntu VM template
+# and/or create VM from template
+#
- # Wait for install to finish
+GUEST_NAME=${GUEST_NAME:-"DevStackOSDomU"}
+TNAME="devstack_template_folsom_11.10"
+SNAME_PREPARED="template_prepared"
+SNAME_FIRST_BOOT="before_first_boot"
+
+function wait_for_VM_to_halt() {
while true
do
state=$(xe_min vm-list name-label="$GUEST_NAME" power-state=halted)
@@ -196,72 +230,199 @@
break
else
echo "Waiting for "$GUEST_NAME" to finish installation..."
- sleep 30
+ sleep 20
fi
done
+}
+templateuuid=$(xe template-list name-label="$TNAME")
+if [ -z "$templateuuid" ]; then
+ #
+ # Install Ubuntu over network
+ #
+
+ # try to find ubuntu template
+ ubuntu_template_name="Ubuntu 11.10 for DevStack (64-bit)"
+ ubuntu_template=$(xe_min template-list name-label="$ubuntu_template_name")
+
+ # remove template, if we are in CLEAN_TEMPLATE mode
+ if [ -n "$ubuntu_template" ]; then
+ if $CLEAN_TEMPLATES; then
+ xe template-param-clear param-name=other-config uuid=$ubuntu_template
+ xe template-uninstall template-uuid=$ubuntu_template force=true
+ ubuntu_template=""
+ fi
+ fi
+
+ # always update the preseed file, incase we have a newer one
+ PRESEED_URL=${PRESEED_URL:-""}
+ if [ -z "$PRESEED_URL" ]; then
+ PRESEED_URL="${HOST_IP}/devstackubuntupreseed.cfg"
+ HTTP_SERVER_LOCATION="/opt/xensource/www"
+ if [ ! -e $HTTP_SERVER_LOCATION ]; then
+ HTTP_SERVER_LOCATION="/var/www/html"
+ mkdir -p $HTTP_SERVER_LOCATION
+ fi
+ cp -f $TOP_DIR/devstackubuntupreseed.cfg $HTTP_SERVER_LOCATION
+ MIRROR=${MIRROR:-""}
+ if [ -n "$MIRROR" ]; then
+ sed -e "s,d-i mirror/http/hostname string .*,d-i mirror/http/hostname string $MIRROR," \
+ -i "${HTTP_SERVER_LOCATION}/devstackubuntupreseed.cfg"
+ fi
+ fi
+
+ if [ -z "$ubuntu_template" ]; then
+ $TOP_DIR/scripts/xenoneirictemplate.sh $PRESEED_URL
+ fi
+
+ # create a new VM with the given template
+ # creating the correct VIFs and metadata
+ $TOP_DIR/scripts/install-os-vpx.sh -t "$ubuntu_template_name" -v $VM_BR -m $MGT_BR -p $PUB_BR -l $GUEST_NAME -r $OSDOMU_MEM_MB -k "flat_network_bridge=${VM_BR}"
+
+ # wait for install to finish
+ wait_for_VM_to_halt
+
+ # set VM to restart after a reboot
vm_uuid=$(xe_min vm-list name-label="$GUEST_NAME")
xe vm-param-set actions-after-reboot=Restart uuid="$vm_uuid"
+ #
+ # Prepare VM for DevStack
+ #
+
+ # Install XenServer tools, and other such things
+ $TOP_DIR/prepare_guest_template.sh "$GUEST_NAME"
+
+ # start the VM to run the prepare steps
+ xe vm-start vm="$GUEST_NAME"
+
+ # Wait for prep script to finish and shutdown system
+ wait_for_VM_to_halt
+
# Make template from VM
- snuuid=$(xe vm-snapshot vm="$GUEST_NAME" new-name-label="$SNAME")
- template_uuid=$(xe snapshot-clone uuid=$snuuid new-name-label="$TNAME")
+ snuuid=$(xe vm-snapshot vm="$GUEST_NAME" new-name-label="$SNAME_PREPARED")
+ xe snapshot-clone uuid=$snuuid new-name-label="$TNAME"
+else
+ #
+ # Template already installed, create VM from template
+ #
+ vm_uuid=$(xe vm-install template="$TNAME" new-name-label="$GUEST_NAME")
fi
+
+#
+# Inject DevStack inside VM disk
+#
$TOP_DIR/build_xva.sh "$GUEST_NAME"
+# create a snapshot before the first boot
+# to allow a quick re-run with the same settings
+xe vm-snapshot vm="$GUEST_NAME" new-name-label="$SNAME_FIRST_BOOT"
+
+
+#
+# Run DevStack VM
+#
xe vm-start vm="$GUEST_NAME"
-if [ $PUB_IP == "dhcp" ]; then
- PUB_IP=$(xe_min vm-list name-label=$GUEST_NAME params=networks | sed -ne 's,^.*3/ip: \([0-9.]*\).*$,\1,p')
+
+#
+# Find IP and optionally wait for stack.sh to complete
+#
+
+function find_ip_by_name() {
+ local guest_name="$1"
+ local interface="$2"
+ local period=10
+ max_tries=10
+ i=0
+ while true
+ do
+ if [ $i -ge $max_tries ]; then
+ echo "Timed out waiting for devstack ip address"
+ exit 11
+ fi
+
+ devstackip=$(xe vm-list --minimal \
+ name-label=$guest_name \
+ params=networks | sed -ne "s,^.*${interface}/ip: \([0-9.]*\).*\$,\1,p")
+ if [ -z "$devstackip" ]
+ then
+ sleep $period
+ ((i++))
+ else
+ echo $devstackip
+ break
+ fi
+ done
+}
+
+function ssh_no_check() {
+ ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no "$@"
+}
+
+# Note the XenServer needs to be on the chosen
+# network, so XenServer can access Glance API
+if [ $HOST_IP_IFACE == "eth2" ]; then
+ DOMU_IP=$MGT_IP
+ if [ $MGT_IP == "dhcp" ]; then
+ DOMU_IP=$(find_ip_by_name $GUEST_NAME 2)
+ fi
+else
+ DOMU_IP=$PUB_IP
+ if [ $PUB_IP == "dhcp" ]; then
+ DOMU_IP=$(find_ip_by_name $GUEST_NAME 3)
+ fi
fi
# If we have copied our ssh credentials, use ssh to monitor while the installation runs
WAIT_TILL_LAUNCH=${WAIT_TILL_LAUNCH:-1}
+COPYENV=${COPYENV:-1}
if [ "$WAIT_TILL_LAUNCH" = "1" ] && [ -e ~/.ssh/id_rsa.pub ] && [ "$COPYENV" = "1" ]; then
- # Done creating the container, let's tail the log
- echo
- echo "============================================================="
- echo " -- YAY! --"
- echo "============================================================="
- echo
echo "We're done launching the vm, about to start tailing the"
echo "stack.sh log. It will take a second or two to start."
echo
echo "Just CTRL-C at any time to stop tailing."
- set +o xtrace
-
- while ! ssh -q stack@$PUB_IP "[ -e run.sh.log ]"; do
- sleep 1
+ # wait for log to appear
+ while ! ssh_no_check -q stack@$DOMU_IP "[ -e run.sh.log ]"; do
+ sleep 10
done
- ssh stack@$PUB_IP 'tail -f run.sh.log' &
-
+ # output the run.sh.log
+ ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no stack@$DOMU_IP 'tail -f run.sh.log' &
TAIL_PID=$!
function kill_tail() {
- kill $TAIL_PID
+ kill -9 $TAIL_PID
exit 1
}
-
# Let Ctrl-c kill tail and exit
trap kill_tail SIGINT
- echo "Waiting stack.sh to finish..."
- while ! ssh -q stack@$PUB_IP "grep -q 'stack.sh completed in' run.sh.log"; do
- sleep 1
+ # ensure we kill off the tail if we exit the script early
+ # for other reasons
+ add_on_exit "kill -9 $TAIL_PID || true"
+
+ # wait silently until stack.sh has finished
+ set +o xtrace
+ while ! ssh_no_check -q stack@$DOMU_IP "tail run.sh.log | grep -q 'stack.sh completed in'"; do
+ sleep 10
done
+ set -o xtrace
- kill $TAIL_PID
+ # kill the tail process now stack.sh has finished
+ kill -9 $TAIL_PID
- if ssh -q stack@$PUB_IP "grep -q 'stack.sh failed' run.sh.log"; then
+ # check for a failure
+ if ssh_no_check -q stack@$DOMU_IP "grep -q 'stack.sh failed' run.sh.log"; then
exit 1
fi
+ echo "################################################################################"
echo ""
- echo "Finished - Zip-a-dee Doo-dah!"
- echo "You can then visit the OpenStack Dashboard"
- echo "at http://$PUB_IP, and contact other services at the usual ports."
+ echo "All Finished!"
+ echo "You can visit the OpenStack Dashboard"
+ echo "at http://$DOMU_IP, and contact other services at the usual ports."
else
echo "################################################################################"
echo ""
@@ -269,10 +430,9 @@
echo "Now, you can monitor the progress of the stack.sh installation by "
echo "tailing /opt/stack/run.sh.log from within your domU."
echo ""
- echo "ssh into your domU now: 'ssh stack@$PUB_IP' using your password"
+ echo "ssh into your domU now: 'ssh stack@$DOMU_IP' using your password"
echo "and then do: 'tail -f /opt/stack/run.sh.log'"
echo ""
echo "When the script completes, you can then visit the OpenStack Dashboard"
- echo "at http://$PUB_IP, and contact other services at the usual ports."
-
+ echo "at http://$DOMU_IP, and contact other services at the usual ports."
fi
diff --git a/tools/xen/prepare_guest.sh b/tools/xen/prepare_guest.sh
index 74efaff..89a0169 100755
--- a/tools/xen/prepare_guest.sh
+++ b/tools/xen/prepare_guest.sh
@@ -1,6 +1,18 @@
#!/bin/bash
+# This script is run on an Ubuntu VM.
+# This script is inserted into the VM by prepare_guest_template.sh
+# and is run when that VM boots.
+# It customizes a fresh Ubuntu install, so it is ready
+# to run stack.sh
+#
+# This includes installing the XenServer tools,
+# creating the user called "stack",
+# and shuts down the VM to signal the script has completed
+
set -x
+# Echo commands
+set -o xtrace
# Configurable nuggets
GUEST_PASSWORD=${GUEST_PASSWORD:-secrete}
@@ -13,7 +25,7 @@
chroot $STAGING_DIR apt-get install -y curl wget ssh openssh-server python-pip git vim-nox sudo
chroot $STAGING_DIR pip install xenapi
-# Install guest utilities
+# Install XenServer guest utilities
XEGUEST=xe-guest-utilities_5.6.100-651_amd64.deb
wget http://images.ansolabs.com/xen/$XEGUEST -O $XEGUEST
cp $XEGUEST $STAGING_DIR/root
@@ -68,3 +80,12 @@
rm -f stage.tgz
tar cfz stage.tgz stage
fi
+
+# remove self from local.rc
+# so this script is not run again
+rm -rf /etc/rc.local
+mv /etc/rc.local.preparebackup /etc/rc.local
+cp $STAGING_DIR/etc/rc.local $STAGING_DIR/etc/rc.local.backup
+
+# shutdown to notify we are done
+shutdown -h now
diff --git a/tools/xen/prepare_guest_template.sh b/tools/xen/prepare_guest_template.sh
new file mode 100755
index 0000000..7c6dec4
--- /dev/null
+++ b/tools/xen/prepare_guest_template.sh
@@ -0,0 +1,57 @@
+#!/bin/bash
+
+# This script is run by install_os_domU.sh
+#
+# Parameters:
+# - $GUEST_NAME - hostname for the DomU VM
+#
+# It modifies the ubuntu image created by install_os_domU.sh
+#
+# This script is responsible for cusomtizing the fresh ubuntu
+# image so on boot it runs the prepare_guest.sh script
+# that modifies the VM so it is ready to run stack.sh.
+# It does this by mounting the disk image of the VM.
+#
+# The resultant image is started by install_os_domU.sh,
+# and once the VM has shutdown, build_xva.sh is run
+
+# Exit on errors
+set -o errexit
+# Echo commands
+set -o xtrace
+
+# This directory
+TOP_DIR=$(cd $(dirname "$0") && pwd)
+
+# Include onexit commands
+. $TOP_DIR/scripts/on_exit.sh
+
+# Source params - override xenrc params in your localrc to suite your taste
+source xenrc
+
+#
+# Parameters
+#
+GUEST_NAME="$1"
+
+# Mount the VDI
+STAGING_DIR=$($TOP_DIR/scripts/manage-vdi open $GUEST_NAME 0 1 | grep -o "/tmp/tmp.[[:alnum:]]*")
+add_on_exit "$TOP_DIR/scripts/manage-vdi close $GUEST_NAME 0 1"
+
+# Make sure we have a stage
+if [ ! -d $STAGING_DIR/etc ]; then
+ echo "Stage is not properly set up!"
+ exit 1
+fi
+
+# Copy prepare_guest.sh to VM
+mkdir -p $STAGING_DIR/opt/stack/
+cp $TOP_DIR/prepare_guest.sh $STAGING_DIR/opt/stack/prepare_guest.sh
+
+# backup rc.local
+cp $STAGING_DIR/etc/rc.local $STAGING_DIR/etc/rc.local.preparebackup
+
+# run prepare_guest.sh on boot
+cat <<EOF >$STAGING_DIR/etc/rc.local
+GUEST_PASSWORD=$GUEST_PASSWORD STAGING_DIR=/ DO_TGZ=0 bash /opt/stack/prepare_guest.sh > /opt/stack/prepare_guest.log 2>&1
+EOF
diff --git a/tools/xen/scripts/install-os-vpx.sh b/tools/xen/scripts/install-os-vpx.sh
index fe5e810..7f2f3e6 100755
--- a/tools/xen/scripts/install-os-vpx.sh
+++ b/tools/xen/scripts/install-os-vpx.sh
@@ -19,7 +19,12 @@
set -eux
-. /etc/xensource-inventory
+if [ -a /etc/xensource-inventory]
+then
+ . /etc/xensource-inventory
+else
+ . /etc/xcp/inventory
+fi
NAME="XenServer OpenStack VPX"
DATA_VDI_SIZE="500MiB"
diff --git a/tools/xen/scripts/manage-vdi b/tools/xen/scripts/manage-vdi
index a0a27e8..05c4b07 100755
--- a/tools/xen/scripts/manage-vdi
+++ b/tools/xen/scripts/manage-vdi
@@ -7,46 +7,80 @@
device="${3-0}"
part="${4-}"
-xe_min()
-{
+function xe_min() {
local cmd="$1"
shift
xe "$cmd" --minimal "$@"
}
+function run_udev_settle() {
+ which_udev=$(which udevsettle) || true
+ if [ -n "$which_udev" ]; then
+ udevsettle
+ else
+ udevadm settle
+ fi
+}
+
vm_uuid=$(xe_min vm-list name-label="$vm")
vdi_uuid=$(xe_min vbd-list params=vdi-uuid vm-uuid="$vm_uuid" \
userdevice="$device")
dom0_uuid=$(xe_min vm-list is-control-domain=true)
-open_vdi()
-{
+function get_mount_device() {
+ vbd_uuid=$1
+
+ dev=$(xe_min vbd-list params=device uuid="$vbd_uuid")
+ if [[ "$dev" =~ "sm/" ]]; then
+ DEBIAN_FRONTEND=noninteractive \
+ apt-get --option "Dpkg::Options::=--force-confold" --assume-yes \
+ install kpartx &> /dev/null || true
+ mapping=$(kpartx -av "/dev/$dev" | sed -ne 's,^add map \([a-z0-9\-]*\).*$,\1,p' | sed -ne "s,^\(.*${part}\)\$,\1,p")
+ if [ -z "$mapping" ]; then
+ echo "Failed to find mapping"
+ exit -1
+ fi
+ echo "/dev/mapper/${mapping}"
+ else
+ echo "/dev/$dev$part"
+ fi
+}
+
+function clean_dev_mappings() {
+ dev=$(xe_min vbd-list params=device uuid="$vbd_uuid")
+ if [[ "$dev" =~ "sm/" ]]; then
+ kpartx -dv "/dev/$dev"
+ fi
+}
+
+function open_vdi() {
vbd_uuid=$(xe vbd-create vm-uuid="$dom0_uuid" vdi-uuid="$vdi_uuid" \
device=autodetect)
mp=$(mktemp -d)
xe vbd-plug uuid="$vbd_uuid"
- udevsettle
- dev=$(xe_min vbd-list params=device uuid="$vbd_uuid")
- mount "/dev/$dev$part" "$mp"
+ run_udev_settle
+
+ mount_device=$(get_mount_device "$vbd_uuid")
+ mount "$mount_device" "$mp"
echo "Your vdi is mounted at $mp"
}
-close_vdi()
-{
+function close_vdi() {
vbd_uuid=$(xe_min vbd-list vm-uuid="$dom0_uuid" vdi-uuid="$vdi_uuid")
- dev=$(xe_min vbd-list params=device uuid="$vbd_uuid")
- umount "/dev/$dev$part"
+ mount_device=$(get_mount_device "$vbd_uuid")
+ run_udev_settle
+ umount "$mount_device"
+
+ clean_dev_mappings
xe vbd-unplug uuid=$vbd_uuid
xe vbd-destroy uuid=$vbd_uuid
}
-if [ "$action" == "open" ]
-then
+if [ "$action" == "open" ]; then
open_vdi
-elif [ "$action" == "close" ]
-then
+elif [ "$action" == "close" ]; then
close_vdi
fi
diff --git a/tools/xen/scripts/on_exit.sh b/tools/xen/scripts/on_exit.sh
new file mode 100755
index 0000000..a4db39c
--- /dev/null
+++ b/tools/xen/scripts/on_exit.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+set -e
+set -o xtrace
+
+declare -a on_exit_hooks
+
+on_exit()
+{
+ for i in $(seq $((${#on_exit_hooks[*]} - 1)) -1 0)
+ do
+ eval "${on_exit_hooks[$i]}"
+ done
+}
+
+add_on_exit()
+{
+ local n=${#on_exit_hooks[*]}
+ on_exit_hooks[$n]="$*"
+ if [[ $n -eq 0 ]]
+ then
+ trap on_exit EXIT
+ fi
+}
diff --git a/tools/xen/scripts/uninstall-os-vpx.sh b/tools/xen/scripts/uninstall-os-vpx.sh
index a82f3a0..0feaec7 100755
--- a/tools/xen/scripts/uninstall-os-vpx.sh
+++ b/tools/xen/scripts/uninstall-os-vpx.sh
@@ -17,19 +17,19 @@
# under the License.
#
-remove_data=
-if [ "$1" = "--remove-data" ]
-then
- remove_data=1
-fi
+set -ex
-set -eu
+# By default, don't remove the templates
+REMOVE_TEMPLATES=${REMOVE_TEMPLATES:-"false"}
+if [ "$1" = "--remove-templates" ]; then
+ REMOVE_TEMPLATES=true
+fi
xe_min()
{
local cmd="$1"
shift
- /opt/xensource/bin/xe "$cmd" --minimal "$@"
+ xe "$cmd" --minimal "$@"
}
destroy_vdi()
@@ -39,11 +39,8 @@
local dev=$(xe_min vbd-list uuid=$vbd_uuid params=userdevice)
local vdi_uuid=$(xe_min vbd-list uuid=$vbd_uuid params=vdi-uuid)
- if [ "$type" = 'Disk' ] && [ "$dev" != 'xvda' ] && [ "$dev" != '0' ]
- then
- echo -n "Destroying data disk... "
+ if [ "$type" == 'Disk' ] && [ "$dev" != 'xvda' ] && [ "$dev" != '0' ]; then
xe vdi-destroy uuid=$vdi_uuid
- echo "done."
fi
}
@@ -52,50 +49,36 @@
local vm_uuid="$1"
local power_state=$(xe_min vm-list uuid=$vm_uuid params=power-state)
- if [ "$power_state" != "halted" ]
- then
- echo -n "Shutting down VM... "
+ if [ "$power_state" != "halted" ]; then
xe vm-shutdown vm=$vm_uuid force=true
- echo "done."
fi
- if [ "$remove_data" = "1" ]
- then
- for v in $(xe_min vbd-list vm-uuid=$vm_uuid | sed -e 's/,/ /g')
- do
- destroy_vdi "$v"
- done
- fi
+ for v in $(xe_min vbd-list vm-uuid=$vm_uuid | sed -e 's/,/ /g'); do
+ destroy_vdi "$v"
+ done
- echo -n "Deleting VM... "
xe vm-uninstall vm=$vm_uuid force=true >/dev/null
- echo "done."
}
uninstall_template()
{
local vm_uuid="$1"
- if [ "$remove_data" = "1" ]
- then
- for v in $(xe_min vbd-list vm-uuid=$vm_uuid | sed -e 's/,/ /g')
- do
- destroy_vdi "$v"
- done
- fi
+ for v in $(xe_min vbd-list vm-uuid=$vm_uuid | sed -e 's/,/ /g'); do
+ destroy_vdi "$v"
+ done
- echo -n "Deleting template... "
xe template-uninstall template-uuid=$vm_uuid force=true >/dev/null
- echo "done."
}
-
-for u in $(xe_min vm-list other-config:os-vpx=true | sed -e 's/,/ /g')
-do
+# remove the VMs and their disks
+for u in $(xe_min vm-list other-config:os-vpx=true | sed -e 's/,/ /g'); do
uninstall "$u"
done
-for u in $(xe_min template-list other-config:os-vpx=true | sed -e 's/,/ /g')
-do
- uninstall_template "$u"
-done
+# remove the templates
+if [ "$REMOVE_TEMPLATES" == "true" ]; then
+ for u in $(xe_min template-list other-config:os-vpx=true | sed -e 's/,/ /g'); do
+ uninstall_template "$u"
+ done
+fi
diff --git a/tools/xen/scripts/xenoneirictemplate.sh b/tools/xen/scripts/xenoneirictemplate.sh
index 1d9ec5e..7f10c33 100755
--- a/tools/xen/scripts/xenoneirictemplate.sh
+++ b/tools/xen/scripts/xenoneirictemplate.sh
@@ -3,23 +3,27 @@
## on Xenserver 6.0.2 Net install only
## Original Author: David Markey <david.markey@citrix.com>
## Author: Renuka Apte <renuka.apte@citrix.com>
-## This is not an officially supported guest OS on XenServer 6.02
+## This is not an officially supported guest OS on XenServer 6.0.2
BASE_DIR=$(cd $(dirname "$0") && pwd)
source $BASE_DIR/../../../localrc
-LENNY=$(xe template-list name-label=Debian\ Lenny\ 5.0\ \(32-bit\) --minimal)
+LENNY=$(xe template-list name-label=Debian\ Squeeze\ 6.0\ \(32-bit\) --minimal)
if [[ -z $LENNY ]] ; then
- echo "Cant find lenny 32bit template, is this on 6.0.2?"
+ echo "Cant find Squeeze 32bit template."
exit 1
fi
-distro="Ubuntu 11.10"
+distro="Ubuntu 11.10 for DevStack"
arches=("32-bit" "64-bit")
preseedurl=${1:-"http://images.ansolabs.com/devstackubuntupreseed.cfg"}
+NETINSTALL_LOCALE=${NETINSTALL_LOCALE:-en_US}
+NETINSTALL_KEYBOARD=${NETINSTALL_KEYBOARD:-us}
+NETINSTALL_IFACE=${NETINSTALL_IFACE:-eth3}
+
for arch in ${arches[@]} ; do
echo "Attempting $distro ($arch)"
if [[ -n $(xe template-list name-label="$distro ($arch)" params=uuid --minimal) ]] ; then
@@ -30,7 +34,11 @@
echo "NETINSTALLIP not set in localrc"
exit 1
fi
- pvargs="-- quiet console=hvc0 partman/default_filesystem=ext3 locale=en_US console-setup/ask_detect=false keyboard-configuration/layoutcode=us netcfg/choose_interface=eth3 netcfg/get_hostname=os netcfg/get_domain=os auto url=${preseedurl}"
+ # Some of these settings can be found in example preseed files
+ # however these need to be answered before the netinstall
+ # is ready to fetch the preseed file, and as such must be here
+ # to get a fully automated install
+ pvargs="-- quiet console=hvc0 partman/default_filesystem=ext3 locale=${NETINSTALL_LOCALE} console-setup/ask_detect=false keyboard-configuration/layoutcode=${NETINSTALL_KEYBOARD} netcfg/choose_interface=${NETINSTALL_IFACE} netcfg/get_hostname=os netcfg/get_domain=os auto url=${preseedurl}"
if [ "$NETINSTALLIP" != "dhcp" ]
then
netcfgargs="netcfg/disable_autoconfig=true netcfg/get_nameservers=${NAMESERVERS} netcfg/get_ipaddress=${NETINSTALLIP} netcfg/get_netmask=${NETMASK} netcfg/get_gateway=${GATEWAY} netcfg/confirm_static=true"
diff --git a/tools/xen/templates/interfaces.in b/tools/xen/templates/interfaces.in
index e315a8c..74b41cc 100644
--- a/tools/xen/templates/interfaces.in
+++ b/tools/xen/templates/interfaces.in
@@ -21,6 +21,3 @@
iface eth2 inet static
address @ETH2_IP@
netmask @ETH2_NETMASK@
-
-auto eth0
-iface eth0 inet dhcp
diff --git a/tools/xen/xenrc b/tools/xen/xenrc
index f434b11..102a492 100644
--- a/tools/xen/xenrc
+++ b/tools/xen/xenrc
@@ -5,12 +5,15 @@
# Size of image
VDI_MB=${VDI_MB:-5000}
+OSDOMU_MEM_MB=1024
# VM Password
GUEST_PASSWORD=${GUEST_PASSWORD:-secrete}
-# Host Interface, i.e. the public facing interface on the nova vm
-HOST_IP_IFACE=${HOST_IP_IFACE:-eth0}
+# Host Interface, i.e. the interface on the nova vm you want to expose the services on
+# Usually either eth2 (management network) or eth3 (public network)
+# not eth0 (private network with XenServer host) or eth1 (VM traffic network)
+HOST_IP_IFACE=${HOST_IP_IFACE:-eth3}
# Our nova host's network info
VM_IP=${VM_IP:-10.255.255.255} # A host-only ip that let's the interface come up, otherwise unused
@@ -35,7 +38,8 @@
MGT_VLAN=${MGT_VLAN:-101}
MGT_DEV=${MGT_DEV:-eth0}
-OSDOMU_MEM_MB=1024
+# Guest installer network
+ENABLE_GI=true
# Source params
cd ../.. && source ./stackrc && cd $TOP_DIR
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