Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b47ced7456 | |||
| 988f5c32a2 | |||
| 30c0ef024b | |||
| 11e4cf3fe4 | |||
| edd62ccc3b | |||
| e40926df21 | |||
| 52de582cee | |||
| 66d47a27b4 | |||
| 4ec0a8aab1 | |||
| 1c809fb419 | |||
| 6bedba7902 | |||
| 7dd51e0c66 | |||
| fe08c5bfe4 |
@@ -0,0 +1,176 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
@@ -111,7 +111,7 @@ if [[ "$ENABLED_SERVICES" =~ "swift" ]]; then
|
||||
STATUS_SWIFT="Skipped"
|
||||
else
|
||||
echo -e "\nTest Swift"
|
||||
if swift $ARGS stat; then
|
||||
if swift $TENANT_ARG $ARGS stat; then
|
||||
STATUS_SWIFT="Succeeded"
|
||||
else
|
||||
STATUS_SWIFT="Failed"
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ screen
|
||||
unzip
|
||||
wget
|
||||
psmisc
|
||||
git-core
|
||||
git
|
||||
lsof # useful when debugging
|
||||
openssh-server
|
||||
vim-nox
|
||||
|
||||
+17
-17
@@ -56,19 +56,19 @@ ANOTHER_ROLE=$(get_id keystone role-create --name=anotherrole)
|
||||
|
||||
|
||||
# Add Roles to Users in Tenants
|
||||
keystone user-role-add --user $ADMIN_USER --role $ADMIN_ROLE --tenant_id $ADMIN_TENANT
|
||||
keystone user-role-add --user $ADMIN_USER --role $ADMIN_ROLE --tenant_id $DEMO_TENANT
|
||||
keystone user-role-add --user $DEMO_USER --role $ANOTHER_ROLE --tenant_id $DEMO_TENANT
|
||||
keystone user-role-add --user_id $ADMIN_USER --role_id $ADMIN_ROLE --tenant_id $ADMIN_TENANT
|
||||
keystone user-role-add --user_id $ADMIN_USER --role_id $ADMIN_ROLE --tenant_id $DEMO_TENANT
|
||||
keystone user-role-add --user_id $DEMO_USER --role_id $ANOTHER_ROLE --tenant_id $DEMO_TENANT
|
||||
|
||||
# TODO(termie): these two might be dubious
|
||||
keystone user-role-add --user $ADMIN_USER --role $KEYSTONEADMIN_ROLE --tenant_id $ADMIN_TENANT
|
||||
keystone user-role-add --user $ADMIN_USER --role $KEYSTONESERVICE_ROLE --tenant_id $ADMIN_TENANT
|
||||
keystone user-role-add --user_id $ADMIN_USER --role_id $KEYSTONEADMIN_ROLE --tenant_id $ADMIN_TENANT
|
||||
keystone user-role-add --user_id $ADMIN_USER --role_id $KEYSTONESERVICE_ROLE --tenant_id $ADMIN_TENANT
|
||||
|
||||
|
||||
# The Member role is used by Horizon and Swift so we need to keep it:
|
||||
MEMBER_ROLE=$(get_id keystone role-create --name=Member)
|
||||
keystone user-role-add --user $DEMO_USER --role $MEMBER_ROLE --tenant_id $DEMO_TENANT
|
||||
keystone user-role-add --user $DEMO_USER --role $MEMBER_ROLE --tenant_id $INVIS_TENANT
|
||||
keystone user-role-add --user_id $DEMO_USER --role_id $MEMBER_ROLE --tenant_id $DEMO_TENANT
|
||||
keystone user-role-add --user_id $DEMO_USER --role_id $MEMBER_ROLE --tenant_id $INVIS_TENANT
|
||||
|
||||
|
||||
# Configure service users/roles
|
||||
@@ -77,16 +77,16 @@ NOVA_USER=$(get_id keystone user-create --name=nova \
|
||||
--tenant_id $SERVICE_TENANT \
|
||||
--email=nova@example.com)
|
||||
keystone user-role-add --tenant_id $SERVICE_TENANT \
|
||||
--user $NOVA_USER \
|
||||
--role $ADMIN_ROLE
|
||||
--user_id $NOVA_USER \
|
||||
--role_id $ADMIN_ROLE
|
||||
|
||||
GLANCE_USER=$(get_id keystone user-create --name=glance \
|
||||
--pass="$SERVICE_PASSWORD" \
|
||||
--tenant_id $SERVICE_TENANT \
|
||||
--email=glance@example.com)
|
||||
keystone user-role-add --tenant_id $SERVICE_TENANT \
|
||||
--user $GLANCE_USER \
|
||||
--role $ADMIN_ROLE
|
||||
--user_id $GLANCE_USER \
|
||||
--role_id $ADMIN_ROLE
|
||||
|
||||
if [[ "$ENABLED_SERVICES" =~ "swift" ]]; then
|
||||
SWIFT_USER=$(get_id keystone user-create --name=swift \
|
||||
@@ -94,8 +94,8 @@ if [[ "$ENABLED_SERVICES" =~ "swift" ]]; then
|
||||
--tenant_id $SERVICE_TENANT \
|
||||
--email=swift@example.com)
|
||||
keystone user-role-add --tenant_id $SERVICE_TENANT \
|
||||
--user $SWIFT_USER \
|
||||
--role $ADMIN_ROLE
|
||||
--user_id $SWIFT_USER \
|
||||
--role_id $ADMIN_ROLE
|
||||
# Nova needs ResellerAdmin role to download images when accessing
|
||||
# swift through the s3 api. The admin role in swift allows a user
|
||||
# to act as an admin for their tenant, but ResellerAdmin is needed
|
||||
@@ -103,8 +103,8 @@ if [[ "$ENABLED_SERVICES" =~ "swift" ]]; then
|
||||
# configurable in swift-proxy.conf
|
||||
RESELLER_ROLE=$(get_id keystone role-create --name=ResellerAdmin)
|
||||
keystone user-role-add --tenant_id $SERVICE_TENANT \
|
||||
--user $NOVA_USER \
|
||||
--role $RESELLER_ROLE
|
||||
--user_id $NOVA_USER \
|
||||
--role_id $RESELLER_ROLE
|
||||
fi
|
||||
|
||||
if [[ "$ENABLED_SERVICES" =~ "quantum" ]]; then
|
||||
@@ -113,6 +113,6 @@ if [[ "$ENABLED_SERVICES" =~ "quantum" ]]; then
|
||||
--tenant_id $SERVICE_TENANT \
|
||||
--email=quantum@example.com)
|
||||
keystone user-role-add --tenant_id $SERVICE_TENANT \
|
||||
--user $QUANTUM_USER \
|
||||
--role $ADMIN_ROLE
|
||||
--user_id $QUANTUM_USER \
|
||||
--role_id $ADMIN_ROLE
|
||||
fi
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
prettytable==0.5
|
||||
@@ -293,7 +293,7 @@ function read_password {
|
||||
if [ "$VIRT_DRIVER" = 'xenserver' ]; then
|
||||
PUBLIC_INTERFACE_DEFAULT=eth3
|
||||
# allow build_domU.sh to specify the flat network bridge via kernel args
|
||||
FLAT_NETWORK_BRIDGE_DEFAULT=$(grep -o 'flat_network_bridge=[^.]*' /proc/cmdline | cut -d= -f 2)
|
||||
FLAT_NETWORK_BRIDGE_DEFAULT=$(grep -o 'flat_network_bridge=[[:alnum:]]*' /proc/cmdline | cut -d= -f 2 | sort -u)
|
||||
GUEST_INTERFACE_DEFAULT=eth1
|
||||
else
|
||||
PUBLIC_INTERFACE_DEFAULT=br100
|
||||
@@ -589,13 +589,13 @@ function get_packages() {
|
||||
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%#*}
|
||||
|
||||
@@ -11,31 +11,27 @@ ENABLED_SERVICES=g-api,g-reg,key,n-api,n-crt,n-obj,n-cpu,n-net,n-vol,n-sch,n-nov
|
||||
|
||||
# compute service
|
||||
NOVA_REPO=https://github.com/openstack/nova.git
|
||||
NOVA_BRANCH=master
|
||||
NOVA_BRANCH=stable/essex
|
||||
|
||||
# storage service
|
||||
SWIFT_REPO=https://github.com/openstack/swift.git
|
||||
SWIFT_BRANCH=master
|
||||
|
||||
# swift and keystone integration
|
||||
SWIFT_KEYSTONE_REPO=https://github.com/cloudbuilders/swift-keystone2.git
|
||||
SWIFT_KEYSTONE_BRANCH=master
|
||||
SWIFT_BRANCH=stable/essex
|
||||
|
||||
# image catalog service
|
||||
GLANCE_REPO=https://github.com/openstack/glance.git
|
||||
GLANCE_BRANCH=master
|
||||
GLANCE_BRANCH=stable/essex
|
||||
|
||||
# unified auth system (manages accounts/tokens)
|
||||
KEYSTONE_REPO=https://github.com/openstack/keystone.git
|
||||
KEYSTONE_BRANCH=master
|
||||
KEYSTONE_BRANCH=stable/essex
|
||||
|
||||
# a websockets/html5 or flash powered VNC console for vm instances
|
||||
NOVNC_REPO=https://github.com/cloudbuilders/noVNC.git
|
||||
NOVNC_REPO=https://github.com/kanaka/noVNC.git
|
||||
NOVNC_BRANCH=master
|
||||
|
||||
# django powered web control panel for openstack
|
||||
HORIZON_REPO=https://github.com/openstack/horizon.git
|
||||
HORIZON_BRANCH=master
|
||||
HORIZON_BRANCH=stable/essex
|
||||
|
||||
# python client library to nova that horizon (and others) use
|
||||
NOVACLIENT_REPO=https://github.com/openstack/python-novaclient.git
|
||||
@@ -47,7 +43,7 @@ KEYSTONECLIENT_BRANCH=master
|
||||
|
||||
# quantum service
|
||||
QUANTUM_REPO=https://github.com/openstack/quantum
|
||||
QUANTUM_BRANCH=master
|
||||
QUANTUM_BRANCH=stable/essex
|
||||
|
||||
# quantum client
|
||||
QUANTUM_CLIENT_REPO=https://github.com/openstack/python-quantumclient
|
||||
|
||||
+61
-187
@@ -2,10 +2,22 @@
|
||||
#
|
||||
# configure_tempest.sh - Build a tempest configuration file from devstack
|
||||
|
||||
echo "**************************************************"
|
||||
echo "Configuring Tempest"
|
||||
echo "**************************************************"
|
||||
|
||||
# This script exits on an error so that errors don't compound and you see
|
||||
# only the first error that occured.
|
||||
set -o errexit
|
||||
|
||||
# Print the commands being run so that we can see the command that triggers
|
||||
# an error. It is also useful for following allowing as the install occurs.
|
||||
set -o xtrace
|
||||
|
||||
function usage {
|
||||
echo "$0 - Build tempest.conf"
|
||||
echo ""
|
||||
echo "Usage: $0 [configdir]"
|
||||
echo "Usage: $0"
|
||||
exit 1
|
||||
}
|
||||
|
||||
@@ -13,21 +25,6 @@ if [ "$1" = "-h" ]; then
|
||||
usage
|
||||
fi
|
||||
|
||||
# Clean up any resources that may be in use
|
||||
cleanup() {
|
||||
set +o errexit
|
||||
|
||||
# Mop up temporary files
|
||||
if [ -n "$CONFIG_INI_TMP" -a -e "$CONFIG_INI_TMP" ]; then
|
||||
rm -f $CONFIG_INI_TMP
|
||||
fi
|
||||
|
||||
# Kill ourselves to signal any calling process
|
||||
trap 2; kill -2 $$
|
||||
}
|
||||
|
||||
trap cleanup SIGHUP SIGINT SIGTERM SIGQUIT EXIT
|
||||
|
||||
# Keep track of the current directory
|
||||
TOOLS_DIR=$(cd $(dirname "$0") && pwd)
|
||||
TOP_DIR=$(cd $TOOLS_DIR/..; pwd)
|
||||
@@ -37,44 +34,26 @@ TOP_DIR=$(cd $TOOLS_DIR/..; pwd)
|
||||
|
||||
# Abort if localrc is not set
|
||||
if [ ! -e $TOP_DIR/localrc ]; then
|
||||
echo "You must have a localrc with ALL necessary passwords and configuration defined before proceeding."
|
||||
echo "See stack.sh for required passwords."
|
||||
echo "You must have a localrc with necessary basic configuration defined before proceeding."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Abort if openrc is not set
|
||||
if [ ! -e $TOP_DIR/openrc ]; then
|
||||
echo "You must have an openrc with ALL necessary passwords and credentials defined before proceeding."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Source params
|
||||
source ./stackrc
|
||||
|
||||
# Set defaults not configured by stackrc
|
||||
TENANT=${TENANT:-admin}
|
||||
USERNAME=${USERNAME:-admin}
|
||||
IDENTITY_HOST=${IDENTITY_HOST:-$HOST_IP}
|
||||
IDENTITY_PORT=${IDENTITY_PORT:-5000}
|
||||
IDENTITY_API_VERSION=${IDENTITY_API_VERSION:-2.0}
|
||||
source $TOP_DIR/openrc
|
||||
|
||||
# Where Openstack code lives
|
||||
DEST=${DEST:-/opt/stack}
|
||||
|
||||
TEMPEST_DIR=$DEST/tempest
|
||||
|
||||
CONFIG_DIR=${1:-$TEMPEST_DIR/etc}
|
||||
CONFIG_INI=$CONFIG_DIR/config.ini
|
||||
CONFIG_DIR=$TEMPEST_DIR/etc
|
||||
TEMPEST_CONF=$CONFIG_DIR/tempest.conf
|
||||
|
||||
if [ ! -f $DEST/.ramdisk ]; then
|
||||
# Process network configuration vars
|
||||
GUEST_NETWORK=${GUEST_NETWORK:-1}
|
||||
GUEST_RECREATE_NET=${GUEST_RECREATE_NET:-yes}
|
||||
|
||||
GUEST_IP=${GUEST_IP:-192.168.$GUEST_NETWORK.50}
|
||||
GUEST_CIDR=${GUEST_CIDR:-$GUEST_IP/24}
|
||||
GUEST_NETMASK=${GUEST_NETMASK:-255.255.255.0}
|
||||
GUEST_GATEWAY=${GUEST_GATEWAY:-192.168.$GUEST_NETWORK.1}
|
||||
GUEST_MAC=${GUEST_MAC:-"02:16:3e:07:69:`printf '%02X' $GUEST_NETWORK`"}
|
||||
GUEST_RAM=${GUEST_RAM:-1524288}
|
||||
GUEST_CORES=${GUEST_CORES:-1}
|
||||
fi
|
||||
|
||||
# Use the GUEST_IP unless an explicit IP is set by ``HOST_IP``
|
||||
HOST_IP=${HOST_IP:-$GUEST_IP}
|
||||
# Use the first IP if HOST_IP still is not set
|
||||
@@ -82,58 +61,25 @@ if [ ! -n "$HOST_IP" ]; then
|
||||
HOST_IP=`LC_ALL=C /sbin/ifconfig | grep -m 1 'inet addr:'| cut -d: -f2 | awk '{print $1}'`
|
||||
fi
|
||||
|
||||
RABBIT_HOST=${RABBIT_HOST:-localhost}
|
||||
|
||||
# Glance connection info. Note the port must be specified.
|
||||
GLANCE_HOSTPORT=${GLANCE_HOSTPORT:-$HOST_IP:9292}
|
||||
set `echo $GLANCE_HOSTPORT | tr ':' ' '`
|
||||
GLANCE_HOST=$1
|
||||
GLANCE_PORT=$2
|
||||
|
||||
# Set up downloaded images
|
||||
# Defaults to use first image
|
||||
|
||||
IMAGE_DIR=""
|
||||
IMAGE_NAME=""
|
||||
for imagedir in $TOP_DIR/files/images/*; do
|
||||
KERNEL=""
|
||||
RAMDISK=""
|
||||
IMAGE=""
|
||||
IMAGE_RAMDISK=""
|
||||
KERNEL=$(for f in "$imagedir/"*-vmlinuz*; do
|
||||
[ -f "$f" ] && echo "$f" && break; done; true)
|
||||
[ -n "$KERNEL" ] && ln -sf $KERNEL $imagedir/kernel
|
||||
RAMDISK=$(for f in "$imagedir/"*-initrd*; do
|
||||
[ -f "$f" ] && echo "$f" && break; done; true)
|
||||
[ -n "$RAMDISK" ] && ln -sf $RAMDISK $imagedir/ramdisk && \
|
||||
IMAGE_RAMDISK="ari_location = $imagedir/ramdisk"
|
||||
IMAGE=$(for f in "$imagedir/"*.img; do
|
||||
[ -f "$f" ] && echo "$f" && break; done; true)
|
||||
if [ -n "$IMAGE" ]; then
|
||||
ln -sf $IMAGE $imagedir/disk
|
||||
# Save the first image directory that contains a disk image link
|
||||
if [ -z "$IMAGE_DIR" ]; then
|
||||
IMAGE_DIR=$imagedir
|
||||
IMAGE_NAME=$(basename ${IMAGE%.img})
|
||||
fi
|
||||
fi
|
||||
done
|
||||
if [[ -n "$IMAGE_NAME" ]]; then
|
||||
# Get the image UUID
|
||||
IMAGE_UUID=$(nova image-list | grep " $IMAGE_NAME " | cut -d'|' -f2)
|
||||
# Strip spaces off
|
||||
IMAGE_UUID=$(echo $IMAGE_UUID)
|
||||
# Hacky way of getting first ami image
|
||||
IMAGE_UUID=`glance index | egrep ami | head -1 | cut -d" " -f1`
|
||||
IMAGE_UUID_ALT=$IMAGE_UUID
|
||||
if [[ $NUM_IMAGES -gt 1 ]]; then
|
||||
IMAGE_UUID_ALT=${IMAGES[1]}
|
||||
fi
|
||||
|
||||
# Create tempest.conf from tempest.conf.tpl
|
||||
# copy every time, because the image UUIDS are going to change
|
||||
cp $TEMPEST_CONF.tpl $TEMPEST_CONF
|
||||
|
||||
if [[ ! -r $TEMPEST_CONF ]]; then
|
||||
cp $TEMPEST_CONF.tpl $TEMPEST_CONF
|
||||
fi
|
||||
ADMIN_USERNAME=${ADMIN_USERNAME:-admin}
|
||||
ADMIN_PASSWORD=${ADMIN_PASSWORD:-secrete}
|
||||
ADMIN_TENANT_NAME=${ADMIN_TENANT:-admin}
|
||||
|
||||
IDENTITY_USE_SSL=${IDENTITY_USE_SSL:-False}
|
||||
IDENTITY_HOST=${IDENTITY_HOST:-127.0.0.1}
|
||||
IDENTITY_PORT=${IDENTITY_PORT:-5000}
|
||||
IDENTITY_API_VERSION={$IDENTITY_API_VERSION:-v2.0} # Note: need v for now...
|
||||
IDENTITY_API_VERSION="v2.0" # Note: need v for now...
|
||||
# TODO(jaypipes): This is dumb and needs to be removed
|
||||
# from the Tempest configuration file entirely...
|
||||
IDENTITY_PATH=${IDENTITY_PATH:-tokens}
|
||||
@@ -144,35 +90,35 @@ IDENTITY_STRATEGY=${IDENTITY_STRATEGY:-keystone}
|
||||
# OS_USERNAME et all should be defined in openrc.
|
||||
OS_USERNAME=${OS_USERNAME:-demo}
|
||||
OS_TENANT_NAME=${OS_TENANT_NAME:-demo}
|
||||
OS_PASSWORD=${OS_PASSWORD:-secrete}
|
||||
OS_PASSWORD=${OS_PASSWORD:$ADMIN_PASSWORD}
|
||||
|
||||
# TODO(jaypipes): Support multiple regular user accounts instead
|
||||
# of using the same regular user account for the alternate user...
|
||||
ALT_USERNAME=$OS_USERNAME
|
||||
# See files/keystone_data.sh where alt_demo user
|
||||
# and tenant are set up...
|
||||
ALT_USERNAME=${ALT_USERNAME:-alt_demo}
|
||||
ALT_TENANT_NAME=${ALT_TENANT_NAME:-alt_demo}
|
||||
ALT_PASSWORD=$OS_PASSWORD
|
||||
ALT_TENANT_NAME=$OS_TENANT_NAME
|
||||
|
||||
# TODO(jaypipes): Support multiple images instead of plopping
|
||||
# the IMAGE_UUID into both the image_ref and image_ref_alt slots
|
||||
IMAGE_UUID_ALT=$IMAGE_UUID
|
||||
|
||||
# TODO(jaypipes): Support configurable flavor refs here...
|
||||
FLAVOR_REF=1
|
||||
FLAVOR_REF_ALT=2
|
||||
|
||||
ADMIN_USERNAME={$ADMIN_USERNAME:-admin}
|
||||
ADMIN_PASSWORD={$ADMIN_PASSWORD:-secrete}
|
||||
ADMIN_TENANT_NAME={$ADMIN_TENANT:-admin}
|
||||
|
||||
# Do any of the following need to be configurable?
|
||||
COMPUTE_CATALOG_TYPE=compute
|
||||
COMPUTE_CREATE_IMAGE_ENABLED=True
|
||||
COMPUTE_RESIZE_AVAILABLE=True
|
||||
COMPUTE_RESIZE_AVAILABLE=False # not supported with QEMU...
|
||||
COMPUTE_CHANGE_PASSWORD_AVAILABLE=False # not supported with QEMU...
|
||||
COMPUTE_LOG_LEVEL=ERROR
|
||||
BUILD_INTERVAL=10
|
||||
BUILD_TIMEOUT=600
|
||||
|
||||
# Image test configuration options...
|
||||
IMAGE_HOST=${IMAGE_HOST:-127.0.0.1}
|
||||
IMAGE_PORT=${IMAGE_PORT:-9292}
|
||||
IMAGE_API_VERSION="1"
|
||||
|
||||
sed -e "
|
||||
s,%IDENTITY_USE_SSL%,$IDENTITY_USE_SSL,g;
|
||||
s,%IDENTITY_HOST%,$HOST_IP,g;
|
||||
s,%IDENTITY_HOST%,$IDENTITY_HOST,g;
|
||||
s,%IDENTITY_PORT%,$IDENTITY_PORT,g;
|
||||
s,%IDENTITY_API_VERSION%,$IDENTITY_API_VERSION,g;
|
||||
s,%IDENTITY_PATH%,$IDENTITY_PATH,g;
|
||||
@@ -186,98 +132,26 @@ sed -e "
|
||||
s,%COMPUTE_CATALOG_TYPE%,$COMPUTE_CATALOG_TYPE,g;
|
||||
s,%COMPUTE_CREATE_IMAGE_ENABLED%,$COMPUTE_CREATE_IMAGE_ENABLED,g;
|
||||
s,%COMPUTE_RESIZE_AVAILABLE%,$COMPUTE_RESIZE_AVAILABLE,g;
|
||||
s,%COMPUTE_CHANGE_PASSWORD_AVAILABLE%,$COMPUTE_CHANGE_PASSWORD_AVAILABLE,g;
|
||||
s,%COMPUTE_LOG_LEVEL%,$COMPUTE_LOG_LEVEL,g;
|
||||
s,%BUILD_INTERVAL%,$BUILD_INTERVAL,g;
|
||||
s,%BUILD_TIMEOUT%,$BUILD_TIMEOUT,g;
|
||||
s,%IMAGE_ID%,$IMAGE_UUID,g;
|
||||
s,%IMAGE_ID_ALT%,$IMAGE_UUID_ALT,g;
|
||||
s,%FLAVOR_REF%,$FLAVOR_REF,g;
|
||||
s,%FLAVOR_REF_ALT%,$FLAVOR_REF_ALT,g;
|
||||
s,%IMAGE_HOST%,$IMAGE_HOST,g;
|
||||
s,%IMAGE_PORT%,$IMAGE_PORT,g;
|
||||
s,%IMAGE_API_VERSION%,$IMAGE_API_VERSION,g;
|
||||
s,%ADMIN_USERNAME%,$ADMIN_USERNAME,g;
|
||||
s,%ADMIN_PASSWORD%,$ADMIN_PASSWORD,g;
|
||||
s,%ADMIN_TENANT_NAME%,$ADMIN_TENANT_NAME,g;
|
||||
" -i $TEMPEST_CONF
|
||||
|
||||
# Create config.ini
|
||||
echo "Created tempest configuration file:"
|
||||
cat $TEMPEST_CONF
|
||||
|
||||
CONFIG_INI_TMP=$(mktemp $CONFIG_INI.XXXXXX)
|
||||
if [ "$UPLOAD_LEGACY_TTY" ]; then
|
||||
cat >$CONFIG_INI_TMP <<EOF
|
||||
[environment]
|
||||
aki_location = $TOP_DIR/files/images/aki-tty/image
|
||||
ari_location = $TOP_DIR/files/images/ari-tty/image
|
||||
ami_location = $TOP_DIR/files/images/ami-tty/image
|
||||
image_ref = 3
|
||||
image_ref_alt = 3
|
||||
flavor_ref = 1
|
||||
flavor_ref_alt = 2
|
||||
|
||||
[glance]
|
||||
host = $GLANCE_HOST
|
||||
apiver = v1
|
||||
port = $GLANCE_PORT
|
||||
image_id = 3
|
||||
image_id_alt = 3
|
||||
tenant_id = 1
|
||||
EOF
|
||||
else
|
||||
cat >$CONFIG_INI_TMP <<EOF
|
||||
[environment]
|
||||
aki_location = $IMAGE_DIR/kernel
|
||||
ami_location = $IMAGE_DIR/disk
|
||||
$IMAGE_RAMDISK
|
||||
image_ref = 2
|
||||
image_ref_alt = 2
|
||||
flavor_ref = 1
|
||||
flavor_ref_alt = 2
|
||||
|
||||
[glance]
|
||||
host = $GLANCE_HOST
|
||||
apiver = v1
|
||||
port = $GLANCE_PORT
|
||||
image_id = 2
|
||||
image_id_alt = 2
|
||||
tenant_id = 1
|
||||
EOF
|
||||
fi
|
||||
|
||||
cat >>$CONFIG_INI_TMP <<EOF
|
||||
|
||||
[keystone]
|
||||
service_host = $HOST_IP
|
||||
service_port = 5000
|
||||
apiver = v2.0
|
||||
user = admin
|
||||
password = $ADMIN_PASSWORD
|
||||
tenant_name = admin
|
||||
|
||||
[nova]
|
||||
host = $HOST_IP
|
||||
port = 8774
|
||||
apiver = v1.1
|
||||
project = admin
|
||||
user = admin
|
||||
key = $ADMIN_PASSWORD
|
||||
ssh_timeout = 300
|
||||
build_timeout = 300
|
||||
flavor_ref = 1
|
||||
flavor_ref_alt = 2
|
||||
multi_node = no
|
||||
|
||||
[rabbitmq]
|
||||
host = $RABBIT_HOST
|
||||
user = guest
|
||||
password = $RABBIT_PASSWORD
|
||||
|
||||
[swift]
|
||||
auth_host = $HOST_IP
|
||||
auth_port = 443
|
||||
auth_prefix = /auth/
|
||||
auth_ssl = yes
|
||||
account = system
|
||||
username = root
|
||||
password = password
|
||||
|
||||
EOF
|
||||
mv $CONFIG_INI_TMP $CONFIG_INI
|
||||
CONFIG_INI_TMP=""
|
||||
|
||||
trap - SIGHUP SIGINT SIGTERM SIGQUIT EXIT
|
||||
echo "\n"
|
||||
echo "**************************************************"
|
||||
echo "Finished Configuring Tempest"
|
||||
echo "**************************************************"
|
||||
|
||||
+30
-43
@@ -1,7 +1,7 @@
|
||||
Getting Started With XenServer 5.6 and Devstack
|
||||
===============================================
|
||||
The purpose of the code in this directory it to help developers bootstrap
|
||||
a XenServer 5.6 + Openstack development environment. This file gives
|
||||
a XenServer 5.6 (or greater) + Openstack development environment. This file gives
|
||||
some pointers on how to get started.
|
||||
|
||||
Xenserver is a Type 1 hypervisor, so it needs to be installed on bare metal.
|
||||
@@ -25,36 +25,25 @@ getting started (I use settings like this with a lappy + cheap wifi router):
|
||||
* XenServer Gateway: 192.168.1.1
|
||||
* XenServer DNS: 192.168.1.1
|
||||
|
||||
Note:
|
||||
------
|
||||
It is advisable (and necessary if you are using Xenserver 6.0, due to space
|
||||
limitations), to create the above mentioned OS domU, on a separate dev machine.
|
||||
To do this, you will need to run Steps 2 on the dev machine (if required) as
|
||||
well as the Xenserver host. Steps 3 and 4 should be run on the dev machine.
|
||||
This process requires you to be root on the dev machine.
|
||||
Step 2: Download devstack
|
||||
--------------------------
|
||||
On your XenServer host, run the following commands as root:
|
||||
|
||||
Step 2: Prepare DOM0
|
||||
-------------------
|
||||
At this point, your host is missing some critical software that you will
|
||||
need to run devstack (like git). Do this to install required software:
|
||||
wget --no-check-certificate https://github.com/openstack-dev/devstack/zipball/master
|
||||
unzip -o master -d ./devstack
|
||||
cd devstack/*/
|
||||
|
||||
wget --no-check-certificate https://raw.github.com/openstack-dev/devstack/master/tools/xen/prepare_dom0.sh
|
||||
chmod 755 prepare_dom0.sh
|
||||
./prepare_dom0.sh
|
||||
|
||||
This step will also clone devstack in $DEVSTACKSRCROOT/devstack.
|
||||
$DEVSTACKSRCROOT=/root by default.
|
||||
|
||||
Step 3: Configure your localrc
|
||||
-----------------------------
|
||||
Step 3: Configure your localrc inside the devstack directory
|
||||
------------------------------------------------------------
|
||||
Devstack uses a localrc for user-specific configuration. Note that
|
||||
the XENAPI_PASSWORD must be your dom0 root password.
|
||||
Of course, use real passwords if this machine is exposed.
|
||||
|
||||
cat > $DEVSTACKSRCROOT/devstack/localrc <<EOF
|
||||
cat > ./localrc <<EOF
|
||||
MYSQL_PASSWORD=my_super_secret
|
||||
SERVICE_TOKEN=my_super_secret
|
||||
ADMIN_PASSWORD=my_super_secret
|
||||
SERVICE_PASSWORD=$ADMIN_PASSWORD
|
||||
RABBIT_PASSWORD=my_super_secret
|
||||
# This is the password for your guest (for both stack and root users)
|
||||
GUEST_PASSWORD=my_super_secret
|
||||
@@ -70,33 +59,31 @@ Of course, use real passwords if this machine is exposed.
|
||||
ACTIVE_TIMEOUT=45
|
||||
# Interface on which you would like to access services
|
||||
HOST_IP_IFACE=ethX
|
||||
# First time Ubuntu network install params
|
||||
NETINSTALLIP="dhcp"
|
||||
NAMESERVERS=""
|
||||
NETMASK=""
|
||||
GATEWAY=""
|
||||
EOF
|
||||
|
||||
Step 4: Run ./build_xva.sh
|
||||
--------------------------
|
||||
This script prepares your nova xva image. If you run this on a different machine,
|
||||
copy the resulting xva file to tools/xen/xvas/[GUEST_NAME].xva
|
||||
(by default tools/xen/xvas/ALLINONE.xva) on the Xenserver host.
|
||||
Step 4: Run ./install_os_domU.sh from the tools/xen directory
|
||||
-------------------------------------------------------------
|
||||
cd tools/xen
|
||||
./install_os_domU.sh
|
||||
|
||||
cd $DEVSTACKSRCROOT/devstack/tools/xen
|
||||
./build_xva.sh
|
||||
Once this script finishes executing, log into the VM (openstack domU)
|
||||
that it installed and tail the run.sh.log file. You will need to wait
|
||||
until it run.sh has finished executing.
|
||||
|
||||
You will also need to copy your localrc to the Xenserver host.
|
||||
|
||||
Step 5: Run ./build_domU.sh
|
||||
--------------------------
|
||||
This script does a lot of stuff, it is probably best to read it in its entirety.
|
||||
But in a nutshell, it performs the following:
|
||||
|
||||
* Configures bridges and vlans for public, private, and management nets
|
||||
* Creates and installs a OpenStack all-in-one domU in an HA-FlatDHCP configuration
|
||||
* A script to create a multi-domU (ie. head node separated from compute) configuration is coming soon!
|
||||
|
||||
cd $DEVSTACKSRCROOT/devstack/tools/xen
|
||||
./build_domU.sh
|
||||
|
||||
Step 6: Do cloudy stuff!
|
||||
Step 5: Do cloudy stuff!
|
||||
--------------------------
|
||||
* 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"
|
||||
|
||||
@@ -1,244 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 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
|
||||
|
||||
# This directory
|
||||
TOP_DIR=$(cd $(dirname "$0") && pwd)
|
||||
|
||||
# Source lower level functions
|
||||
. $TOP_DIR/../../functions
|
||||
|
||||
# Source params - override xenrc params in your localrc to suit your taste
|
||||
source xenrc
|
||||
|
||||
# Echo commands
|
||||
set -o xtrace
|
||||
|
||||
# Check for xva file
|
||||
if [ ! -e $XVA ]; then
|
||||
echo "Missing xva file. Please run build_xva.sh (ideally on a non dom0 host since the build can require lots of space)."
|
||||
echo "Place the resulting xva file in $XVA"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Make sure we have git
|
||||
if ! which git; then
|
||||
GITDIR=/tmp/git-1.7.7
|
||||
cd /tmp
|
||||
rm -rf $GITDIR*
|
||||
wget http://git-core.googlecode.com/files/git-1.7.7.tar.gz
|
||||
tar xfv git-1.7.7.tar.gz
|
||||
cd $GITDIR
|
||||
./configure --with-curl --with-expat
|
||||
make install
|
||||
cd $TOP_DIR
|
||||
fi
|
||||
|
||||
# Helper to create networks
|
||||
# Uses echo trickery to return network uuid
|
||||
function create_network() {
|
||||
br=$1
|
||||
dev=$2
|
||||
vlan=$3
|
||||
netname=$4
|
||||
if [ -z $br ]
|
||||
then
|
||||
pif=$(xe pif-list --minimal device=$dev VLAN=$vlan)
|
||||
if [ -z $pif ]
|
||||
then
|
||||
net=$(xe network-create name-label=$netname)
|
||||
else
|
||||
net=$(xe network-list --minimal PIF-uuids=$pif)
|
||||
fi
|
||||
echo $net
|
||||
return 0
|
||||
fi
|
||||
if [ ! $(xe network-list --minimal params=bridge | grep -w --only-matching $br) ]
|
||||
then
|
||||
echo "Specified bridge $br does not exist"
|
||||
echo "If you wish to use defaults, please keep the bridge name empty"
|
||||
exit 1
|
||||
else
|
||||
net=$(xe network-list --minimal bridge=$br)
|
||||
echo $net
|
||||
fi
|
||||
}
|
||||
|
||||
function errorcheck() {
|
||||
rc=$?
|
||||
if [ $rc -ne 0 ]
|
||||
then
|
||||
exit $rc
|
||||
fi
|
||||
}
|
||||
|
||||
# Create host, vm, mgmt, pub networks
|
||||
VM_NET=$(create_network "$VM_BR" "$VM_DEV" "$VM_VLAN" "vmbr")
|
||||
errorcheck
|
||||
MGT_NET=$(create_network "$MGT_BR" "$MGT_DEV" "$MGT_VLAN" "mgtbr")
|
||||
errorcheck
|
||||
PUB_NET=$(create_network "$PUB_BR" "$PUB_DEV" "$PUB_VLAN" "pubbr")
|
||||
errorcheck
|
||||
|
||||
# Helper to create vlans
|
||||
function create_vlan() {
|
||||
dev=$1
|
||||
vlan=$2
|
||||
net=$3
|
||||
# VLAN -1 refers to no VLAN (physical network)
|
||||
if [ $vlan -eq -1 ]
|
||||
then
|
||||
return
|
||||
fi
|
||||
if [ -z $(xe vlan-list --minimal tag=$vlan) ]
|
||||
then
|
||||
pif=$(xe pif-list --minimal network-uuid=$net)
|
||||
# We created a brand new network this time
|
||||
if [ -z $pif ]
|
||||
then
|
||||
pif=$(xe pif-list --minimal device=$dev VLAN=-1)
|
||||
xe vlan-create pif-uuid=$pif vlan=$vlan network-uuid=$net
|
||||
else
|
||||
echo "VLAN does not exist but PIF attached to this network"
|
||||
echo "How did we reach here?"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Create vlans for vm and management
|
||||
create_vlan $PUB_DEV $PUB_VLAN $PUB_NET
|
||||
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
|
||||
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
|
||||
|
||||
# Set local storage il8n
|
||||
SR_UUID=`xe sr-list --minimal name-label="Local storage"`
|
||||
xe sr-param-set uuid=$SR_UUID other-config:i18n-key=local-storage
|
||||
|
||||
# Checkout nova
|
||||
git_clone $NOVA_REPO $TOP_DIR/nova $NOVA_BRANCH
|
||||
|
||||
# Install plugins
|
||||
cp -pr $TOP_DIR/nova/plugins/xenserver/xenapi/etc/xapi.d /etc/
|
||||
chmod a+x /etc/xapi.d/plugins/*
|
||||
yum --enablerepo=base install -y parted
|
||||
mkdir -p /boot/guest
|
||||
|
||||
# Shutdown previous runs
|
||||
DO_SHUTDOWN=${DO_SHUTDOWN:-1}
|
||||
if [ "$DO_SHUTDOWN" = "1" ]; then
|
||||
# Shutdown all domU's that created previously
|
||||
xe vm-list --minimal name-label="$LABEL" | xargs ./scripts/uninstall-os-vpx.sh
|
||||
|
||||
# Destroy any instances that were launched
|
||||
for uuid in `xe vm-list | grep -1 instance | grep uuid | sed "s/.*\: //g"`; do
|
||||
echo "Shutting down nova instance $uuid"
|
||||
xe vm-unpause uuid=$uuid || true
|
||||
xe vm-shutdown uuid=$uuid
|
||||
xe vm-destroy uuid=$uuid
|
||||
done
|
||||
|
||||
# Destroy orphaned vdis
|
||||
for uuid in `xe vdi-list | grep -1 Glance | grep uuid | sed "s/.*\: //g"`; do
|
||||
xe vdi-destroy uuid=$uuid
|
||||
done
|
||||
fi
|
||||
|
||||
# Start guest
|
||||
if [ -z $VM_BR ]; then
|
||||
VM_BR=$(xe network-list --minimal uuid=$VM_NET params=bridge)
|
||||
fi
|
||||
if [ -z $MGT_BR ]; then
|
||||
MGT_BR=$(xe network-list --minimal uuid=$MGT_NET params=bridge)
|
||||
fi
|
||||
if [ -z $PUB_BR ]; then
|
||||
PUB_BR=$(xe network-list --minimal uuid=$PUB_NET params=bridge)
|
||||
fi
|
||||
$TOP_DIR/scripts/install-os-vpx.sh -f $XVA -v $VM_BR -m $MGT_BR -p $PUB_BR -l $GUEST_NAME -w -k "flat_network_bridge=${VM_BR}"
|
||||
|
||||
if [ $PUB_IP == "dhcp" ]; then
|
||||
PUB_IP=$(xe vm-list --minimal name-label=$GUEST_NAME params=networks | sed -ne 's,^.*3/ip: \([0-9.]*\).*$,\1,p')
|
||||
fi
|
||||
|
||||
# If we have copied our ssh credentials, use ssh to monitor while the installation runs
|
||||
WAIT_TILL_LAUNCH=${WAIT_TILL_LAUNCH:-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
|
||||
done
|
||||
|
||||
ssh stack@$PUB_IP 'tail -f run.sh.log' &
|
||||
|
||||
TAIL_PID=$!
|
||||
|
||||
function kill_tail() {
|
||||
kill $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
|
||||
done
|
||||
|
||||
kill $TAIL_PID
|
||||
|
||||
if ssh -q stack@$PUB_IP "grep -q 'stack.sh failed' run.sh.log"; then
|
||||
exit 1
|
||||
fi
|
||||
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."
|
||||
else
|
||||
echo "################################################################################"
|
||||
echo ""
|
||||
echo "All Finished!"
|
||||
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 "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."
|
||||
|
||||
fi
|
||||
+41
-87
@@ -1,42 +1,42 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 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
|
||||
# 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
|
||||
|
||||
# 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
|
||||
STAGING_DIR=$TOP_DIR/stage
|
||||
|
||||
# Option to clean out old stuff
|
||||
CLEAN=${CLEAN:-0}
|
||||
if [ "$CLEAN" = "1" ]; then
|
||||
rm -rf $STAGING_DIR
|
||||
fi
|
||||
|
||||
# Download our base image. This image is made using prepare_guest.sh
|
||||
BASE_IMAGE_URL=${BASE_IMAGE_URL:-http://images.ansolabs.com/xen/stage.tgz}
|
||||
if [ ! -e $STAGING_DIR ]; then
|
||||
if [ ! -e /tmp/stage.tgz ]; then
|
||||
wget $BASE_IMAGE_URL -O /tmp/stage.tgz
|
||||
fi
|
||||
tar xfz /tmp/stage.tgz
|
||||
cd $TOP_DIR
|
||||
fi
|
||||
|
||||
# Free up precious disk space
|
||||
rm -f /tmp/stage.tgz
|
||||
#
|
||||
# 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
|
||||
@@ -55,69 +55,36 @@ SCRIPT_DIR=$TOP_DIR/scripts
|
||||
UBUNTU_VERSION=`cat $STAGING_DIR/etc/lsb-release | grep "DISTRIB_CODENAME=" | sed "s/DISTRIB_CODENAME=//"`
|
||||
KERNEL_VERSION=`ls $STAGING_DIR/boot/vmlinuz* | head -1 | sed "s/.*vmlinuz-//"`
|
||||
|
||||
# Directory for xvas
|
||||
XVA_DIR=$TOP_DIR/xvas
|
||||
|
||||
# Create xva dir
|
||||
mkdir -p $XVA_DIR
|
||||
|
||||
# Path to xva
|
||||
XVA=$XVA_DIR/$GUEST_NAME.xva
|
||||
|
||||
# Setup fake grub
|
||||
rm -rf $STAGING_DIR/boot/grub/
|
||||
mkdir -p $STAGING_DIR/boot/grub/
|
||||
cp $TEMPLATES_DIR/menu.lst.in $STAGING_DIR/boot/grub/menu.lst
|
||||
sed -e "s,@KERNEL_VERSION@,$KERNEL_VERSION,g" -i $STAGING_DIR/boot/grub/menu.lst
|
||||
|
||||
# Setup fstab, tty, and other system stuff
|
||||
cp $FILES_DIR/fstab $STAGING_DIR/etc/fstab
|
||||
cp $FILES_DIR/hvc0.conf $STAGING_DIR/etc/init/
|
||||
|
||||
# Put the VPX into UTC.
|
||||
rm -f $STAGING_DIR/etc/localtime
|
||||
|
||||
# Configure dns (use same dns as dom0)
|
||||
cp /etc/resolv.conf $STAGING_DIR/etc/resolv.conf
|
||||
|
||||
# Copy over devstack
|
||||
rm -f /tmp/devstack.tar
|
||||
tar --exclude='stage' --exclude='xen/xvas' --exclude='xen/nova' -cvf /tmp/devstack.tar $TOP_DIR/../../../devstack
|
||||
cd $STAGING_DIR/opt/stack/
|
||||
tar xf /tmp/devstack.tar
|
||||
cd $TOP_DIR/../../
|
||||
tar --exclude='stage' --exclude='xen/xvas' --exclude='xen/nova' -cvf /tmp/devstack.tar .
|
||||
mkdir -p $STAGING_DIR/opt/stack/devstack
|
||||
tar xf /tmp/devstack.tar -C $STAGING_DIR/opt/stack/devstack
|
||||
cd $TOP_DIR
|
||||
|
||||
# Configure OVA
|
||||
VDI_SIZE=$(($VDI_MB*1024*1024))
|
||||
PRODUCT_BRAND=${PRODUCT_BRAND:-openstack}
|
||||
PRODUCT_VERSION=${PRODUCT_VERSION:-001}
|
||||
BUILD_NUMBER=${BUILD_NUMBER:-001}
|
||||
LABEL="$PRODUCT_BRAND $PRODUCT_VERSION-$BUILD_NUMBER"
|
||||
OVA=$STAGING_DIR/tmp/ova.xml
|
||||
cp $TEMPLATES_DIR/ova.xml.in $OVA
|
||||
sed -e "s,@VDI_SIZE@,$VDI_SIZE,g" -i $OVA
|
||||
sed -e "s,@PRODUCT_BRAND@,$PRODUCT_BRAND,g" -i $OVA
|
||||
sed -e "s,@PRODUCT_VERSION@,$PRODUCT_VERSION,g" -i $OVA
|
||||
sed -e "s,@BUILD_NUMBER@,$BUILD_NUMBER,g" -i $OVA
|
||||
|
||||
# Run devstack on launch
|
||||
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
|
||||
su -c "/opt/stack/run.sh > /opt/stack/run.sh.log" stack
|
||||
chown -R stack /opt/stack
|
||||
su -c "/opt/stack/run.sh > /opt/stack/run.sh.log 2>&1" stack
|
||||
exit 0
|
||||
EOF
|
||||
|
||||
# Clean old xva. In the future may not do this every time.
|
||||
rm -f $XVA
|
||||
|
||||
# Configure the hostname
|
||||
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
|
||||
|
||||
@@ -151,10 +118,6 @@ else
|
||||
sed -e "s,@ETH3_NETMASK@,$PUB_NETMASK,g" -i $INTERFACES
|
||||
fi
|
||||
|
||||
if [ -h $STAGING_DIR/sbin/dhclient3 ]; then
|
||||
rm -f $STAGING_DIR/sbin/dhclient3
|
||||
fi
|
||||
|
||||
# Gracefully cp only if source file/dir exists
|
||||
function cp_it {
|
||||
if [ -e $1 ] || [ -d $1 ]; then
|
||||
@@ -177,15 +140,6 @@ cat <<EOF >$STAGING_DIR/opt/stack/run.sh
|
||||
#!/bin/bash
|
||||
cd /opt/stack/devstack
|
||||
killall screen
|
||||
UPLOAD_LEGACY_TTY=yes HOST_IP=$PUB_IP VIRT_DRIVER=xenserver FORCE=yes MULTI_HOST=1 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
|
||||
|
||||
# Create xva
|
||||
if [ ! -e $XVA ]; then
|
||||
rm -rf /tmp/mkxva*
|
||||
UID=0 $SCRIPT_DIR/mkxva -o $XVA -t xva -x $OVA $STAGING_DIR $VDI_MB /tmp/
|
||||
fi
|
||||
|
||||
echo "Built $(basename $XVA). If your dom0 is on a different machine, copy this to [devstackdir]/tools/xen/$(basename $XVA)"
|
||||
echo "Also copy your localrc to [devstackdir]"
|
||||
|
||||
@@ -0,0 +1,470 @@
|
||||
### Contents of the preconfiguration file (for squeeze)
|
||||
### Localization
|
||||
# Preseeding only locale sets language, country and locale.
|
||||
d-i debian-installer/locale string en_US
|
||||
|
||||
# The values can also be preseeded individually for greater flexibility.
|
||||
#d-i debian-installer/language string en
|
||||
#d-i debian-installer/country string NL
|
||||
#d-i debian-installer/locale string en_GB.UTF-8
|
||||
# Optionally specify additional locales to be generated.
|
||||
#d-i localechooser/supported-locales en_US.UTF-8, nl_NL.UTF-8
|
||||
|
||||
# Keyboard selection.
|
||||
# Disable automatic (interactive) keymap detection.
|
||||
d-i console-setup/ask_detect boolean false
|
||||
#d-i keyboard-configuration/modelcode string pc105
|
||||
d-i keyboard-configuration/layoutcode string us
|
||||
# To select a variant of the selected layout (if you leave this out, the
|
||||
# basic form of the layout will be used):
|
||||
#d-i keyboard-configuration/variantcode string dvorak
|
||||
|
||||
### Network configuration
|
||||
# Disable network configuration entirely. This is useful for cdrom
|
||||
# installations on non-networked devices where the network questions,
|
||||
# warning and long timeouts are a nuisance.
|
||||
#d-i netcfg/enable boolean false
|
||||
|
||||
# netcfg will choose an interface that has link if possible. This makes it
|
||||
# skip displaying a list if there is more than one interface.
|
||||
d-i netcfg/choose_interface select auto
|
||||
|
||||
# To pick a particular interface instead:
|
||||
#d-i netcfg/choose_interface select eth1
|
||||
|
||||
# If you have a slow dhcp server and the installer times out waiting for
|
||||
# it, this might be useful.
|
||||
#d-i netcfg/dhcp_timeout string 60
|
||||
|
||||
# If you prefer to configure the network manually, uncomment this line and
|
||||
# the static network configuration below.
|
||||
#d-i netcfg/disable_autoconfig boolean true
|
||||
|
||||
# If you want the preconfiguration file to work on systems both with and
|
||||
# without a dhcp server, uncomment these lines and the static network
|
||||
# configuration below.
|
||||
#d-i netcfg/dhcp_failed note
|
||||
#d-i netcfg/dhcp_options select Configure network manually
|
||||
|
||||
# Static network configuration.
|
||||
#d-i netcfg/get_nameservers string 192.168.1.1
|
||||
#d-i netcfg/get_ipaddress string 192.168.1.42
|
||||
#d-i netcfg/get_netmask string 255.255.255.0
|
||||
#d-i netcfg/get_gateway string 192.168.1.1
|
||||
#d-i netcfg/confirm_static boolean true
|
||||
|
||||
# Any hostname and domain names assigned from dhcp take precedence over
|
||||
# values set here. However, setting the values still prevents the questions
|
||||
# from being shown, even if values come from dhcp.
|
||||
d-i netcfg/get_hostname string stack
|
||||
d-i netcfg/get_domain string stackpass
|
||||
|
||||
# Disable that annoying WEP key dialog.
|
||||
d-i netcfg/wireless_wep string
|
||||
# The wacky dhcp hostname that some ISPs use as a password of sorts.
|
||||
#d-i netcfg/dhcp_hostname string radish
|
||||
|
||||
# If non-free firmware is needed for the network or other hardware, you can
|
||||
# configure the installer to always try to load it, without prompting. Or
|
||||
# change to false to disable asking.
|
||||
#d-i hw-detect/load_firmware boolean true
|
||||
|
||||
### Network console
|
||||
# Use the following settings if you wish to make use of the network-console
|
||||
# component for remote installation over SSH. This only makes sense if you
|
||||
# intend to perform the remainder of the installation manually.
|
||||
#d-i anna/choose_modules string network-console
|
||||
#d-i network-console/password password r00tme
|
||||
#d-i network-console/password-again password r00tme
|
||||
|
||||
### Mirror settings
|
||||
# If you select ftp, the mirror/country string does not need to be set.
|
||||
#d-i mirror/protocol string ftp
|
||||
d-i mirror/country string manual
|
||||
d-i mirror/http/hostname string archive.ubuntu.com
|
||||
d-i mirror/http/directory string /ubuntu
|
||||
d-i mirror/http/proxy string
|
||||
|
||||
# Alternatively: by default, the installer uses CC.archive.ubuntu.com where
|
||||
# CC is the ISO-3166-2 code for the selected country. You can preseed this
|
||||
# so that it does so without asking.
|
||||
#d-i mirror/http/mirror select CC.archive.ubuntu.com
|
||||
|
||||
# Suite to install.
|
||||
#d-i mirror/suite string squeeze
|
||||
# Suite to use for loading installer components (optional).
|
||||
#d-i mirror/udeb/suite string squeeze
|
||||
# Components to use for loading installer components (optional).
|
||||
#d-i mirror/udeb/components multiselect main, restricted
|
||||
|
||||
### Clock and time zone setup
|
||||
# Controls whether or not the hardware clock is set to UTC.
|
||||
d-i clock-setup/utc boolean true
|
||||
|
||||
# You may set this to any valid setting for $TZ; see the contents of
|
||||
# /usr/share/zoneinfo/ for valid values.
|
||||
d-i time/zone string US/Pacific
|
||||
|
||||
# Controls whether to use NTP to set the clock during the install
|
||||
d-i clock-setup/ntp boolean true
|
||||
# NTP server to use. The default is almost always fine here.
|
||||
d-i clock-setup/ntp-server string 0.us.pool.ntp.org
|
||||
|
||||
### Partitioning
|
||||
## Partitioning example
|
||||
# If the system has free space you can choose to only partition that space.
|
||||
# This is only honoured if partman-auto/method (below) is not set.
|
||||
# Alternatives: custom, some_device, some_device_crypto, some_device_lvm.
|
||||
#d-i partman-auto/init_automatically_partition select biggest_free
|
||||
|
||||
# Alternatively, you may specify a disk to partition. If the system has only
|
||||
# one disk the installer will default to using that, but otherwise the device
|
||||
# name must be given in traditional, non-devfs format (so e.g. /dev/hda or
|
||||
# /dev/sda, and not e.g. /dev/discs/disc0/disc).
|
||||
# For example, to use the first SCSI/SATA hard disk:
|
||||
#d-i partman-auto/disk string /dev/sda
|
||||
# In addition, you'll need to specify the method to use.
|
||||
# The presently available methods are:
|
||||
# - regular: use the usual partition types for your architecture
|
||||
# - lvm: use LVM to partition the disk
|
||||
# - crypto: use LVM within an encrypted partition
|
||||
d-i partman-auto/method string regular
|
||||
|
||||
# If one of the disks that are going to be automatically partitioned
|
||||
# contains an old LVM configuration, the user will normally receive a
|
||||
# warning. This can be preseeded away...
|
||||
d-i partman-lvm/device_remove_lvm boolean true
|
||||
# The same applies to pre-existing software RAID array:
|
||||
d-i partman-md/device_remove_md boolean true
|
||||
# And the same goes for the confirmation to write the lvm partitions.
|
||||
d-i partman-lvm/confirm boolean true
|
||||
|
||||
# For LVM partitioning, you can select how much of the volume group to use
|
||||
# for logical volumes.
|
||||
#d-i partman-auto-lvm/guided_size string max
|
||||
#d-i partman-auto-lvm/guided_size string 10GB
|
||||
#d-i partman-auto-lvm/guided_size string 50%
|
||||
|
||||
# You can choose one of the three predefined partitioning recipes:
|
||||
# - atomic: all files in one partition
|
||||
# - home: separate /home partition
|
||||
# - multi: separate /home, /usr, /var, and /tmp partitions
|
||||
d-i partman-auto/choose_recipe select atomic
|
||||
|
||||
# Or provide a recipe of your own...
|
||||
# If you have a way to get a recipe file into the d-i environment, you can
|
||||
# just point at it.
|
||||
#d-i partman-auto/expert_recipe_file string /hd-media/recipe
|
||||
|
||||
# If not, you can put an entire recipe into the preconfiguration file in one
|
||||
# (logical) line. This example creates a small /boot partition, suitable
|
||||
# swap, and uses the rest of the space for the root partition:
|
||||
#d-i partman-auto/expert_recipe string \
|
||||
# boot-root :: \
|
||||
# 40 50 100 ext3 \
|
||||
# $primary{ } $bootable{ } \
|
||||
# method{ format } format{ } \
|
||||
# use_filesystem{ } filesystem{ ext3 } \
|
||||
# mountpoint{ /boot } \
|
||||
# . \
|
||||
# 500 10000 1000000000 ext3 \
|
||||
# method{ format } format{ } \
|
||||
# use_filesystem{ } filesystem{ ext3 } \
|
||||
# mountpoint{ / } \
|
||||
# . \
|
||||
# 64 512 300% linux-swap \
|
||||
# method{ swap } format{ } \
|
||||
# .
|
||||
|
||||
# If you just want to change the default filesystem from ext3 to something
|
||||
# else, you can do that without providing a full recipe.
|
||||
d-i partman/default_filesystem string ext3
|
||||
|
||||
# The full recipe format is documented in the file partman-auto-recipe.txt
|
||||
# included in the 'debian-installer' package or available from D-I source
|
||||
# repository. This also documents how to specify settings such as file
|
||||
# system labels, volume group names and which physical devices to include
|
||||
# in a volume group.
|
||||
|
||||
# This makes partman automatically partition without confirmation, provided
|
||||
# that you told it what to do using one of the methods above.
|
||||
d-i partman-partitioning/confirm_write_new_label boolean true
|
||||
d-i partman/choose_partition select finish
|
||||
d-i partman/confirm boolean true
|
||||
d-i partman/confirm_nooverwrite boolean true
|
||||
|
||||
## Partitioning using RAID
|
||||
# The method should be set to "raid".
|
||||
#d-i partman-auto/method string raid
|
||||
# Specify the disks to be partitioned. They will all get the same layout,
|
||||
# so this will only work if the disks are the same size.
|
||||
#d-i partman-auto/disk string /dev/sda /dev/sdb
|
||||
|
||||
# Next you need to specify the physical partitions that will be used.
|
||||
#d-i partman-auto/expert_recipe string \
|
||||
# multiraid :: \
|
||||
# 1000 5000 4000 raid \
|
||||
# $primary{ } method{ raid } \
|
||||
# . \
|
||||
# 64 512 300% raid \
|
||||
# method{ raid } \
|
||||
# . \
|
||||
# 500 10000 1000000000 raid \
|
||||
# method{ raid } \
|
||||
# .
|
||||
|
||||
# Last you need to specify how the previously defined partitions will be
|
||||
# used in the RAID setup. Remember to use the correct partition numbers
|
||||
# for logical partitions. RAID levels 0, 1, 5, 6 and 10 are supported;
|
||||
# devices are separated using "#".
|
||||
# Parameters are:
|
||||
# <raidtype> <devcount> <sparecount> <fstype> <mountpoint> \
|
||||
# <devices> <sparedevices>
|
||||
|
||||
#d-i partman-auto-raid/recipe string \
|
||||
# 1 2 0 ext3 / \
|
||||
# /dev/sda1#/dev/sdb1 \
|
||||
# . \
|
||||
# 1 2 0 swap - \
|
||||
# /dev/sda5#/dev/sdb5 \
|
||||
# . \
|
||||
# 0 2 0 ext3 /home \
|
||||
# /dev/sda6#/dev/sdb6 \
|
||||
# .
|
||||
|
||||
# For additional information see the file partman-auto-raid-recipe.txt
|
||||
# included in the 'debian-installer' package or available from D-I source
|
||||
# repository.
|
||||
|
||||
# This makes partman automatically partition without confirmation.
|
||||
d-i partman-md/confirm boolean true
|
||||
d-i partman-partitioning/confirm_write_new_label boolean true
|
||||
d-i partman/choose_partition select finish
|
||||
d-i partman/confirm boolean true
|
||||
d-i partman/confirm_nooverwrite boolean true
|
||||
|
||||
## Controlling how partitions are mounted
|
||||
# The default is to mount by UUID, but you can also choose "traditional" to
|
||||
# use traditional device names, or "label" to try filesystem labels before
|
||||
# falling back to UUIDs.
|
||||
#d-i partman/mount_style select uuid
|
||||
|
||||
### Base system installation
|
||||
# Configure APT to not install recommended packages by default. Use of this
|
||||
# option can result in an incomplete system and should only be used by very
|
||||
# experienced users.
|
||||
#d-i base-installer/install-recommends boolean false
|
||||
|
||||
# The kernel image (meta) package to be installed; "none" can be used if no
|
||||
# kernel is to be installed.
|
||||
#d-i base-installer/kernel/image string linux-generic
|
||||
|
||||
### Account setup
|
||||
# Skip creation of a root account (normal user account will be able to
|
||||
# use sudo). The default is false; preseed this to true if you want to set
|
||||
# a root password.
|
||||
d-i passwd/root-login boolean true
|
||||
# Alternatively, to skip creation of a normal user account.
|
||||
d-i passwd/make-user boolean false
|
||||
|
||||
# Root password, either in clear text
|
||||
d-i passwd/root-password password stackpass
|
||||
d-i passwd/root-password-again password stackpass
|
||||
# or encrypted using an MD5 hash.
|
||||
#d-i passwd/root-password-crypted password [MD5 hash]
|
||||
|
||||
# To create a normal user account.
|
||||
#d-i passwd/user-fullname string Ubuntu User
|
||||
#d-i passwd/username string ubuntu
|
||||
# Normal user's password, either in clear text
|
||||
#d-i passwd/user-password password insecure
|
||||
#d-i passwd/user-password-again password insecure
|
||||
# or encrypted using an MD5 hash.
|
||||
#d-i passwd/user-password-crypted password [MD5 hash]
|
||||
# Create the first user with the specified UID instead of the default.
|
||||
#d-i passwd/user-uid string 1010
|
||||
# The installer will warn about weak passwords. If you are sure you know
|
||||
# what you're doing and want to override it, uncomment this.
|
||||
d-i user-setup/allow-password-weak boolean true
|
||||
|
||||
# The user account will be added to some standard initial groups. To
|
||||
# override that, use this.
|
||||
#d-i passwd/user-default-groups string audio cdrom video
|
||||
|
||||
# Set to true if you want to encrypt the first user's home directory.
|
||||
d-i user-setup/encrypt-home boolean false
|
||||
|
||||
### Apt setup
|
||||
# You can choose to install restricted and universe software, or to install
|
||||
# software from the backports repository.
|
||||
#d-i apt-setup/restricted boolean true
|
||||
#d-i apt-setup/universe boolean true
|
||||
#d-i apt-setup/backports boolean true
|
||||
# Uncomment this if you don't want to use a network mirror.
|
||||
#d-i apt-setup/use_mirror boolean false
|
||||
# Select which update services to use; define the mirrors to be used.
|
||||
# Values shown below are the normal defaults.
|
||||
#d-i apt-setup/services-select multiselect security
|
||||
#d-i apt-setup/security_host string security.ubuntu.com
|
||||
#d-i apt-setup/security_path string /ubuntu
|
||||
|
||||
# Additional repositories, local[0-9] available
|
||||
#d-i apt-setup/local0/repository string \
|
||||
# http://local.server/ubuntu squeeze main
|
||||
#d-i apt-setup/local0/comment string local server
|
||||
# Enable deb-src lines
|
||||
#d-i apt-setup/local0/source boolean true
|
||||
# URL to the public key of the local repository; you must provide a key or
|
||||
# apt will complain about the unauthenticated repository and so the
|
||||
# sources.list line will be left commented out
|
||||
#d-i apt-setup/local0/key string http://local.server/key
|
||||
|
||||
# By default the installer requires that repositories be authenticated
|
||||
# using a known gpg key. This setting can be used to disable that
|
||||
# authentication. Warning: Insecure, not recommended.
|
||||
#d-i debian-installer/allow_unauthenticated boolean true
|
||||
|
||||
### Package selection
|
||||
#tasksel tasksel/first multiselect ubuntu-desktop
|
||||
#tasksel tasksel/first multiselect lamp-server, print-server
|
||||
#tasksel tasksel/first multiselect kubuntu-desktop
|
||||
tasksel tasksel/first multiselect openssh-server
|
||||
|
||||
# Individual additional packages to install
|
||||
#d-i pkgsel/include string openssh-server build-essential
|
||||
# Whether to upgrade packages after debootstrap.
|
||||
# Allowed values: none, safe-upgrade, full-upgrade
|
||||
#d-i pkgsel/upgrade select none
|
||||
|
||||
# Language pack selection
|
||||
#d-i pkgsel/language-packs multiselect de, en, zh
|
||||
|
||||
# Policy for applying updates. May be "none" (no automatic updates),
|
||||
# "unattended-upgrades" (install security updates automatically), or
|
||||
# "landscape" (manage system with Landscape).
|
||||
d-i pkgsel/update-policy select unattended-upgrades
|
||||
|
||||
# Some versions of the installer can report back on what software you have
|
||||
# installed, and what software you use. The default is not to report back,
|
||||
# but sending reports helps the project determine what software is most
|
||||
# popular and include it on CDs.
|
||||
#popularity-contest popularity-contest/participate boolean false
|
||||
|
||||
# By default, the system's locate database will be updated after the
|
||||
# installer has finished installing most packages. This may take a while, so
|
||||
# if you don't want it, you can set this to "false" to turn it off.
|
||||
d-i pkgsel/updatedb boolean false
|
||||
|
||||
### Boot loader installation
|
||||
# Grub is the default boot loader (for x86). If you want lilo installed
|
||||
# instead, uncomment this:
|
||||
#d-i grub-installer/skip boolean true
|
||||
# To also skip installing lilo, and install no bootloader, uncomment this
|
||||
# too:
|
||||
#d-i lilo-installer/skip boolean true
|
||||
|
||||
# With a few exceptions for unusual partitioning setups, GRUB 2 is now the
|
||||
# default. If you need GRUB Legacy for some particular reason, then
|
||||
# uncomment this:
|
||||
#d-i grub-installer/grub2_instead_of_grub_legacy boolean false
|
||||
|
||||
# This is fairly safe to set, it makes grub install automatically to the MBR
|
||||
# if no other operating system is detected on the machine.
|
||||
d-i grub-installer/only_debian boolean true
|
||||
|
||||
# This one makes grub-installer install to the MBR if it also finds some other
|
||||
# OS, which is less safe as it might not be able to boot that other OS.
|
||||
d-i grub-installer/with_other_os boolean true
|
||||
|
||||
# Alternatively, if you want to install to a location other than the mbr,
|
||||
# uncomment and edit these lines:
|
||||
#d-i grub-installer/only_debian boolean false
|
||||
#d-i grub-installer/with_other_os boolean false
|
||||
#d-i grub-installer/bootdev string (hd0,0)
|
||||
# To install grub to multiple disks:
|
||||
#d-i grub-installer/bootdev string (hd0,0) (hd1,0) (hd2,0)
|
||||
|
||||
# Optional password for grub, either in clear text
|
||||
#d-i grub-installer/password password r00tme
|
||||
#d-i grub-installer/password-again password r00tme
|
||||
# or encrypted using an MD5 hash, see grub-md5-crypt(8).
|
||||
#d-i grub-installer/password-crypted password [MD5 hash]
|
||||
|
||||
# Use the following option to add additional boot parameters for the
|
||||
# installed system (if supported by the bootloader installer).
|
||||
# Note: options passed to the installer will be added automatically.
|
||||
#d-i debian-installer/add-kernel-opts string nousb
|
||||
|
||||
### Finishing up the installation
|
||||
# During installations from serial console, the regular virtual consoles
|
||||
# (VT1-VT6) are normally disabled in /etc/inittab. Uncomment the next
|
||||
# line to prevent this.
|
||||
d-i finish-install/keep-consoles boolean true
|
||||
|
||||
# Avoid that last message about the install being complete.
|
||||
d-i finish-install/reboot_in_progress note
|
||||
|
||||
# This will prevent the installer from ejecting the CD during the reboot,
|
||||
# which is useful in some situations.
|
||||
#d-i cdrom-detect/eject boolean false
|
||||
|
||||
# This is how to make the installer shutdown when finished, but not
|
||||
# reboot into the installed system.
|
||||
#d-i debian-installer/exit/halt boolean true
|
||||
# This will power off the machine instead of just halting it.
|
||||
#d-i debian-installer/exit/poweroff boolean true
|
||||
|
||||
### X configuration
|
||||
# X can detect the right driver for some cards, but if you're preseeding,
|
||||
# you override whatever it chooses. Still, vesa will work most places.
|
||||
#xserver-xorg xserver-xorg/config/device/driver select vesa
|
||||
|
||||
# A caveat with mouse autodetection is that if it fails, X will retry it
|
||||
# over and over. So if it's preseeded to be done, there is a possibility of
|
||||
# an infinite loop if the mouse is not autodetected.
|
||||
#xserver-xorg xserver-xorg/autodetect_mouse boolean true
|
||||
|
||||
# Monitor autodetection is recommended.
|
||||
xserver-xorg xserver-xorg/autodetect_monitor boolean true
|
||||
# Uncomment if you have an LCD display.
|
||||
#xserver-xorg xserver-xorg/config/monitor/lcd boolean true
|
||||
# X has three configuration paths for the monitor. Here's how to preseed
|
||||
# the "medium" path, which is always available. The "simple" path may not
|
||||
# be available, and the "advanced" path asks too many questions.
|
||||
xserver-xorg xserver-xorg/config/monitor/selection-method \
|
||||
select medium
|
||||
xserver-xorg xserver-xorg/config/monitor/mode-list \
|
||||
select 1024x768 @ 60 Hz
|
||||
|
||||
### Preseeding other packages
|
||||
# Depending on what software you choose to install, or if things go wrong
|
||||
# during the installation process, it's possible that other questions may
|
||||
# be asked. You can preseed those too, of course. To get a list of every
|
||||
# possible question that could be asked during an install, do an
|
||||
# installation, and then run these commands:
|
||||
# debconf-get-selections --installer > file
|
||||
# debconf-get-selections >> file
|
||||
|
||||
|
||||
#### Advanced options
|
||||
### Running custom commands during the installation
|
||||
# d-i preseeding is inherently not secure. Nothing in the installer checks
|
||||
# for attempts at buffer overflows or other exploits of the values of a
|
||||
# preconfiguration file like this one. Only use preconfiguration files from
|
||||
# trusted locations! To drive that home, and because it's generally useful,
|
||||
# here's a way to run any shell command you'd like inside the installer,
|
||||
# automatically.
|
||||
|
||||
# This first command is run as early as possible, just after
|
||||
# preseeding is read.
|
||||
#d-i preseed/early_command string anna-install some-udeb
|
||||
# This command is run immediately before the partitioner starts. It may be
|
||||
# useful to apply dynamic partitioner preseeding that depends on the state
|
||||
# of the disks (which may not be visible when preseed/early_command runs).
|
||||
#d-i partman/early_command \
|
||||
# string debconf-set partman-auto/disk "$(list-devices disk | head -n1)"
|
||||
# This command is run just before the install finishes, but when there is
|
||||
# still a usable /target directory. You can chroot to /target and use it
|
||||
# directly, or use the apt-install and in-target commands to easily install
|
||||
# packages and run commands in the target system.
|
||||
#d-i preseed/late_command string apt-install zsh; in-target chsh -s /bin/zsh
|
||||
@@ -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"
|
||||
Executable
+419
@@ -0,0 +1,419 @@
|
||||
#!/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
|
||||
echo "You must have a localrc with ALL necessary passwords defined before proceeding."
|
||||
echo "See the xen README for required passwords."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# This directory
|
||||
TOP_DIR=$(cd $(dirname "$0") && pwd)
|
||||
|
||||
# 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
|
||||
|
||||
xe_min()
|
||||
{
|
||||
local cmd="$1"
|
||||
shift
|
||||
xe "$cmd" --minimal "$@"
|
||||
}
|
||||
|
||||
|
||||
#
|
||||
# Prepare Dom0
|
||||
# including installing XenAPI plugins
|
||||
#
|
||||
|
||||
cd $TOP_DIR
|
||||
if [ -f ./master ]
|
||||
then
|
||||
rm -rf ./master
|
||||
rm -rf ./nova
|
||||
fi
|
||||
nova_zipball=$(echo $NOVA_REPO | sed "s:\.git$::;s:$:/zipball/$NOVA_BRANCH:g")
|
||||
wget $nova_zipball -O nova-zipball --no-check-certificate
|
||||
unzip -o nova-zipball -d ./nova
|
||||
cp -pr ./nova/*/plugins/xenserver/xenapi/etc/xapi.d /etc/
|
||||
chmod a+x /etc/xapi.d/plugins/*
|
||||
mkdir -p /boot/guest
|
||||
|
||||
|
||||
#
|
||||
# Configure Networking
|
||||
#
|
||||
|
||||
# Helper to create networks
|
||||
# Uses echo trickery to return network uuid
|
||||
function create_network() {
|
||||
br=$1
|
||||
dev=$2
|
||||
vlan=$3
|
||||
netname=$4
|
||||
if [ -z $br ]
|
||||
then
|
||||
pif=$(xe_min pif-list device=$dev VLAN=$vlan)
|
||||
if [ -z $pif ]
|
||||
then
|
||||
net=$(xe network-create name-label=$netname)
|
||||
else
|
||||
net=$(xe_min network-list PIF-uuids=$pif)
|
||||
fi
|
||||
echo $net
|
||||
return 0
|
||||
fi
|
||||
if [ ! $(xe_min network-list params=bridge | grep -w --only-matching $br) ]
|
||||
then
|
||||
echo "Specified bridge $br does not exist"
|
||||
echo "If you wish to use defaults, please keep the bridge name empty"
|
||||
exit 1
|
||||
else
|
||||
net=$(xe_min network-list bridge=$br)
|
||||
echo $net
|
||||
fi
|
||||
}
|
||||
|
||||
function errorcheck() {
|
||||
rc=$?
|
||||
if [ $rc -ne 0 ]
|
||||
then
|
||||
exit $rc
|
||||
fi
|
||||
}
|
||||
|
||||
# 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")
|
||||
errorcheck
|
||||
PUB_NET=$(create_network "$PUB_BR" "$PUB_DEV" "$PUB_VLAN" "pubbr")
|
||||
errorcheck
|
||||
|
||||
# Helper to create vlans
|
||||
function create_vlan() {
|
||||
dev=$1
|
||||
vlan=$2
|
||||
net=$3
|
||||
# VLAN -1 refers to no VLAN (physical network)
|
||||
if [ $vlan -eq -1 ]
|
||||
then
|
||||
return
|
||||
fi
|
||||
if [ -z $(xe_min vlan-list tag=$vlan) ]
|
||||
then
|
||||
pif=$(xe_min pif-list network-uuid=$net)
|
||||
# We created a brand new network this time
|
||||
if [ -z $pif ]
|
||||
then
|
||||
pif=$(xe_min pif-list device=$dev VLAN=-1)
|
||||
xe vlan-create pif-uuid=$pif vlan=$vlan network-uuid=$net
|
||||
else
|
||||
echo "VLAN does not exist but PIF attached to this network"
|
||||
echo "How did we reach here?"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Create vlans for vm and management
|
||||
create_vlan $PUB_DEV $PUB_VLAN $PUB_NET
|
||||
create_vlan $VM_DEV $VM_VLAN $VM_NET
|
||||
create_vlan $MGT_DEV $MGT_VLAN $MGT_NET
|
||||
|
||||
# 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
|
||||
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
|
||||
# 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
|
||||
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
|
||||
echo "Shutting down nova instance $uuid"
|
||||
xe vm-unpause uuid=$uuid || true
|
||||
xe vm-shutdown uuid=$uuid || true
|
||||
xe vm-destroy uuid=$uuid
|
||||
done
|
||||
|
||||
# Destroy orphaned vdis
|
||||
for uuid in `xe vdi-list | grep -1 Glance | grep uuid | sed "s/.*\: //g"`; do
|
||||
xe vdi-destroy uuid=$uuid
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# Create Ubuntu VM template
|
||||
# and/or create VM from template
|
||||
#
|
||||
|
||||
GUEST_NAME=${GUEST_NAME:-"DevStackOSDomU"}
|
||||
TNAME="devstack_template_essex_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)
|
||||
if [ -n "$state" ]
|
||||
then
|
||||
break
|
||||
else
|
||||
echo "Waiting for "$GUEST_NAME" to finish installation..."
|
||||
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
|
||||
|
||||
# install ubuntu template, if required
|
||||
if [ -z "$ubuntu_template" ]; then
|
||||
$TOP_DIR/scripts/xenoneirictemplate.sh "${HOST_IP}/devstackubuntupreseed.cfg"
|
||||
fi
|
||||
|
||||
# always update the preseed file, incase we have a newer one
|
||||
cp -f $TOP_DIR/devstackubuntupreseed.cfg /opt/xensource/www/
|
||||
MIRROR=${MIRROR:-""}
|
||||
if [ -n "$MIRROR" ]; then
|
||||
sed -e "s,d-i mirror/http/hostname string .*,d-i mirror/http/hostname string $MIRROR," \
|
||||
-i /opt/xensource/www/devstackubuntupreseed.cfg
|
||||
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_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"
|
||||
|
||||
|
||||
#
|
||||
# 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
|
||||
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."
|
||||
|
||||
# wait for log to appear
|
||||
while ! ssh_no_check -q stack@$DOMU_IP "[ -e run.sh.log ]"; do
|
||||
sleep 10
|
||||
done
|
||||
|
||||
# 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 -9 $TAIL_PID
|
||||
exit 1
|
||||
}
|
||||
# Let Ctrl-c kill tail and exit
|
||||
trap kill_tail SIGINT
|
||||
|
||||
# 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 the tail process now stack.sh has finished
|
||||
kill -9 $TAIL_PID
|
||||
|
||||
# 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 "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 ""
|
||||
echo "All Finished!"
|
||||
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@$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://$DOMU_IP, and contact other services at the usual ports."
|
||||
fi
|
||||
@@ -1,41 +0,0 @@
|
||||
#i!/bin/sh
|
||||
set -o xtrace
|
||||
set -o errexit
|
||||
|
||||
# Install basics for vi and git
|
||||
yum -y --enablerepo=base install gcc make vim-enhanced zlib-devel openssl-devel curl-devel.i386
|
||||
|
||||
# Simple but usable vimrc
|
||||
if [ ! -e /root/.vimrc ]; then
|
||||
cat > /root/.vimrc <<EOF
|
||||
syntax on
|
||||
se ts=4
|
||||
se expandtab
|
||||
se shiftwidth=4
|
||||
EOF
|
||||
fi
|
||||
|
||||
# Use the pretty vim
|
||||
if [ -e /usr/bin/vim ]; then
|
||||
rm /bin/vi
|
||||
ln -s /usr/bin/vim /bin/vi
|
||||
fi
|
||||
|
||||
# Install git
|
||||
if ! which git; then
|
||||
DEST=/tmp/
|
||||
GITDIR=$DEST/git-1.7.7
|
||||
cd $DEST
|
||||
rm -rf $GITDIR*
|
||||
wget http://git-core.googlecode.com/files/git-1.7.7.tar.gz
|
||||
tar xfv git-1.7.7.tar.gz
|
||||
cd $GITDIR
|
||||
./configure --with-curl --with-expat
|
||||
make install
|
||||
fi
|
||||
|
||||
# Clone devstack
|
||||
DEVSTACK=${DEVSTACKROOT:-"/root/devstack"}
|
||||
if [ ! -d $DEVSTACK ]; then
|
||||
git clone git://github.com/openstack-dev/devstack.git $DEVSTACK
|
||||
fi
|
||||
Regular → Executable
+21
-21
@@ -1,39 +1,30 @@
|
||||
#!/bin/bash
|
||||
|
||||
# This script is run on an Ubuntu VM.
|
||||
# It is inserted to the VM by prepare_guest_template.sh
|
||||
# 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}
|
||||
STAGING_DIR=${STAGING_DIR:-stage}
|
||||
DO_TGZ=${DO_TGZ:-1}
|
||||
KERNEL_VERSION=3.0.0-12-virtual
|
||||
|
||||
# Debootstrap base system
|
||||
if [ ! -d $STAGING_DIR ]; then
|
||||
apt-get install debootstrap
|
||||
debootstrap --arch amd64 oneiric $STAGING_DIR http://us.archive.ubuntu.com/ubuntu/
|
||||
fi
|
||||
|
||||
# Sources.list
|
||||
cat <<EOF >$STAGING_DIR/etc/apt/sources.list
|
||||
deb http://us.archive.ubuntu.com/ubuntu/ oneiric main restricted
|
||||
deb-src http://us.archive.ubuntu.com/ubuntu/ oneiric main restricted
|
||||
deb http://us.archive.ubuntu.com/ubuntu/ oneiric-updates main restricted
|
||||
deb-src http://us.archive.ubuntu.com/ubuntu/ oneiric-updates main restricted
|
||||
deb http://us.archive.ubuntu.com/ubuntu/ oneiric universe
|
||||
deb http://us.archive.ubuntu.com/ubuntu/ oneiric-updates universe
|
||||
deb http://us.archive.ubuntu.com/ubuntu/ oneiric multiverse
|
||||
deb http://us.archive.ubuntu.com/ubuntu/ oneiric-updates multiverse
|
||||
EOF
|
||||
|
||||
# Install basics
|
||||
chroot $STAGING_DIR apt-get update
|
||||
chroot $STAGING_DIR apt-get install -y linux-image-$KERNEL_VERSION
|
||||
chroot $STAGING_DIR apt-get install -y cracklib-runtime curl wget ssh openssh-server tcpdump ethtool
|
||||
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
|
||||
@@ -88,3 +79,12 @@ if [ "$DO_TGZ" = "1" ]; then
|
||||
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
|
||||
|
||||
Executable
+57
@@ -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
|
||||
@@ -38,7 +38,7 @@ usage()
|
||||
cat << EOF
|
||||
|
||||
Usage: $0 [-f FILE_PATH] [-d DISK_SIZE] [-v BRIDGE_NAME] [-m BRIDGE_NAME] [-p BRIDGE_NAME]
|
||||
[-k PARAMS] [-r RAM] [-i|-c] [-w] [-b] [-l NAME_LABEL]
|
||||
[-k PARAMS] [-r RAM] [-i|-c] [-w] [-b] [-l NAME_LABEL] [-t TEMPLATE_NW_INSTALL]
|
||||
|
||||
Installs XenServer OpenStack VPX.
|
||||
|
||||
@@ -61,6 +61,7 @@ cat << EOF
|
||||
-r MiB Specifies RAM used by the VPX, in MiB.
|
||||
By default it will take the value from the XVA.
|
||||
-l name Specifies the name label for the VM.
|
||||
-t template Network install an openstack domU from this template
|
||||
|
||||
EXAMPLES:
|
||||
|
||||
@@ -88,7 +89,7 @@ EOF
|
||||
|
||||
get_params()
|
||||
{
|
||||
while getopts "hicwbf:d:v:m:p:k:r:l:" OPTION;
|
||||
while getopts "hicwbf:d:v:m:p:k:r:l:t:" OPTION;
|
||||
do
|
||||
case $OPTION in
|
||||
h) usage
|
||||
@@ -127,9 +128,12 @@ get_params()
|
||||
v)
|
||||
BRIDGE_V=$OPTARG
|
||||
;;
|
||||
l)
|
||||
l)
|
||||
NAME_LABEL=$OPTARG
|
||||
;;
|
||||
t)
|
||||
TEMPLATE_NAME=$OPTARG
|
||||
;;
|
||||
?)
|
||||
usage
|
||||
exit
|
||||
@@ -328,17 +332,11 @@ set_kernel_params()
|
||||
{
|
||||
local v="$1"
|
||||
local args=$KERNEL_PARAMS
|
||||
local cmdline=$(cat /proc/cmdline)
|
||||
for word in $cmdline
|
||||
do
|
||||
if echo "$word" | grep -q "geppetto"
|
||||
then
|
||||
args="$word $args"
|
||||
fi
|
||||
done
|
||||
if [ "$args" != "" ]
|
||||
then
|
||||
echo "Passing Geppetto args to VPX: $args."
|
||||
pvargs=$(xe vm-param-get param-name=PV-args uuid="$v")
|
||||
args="$pvargs $args"
|
||||
xe vm-param-set PV-args="$args" uuid="$v"
|
||||
fi
|
||||
}
|
||||
@@ -422,6 +420,20 @@ then
|
||||
|
||||
destroy_vifs "$vm_uuid"
|
||||
set_all "$vm_uuid"
|
||||
elif [ "$TEMPLATE_NAME" ]
|
||||
then
|
||||
echo $TEMPLATE_NAME
|
||||
vm_uuid=$(xe_min vm-install template="$TEMPLATE_NAME" new-name-label="$NAME_LABEL")
|
||||
destroy_vifs "$vm_uuid"
|
||||
set_auto_start "$vm_uuid"
|
||||
create_gi_vif "$vm_uuid"
|
||||
create_vm_vif "$vm_uuid"
|
||||
create_management_vif "$vm_uuid"
|
||||
create_public_vif "$vm_uuid"
|
||||
set_kernel_params "$vm_uuid"
|
||||
xe vm-param-set other-config:os-vpx=true uuid="$vm_uuid"
|
||||
xe vm-param-set actions-after-reboot=Destroy uuid="$vm_uuid"
|
||||
set_memory "$vm_uuid"
|
||||
else
|
||||
if [ ! -f "$VPX_FILE" ]
|
||||
then
|
||||
|
||||
Executable
+52
@@ -0,0 +1,52 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eux
|
||||
|
||||
action="$1"
|
||||
vm="$2"
|
||||
device="${3-0}"
|
||||
part="${4-}"
|
||||
|
||||
xe_min()
|
||||
{
|
||||
local cmd="$1"
|
||||
shift
|
||||
xe "$cmd" --minimal "$@"
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
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"
|
||||
echo "Your vdi is mounted at $mp"
|
||||
}
|
||||
|
||||
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"
|
||||
|
||||
xe vbd-unplug uuid=$vbd_uuid
|
||||
xe vbd-destroy uuid=$vbd_uuid
|
||||
}
|
||||
|
||||
if [ "$action" == "open" ]
|
||||
then
|
||||
open_vdi
|
||||
elif [ "$action" == "close" ]
|
||||
then
|
||||
close_vdi
|
||||
fi
|
||||
Executable
+24
@@ -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
|
||||
}
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
#Usage: ./templatedelete.sh <template-uuid>
|
||||
|
||||
templateuuid="$1"
|
||||
|
||||
xe template-param-set other-config:default_template=false uuid="$templateuuid"
|
||||
xe template-param-set is-a-template=false uuid="$templateuuid"
|
||||
xe vm-destroy uuid="$templateuuid"
|
||||
@@ -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 @@ destroy_vdi()
|
||||
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 @@ uninstall()
|
||||
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
|
||||
|
||||
Executable
+63
@@ -0,0 +1,63 @@
|
||||
#!/bin/bash
|
||||
## makeubuntu.sh, this creates Ubuntu server 11.10 32 and 64 bit templates
|
||||
## 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.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)
|
||||
|
||||
if [[ -z $LENNY ]] ; then
|
||||
echo "Cant find lenny 32bit template, is this on 6.0.2?"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
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
|
||||
echo "$distro ($arch)" already exists, Skipping
|
||||
else
|
||||
if [ -z $NETINSTALLIP ]
|
||||
then
|
||||
echo "NETINSTALLIP not set in localrc"
|
||||
exit 1
|
||||
fi
|
||||
# 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"
|
||||
pvargs="${pvargs} ${netcfgargs}"
|
||||
fi
|
||||
NEWUUID=$(xe vm-clone uuid=$LENNY new-name-label="$distro ($arch)")
|
||||
xe template-param-set uuid=$NEWUUID other-config:install-methods=http,ftp \
|
||||
other-config:install-repository=http://archive.ubuntu.net/ubuntu \
|
||||
PV-args="$pvargs" \
|
||||
other-config:debian-release=oneiric \
|
||||
other-config:default_template=true
|
||||
|
||||
if [[ "$arch" == "32-bit" ]] ; then
|
||||
xe template-param-set uuid=$NEWUUID other-config:install-arch="i386"
|
||||
else
|
||||
xe template-param-set uuid=$NEWUUID other-config:install-arch="amd64"
|
||||
fi
|
||||
echo "Success"
|
||||
fi
|
||||
done
|
||||
|
||||
echo "Done"
|
||||
+7
-10
@@ -1,16 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Name of this guest
|
||||
GUEST_NAME=${GUEST_NAME:-ALLINONE}
|
||||
GUEST_NAME=${GUEST_NAME:-DevStackOSDomU}
|
||||
|
||||
# Size of image
|
||||
VDI_MB=${VDI_MB:-2500}
|
||||
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,11 +38,5 @@ MGT_BR=${MGT_BR:-""}
|
||||
MGT_VLAN=${MGT_VLAN:-101}
|
||||
MGT_DEV=${MGT_DEV:-eth0}
|
||||
|
||||
# XVA Directory
|
||||
XVA_DIR=${XVA_DIR:-`pwd`/xvas}
|
||||
|
||||
# Path to xva file
|
||||
XVA=${XVA:-$XVA_DIR/$GUEST_NAME.xva }
|
||||
|
||||
# Source params
|
||||
cd ../.. && source ./stackrc && cd $TOP_DIR
|
||||
|
||||
Reference in New Issue
Block a user