Merge "Ensure Open vSwitch can be installed on RHEL6."
diff --git a/.mailmap b/.mailmap
new file mode 100644
index 0000000..a49875d
--- /dev/null
+++ b/.mailmap
@@ -0,0 +1,5 @@
+# Format is:
+# <preferred e-mail> <other e-mail 1>
+# <preferred e-mail> <other e-mail 2>
+Jiajun Liu <jiajun@unitedstack.com> <iamljj@gmail.com>
+Jian Wen <jian.wen@canonical.com> <wenjianhn@gmail.com>
\ No newline at end of file
diff --git a/AUTHORS b/AUTHORS
index 718a760..c6b40d8 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -26,6 +26,7 @@
Jason Cannavale <jason.cannavale@rackspace.com>
Jay Pipes <jaypipes@gmail.com>
Jesse Andrews <anotherjesse@gmail.com>
+Jian Wen <jian.wen@canonical.com>
Joe Gordon <jogo@cloudscaling.com>
Johannes Erdfelt <johannes.erdfelt@rackspace.com>
John Postlethwait <john.postlethwait@nebula.com>
@@ -37,6 +38,7 @@
Osamu Habuka <xiu.yushen@gmail.com>
Russell Bryant <rbryant@redhat.com>
Scott Moser <smoser@ubuntu.com>
+Sean Dague <sdague@linux.vnet.ibm.com>
Sumit Naiksatam <sumitnaiksatam@gmail.com>
Thierry Carrez <thierry@openstack.org>
Todd Willey <xtoddx@gmail.com>
diff --git a/README.md b/README.md
index 1987db8..8573638 100644
--- a/README.md
+++ b/README.md
@@ -153,6 +153,7 @@
MYSQL_HOST=$SERVICE_HOST
RABBIT_HOST=$SERVICE_HOST
Q_HOST=$SERVICE_HOST
+ MATCHMAKER_REDIS_HOST=$SERVICE_HOST
# Cells
diff --git a/lib/heat b/lib/heat
index 0c95ebb..4d2f84e 100644
--- a/lib/heat
+++ b/lib/heat
@@ -2,7 +2,7 @@
# Install and start **Heat** service
# To enable, add the following to localrc
-# ENABLED_SERVICES+=,heat,h-api-cfn,h-api-cw,h-eng
+# ENABLED_SERVICES+=,heat,h-api,h-api-cfn,h-api-cw,h-eng
# Dependencies:
# - functions
@@ -193,8 +193,8 @@
# stop_heat() - Stop running processes
function stop_heat() {
- # Kill the cinder screen windows
- for serv in h-eng h-api-cfn h-api-cw; do
+ # Kill the screen windows
+ for serv in h-eng h-api h-api-cfn h-api-cw; do
screen -S $SCREEN_NAME -p $serv -X kill
done
}
diff --git a/lib/nova b/lib/nova
index 9fc4ded..c38f50c 100644
--- a/lib/nova
+++ b/lib/nova
@@ -690,7 +690,7 @@
# The group **$LIBVIRT_GROUP** is added to the current user in this script.
# Use 'sg' to execute nova-compute as a member of the **$LIBVIRT_GROUP** group.
- screen_it n-cpu "cd $NOVA_DIR && sg $LIBVIRT_GROUP \"$NOVA_BIN_DIR/nova-compute --config-file $NOVA_CONF_BOTTOM\""
+ screen_it n-cpu "cd $NOVA_DIR && sg $LIBVIRT_GROUP '$NOVA_BIN_DIR/nova-compute --config-file $NOVA_CONF_BOTTOM'"
screen_it n-crt "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-cert"
screen_it n-net "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-network --config-file $NOVA_CONF_BOTTOM"
screen_it n-sch "cd $NOVA_DIR && $NOVA_BIN_DIR/nova-scheduler --config-file $NOVA_CONF_BOTTOM"
diff --git a/lib/quantum b/lib/quantum
index dfd73e9..c36a743 100644
--- a/lib/quantum
+++ b/lib/quantum
@@ -75,7 +75,7 @@
# Default Quantum Port
Q_PORT=${Q_PORT:-9696}
# Default Quantum Host
-Q_HOST=${Q_HOST:-$HOST_IP}
+Q_HOST=${Q_HOST:-$SERVICE_HOST}
# Default admin username
Q_ADMIN_USERNAME=${Q_ADMIN_USERNAME:-quantum}
# Default auth strategy
@@ -86,7 +86,7 @@
Q_OVS_USE_VETH=${Q_OVS_USE_VETH:-False}
Q_USE_ROOTWRAP=${Q_USE_ROOTWRAP:-True}
# Meta data IP
-Q_META_DATA_IP=${Q_META_DATA_IP:-$HOST_IP}
+Q_META_DATA_IP=${Q_META_DATA_IP:-$SERVICE_HOST}
# Allow Overlapping IP among subnets
Q_ALLOW_OVERLAPPING_IP=${Q_ALLOW_OVERLAPPING_IP:-True}
# Use quantum-debug command
@@ -406,7 +406,14 @@
# cleanup_quantum() - Remove residual data files, anything left over from previous
# runs that a clean run would need to clean up
function cleanup_quantum() {
- :
+ if is_quantum_ovs_base_plugin; then
+ quantum_ovs_base_cleanup
+ fi
+
+ # delete all namespaces created by quantum
+ for ns in $(sudo ip netns list | grep -o -e qdhcp-[0-9a-f\-]* -e qrouter-[0-9a-f\-]*); do
+ sudo ip netns delete ${ns}
+ done
}
# _configure_quantum_common()
@@ -502,7 +509,6 @@
# for l3-agent, only use per tenant router if we have namespaces
Q_L3_ROUTER_PER_TENANT=$Q_USE_NAMESPACE
AGENT_L3_BINARY="$QUANTUM_DIR/bin/quantum-l3-agent"
- PUBLIC_BRIDGE=${PUBLIC_BRIDGE:-br-ex}
Q_L3_CONF_FILE=$QUANTUM_CONF_DIR/l3_agent.ini
cp $QUANTUM_DIR/etc/l3_agent.ini $Q_L3_CONF_FILE
@@ -581,10 +587,6 @@
iniset $QUANTUM_CONF DEFAULT auth_strategy $Q_AUTH_STRATEGY
_quantum_setup_keystone $QUANTUM_CONF keystone_authtoken
- # Comment out keystone authtoken configuration in api-paste.ini
- # It is required to avoid any breakage in Quantum where the sample
- # api-paste.ini has authtoken configurations.
- _quantum_commentout_keystone_authtoken $Q_API_PASTE_FILE filter:authtoken
# Configure plugin
quantum_plugin_configure_service
@@ -655,21 +657,6 @@
rm -f $QUANTUM_AUTH_CACHE_DIR/*
}
-function _quantum_commentout_keystone_authtoken() {
- local conf_file=$1
- local section=$2
-
- inicomment $conf_file $section auth_host
- inicomment $conf_file $section auth_port
- inicomment $conf_file $section auth_protocol
- inicomment $conf_file $section auth_url
-
- inicomment $conf_file $section admin_tenant_name
- inicomment $conf_file $section admin_user
- inicomment $conf_file $section admin_password
- inicomment $conf_file $section signing_dir
-}
-
function _quantum_setup_interface_driver() {
# ovs_use_veth needs to be set before the plugin configuration
diff --git a/lib/quantum_plugins/nec b/lib/quantum_plugins/nec
index 4a2a497..411f5a4 100644
--- a/lib/quantum_plugins/nec
+++ b/lib/quantum_plugins/nec
@@ -17,8 +17,6 @@
OFC_RETRY_MAX=${OFC_RETRY_MAX:-0}
OFC_RETRY_INTERVAL=${OFC_RETRY_INTERVAL:-1}
-OVS_BRIDGE=${OVS_BRIDGE:-br-int}
-
# Main logic
# ---------------------------
diff --git a/lib/quantum_plugins/nicira b/lib/quantum_plugins/nicira
index 305c3bf..fc06b55 100644
--- a/lib/quantum_plugins/nicira
+++ b/lib/quantum_plugins/nicira
@@ -8,7 +8,6 @@
source $TOP_DIR/lib/quantum_plugins/ovs_base
function setup_integration_bridge() {
- OVS_BRIDGE=${OVS_BRIDGE:-br-int}
_quantum_ovs_base_setup_bridge $OVS_BRIDGE
# Set manager to NVP controller (1st of list)
if [[ "$NVP_CONTROLLERS" != "" ]]; then
diff --git a/lib/quantum_plugins/openvswitch b/lib/quantum_plugins/openvswitch
index dda9e61..3741720 100644
--- a/lib/quantum_plugins/openvswitch
+++ b/lib/quantum_plugins/openvswitch
@@ -41,7 +41,6 @@
function quantum_plugin_configure_plugin_agent() {
# Setup integration bridge
- OVS_BRIDGE=${OVS_BRIDGE:-br-int}
_quantum_ovs_base_setup_bridge $OVS_BRIDGE
_quantum_ovs_base_configure_firewall_driver
diff --git a/lib/quantum_plugins/ovs_base b/lib/quantum_plugins/ovs_base
index 2ada0db..a5e03ac 100644
--- a/lib/quantum_plugins/ovs_base
+++ b/lib/quantum_plugins/ovs_base
@@ -5,6 +5,9 @@
MY_XTRACE=$(set +o | grep xtrace)
set +o xtrace
+OVS_BRIDGE=${OVS_BRIDGE:-br-int}
+PUBLIC_BRIDGE=${PUBLIC_BRIDGE:-br-ex}
+
function is_quantum_ovs_base_plugin() {
# Yes, we use OVS.
return 0
@@ -17,6 +20,18 @@
sudo ovs-vsctl --no-wait br-set-external-id $bridge bridge-id $bridge
}
+function quantum_ovs_base_cleanup() {
+ # remove all OVS ports that look like Quantum created ports
+ for port in $(sudo ovs-vsctl list port | grep -o -e tap[0-9a-f\-]* -e q[rg]-[0-9a-f\-]*); do
+ sudo ovs-vsctl del-port ${port}
+ done
+
+ # remove all OVS bridges created by Quantum
+ for bridge in $(sudo ovs-vsctl list-br | grep -o -e ${OVS_BRIDGE} -e ${PUBLIC_BRIDGE}); do
+ sudo ovs-vsctl del-br ${bridge}
+ done
+}
+
function _quantum_ovs_base_install_agent_packages() {
local kernel_version
# Install deps
diff --git a/lib/quantum_plugins/ryu b/lib/quantum_plugins/ryu
index 1b039dc..c482747 100644
--- a/lib/quantum_plugins/ryu
+++ b/lib/quantum_plugins/ryu
@@ -45,7 +45,6 @@
function quantum_plugin_configure_plugin_agent() {
# Set up integration bridge
- OVS_BRIDGE=${OVS_BRIDGE:-br-int}
_quantum_ovs_base_setup_bridge $OVS_BRIDGE
if [ -n "$RYU_INTERNAL_INTERFACE" ]; then
sudo ovs-vsctl --no-wait -- --may-exist add-port $OVS_BRIDGE $RYU_INTERNAL_INTERFACE
diff --git a/lib/quantum_thirdparty/bigswitch_floodlight b/lib/quantum_thirdparty/bigswitch_floodlight
index 60e3924..385bd0d 100644
--- a/lib/quantum_thirdparty/bigswitch_floodlight
+++ b/lib/quantum_thirdparty/bigswitch_floodlight
@@ -7,7 +7,6 @@
BS_FL_CONTROLLERS_PORT=${BS_FL_CONTROLLERS_PORT:-localhost:80}
BS_FL_OF_PORT=${BS_FL_OF_PORT:-6633}
-OVS_BRIDGE=${OVS_BRIDGE:-br-int}
function configure_bigswitch_floodlight() {
:
diff --git a/lib/rpc_backend b/lib/rpc_backend
index fc439ec..4b04053 100644
--- a/lib/rpc_backend
+++ b/lib/rpc_backend
@@ -78,14 +78,18 @@
fi
elif is_service_enabled zeromq; then
if is_fedora; then
- uninstall_package zeromq python-zmq
+ uninstall_package zeromq python-zmq redis
elif is_ubuntu; then
- uninstall_package libzmq1 python-zmq
+ uninstall_package libzmq1 python-zmq redis-server
elif is_suse; then
- uninstall_package libzmq1 python-pyzmq
+ uninstall_package libzmq1 python-pyzmq redis
else
exit_distro_not_supported "zeromq installation"
fi
+
+ # Necessary directory for socket location.
+ sudo mkdir -p /var/run/openstack
+ sudo chown $STACK_USER /var/run/openstack
fi
}
@@ -115,12 +119,15 @@
exit_distro_not_supported "qpid installation"
fi
elif is_service_enabled zeromq; then
+ # NOTE(ewindisch): Redis is not strictly necessary
+ # but there is a matchmaker driver that works
+ # really well & out of the box for multi-node.
if is_fedora; then
- install_package zeromq python-zmq
+ install_package zeromq python-zmq redis
elif is_ubuntu; then
- install_package libzmq1 python-zmq
+ install_package libzmq1 python-zmq redis-server
elif is_suse; then
- install_package libzmq1 python-pyzmq
+ install_package libzmq1 python-pyzmq redis
else
exit_distro_not_supported "zeromq installation"
fi
@@ -158,6 +165,11 @@
local section=$3
if is_service_enabled zeromq; then
iniset $file $section rpc_backend ${package}.openstack.common.rpc.impl_zmq
+ iniset $file $section rpc_zmq_matchmaker \
+ ${package}.openstack.common.rpc.matchmaker_redis.MatchMakerRedis
+ # Set MATCHMAKER_REDIS_HOST if running multi-node.
+ MATCHMAKER_REDIS_HOST=${MATCHMAKER_REDIS_HOST:-127.0.0.1}
+ iniset $file matchmaker_redis host $MATCHMAKER_REDIS_HOST
elif is_service_enabled qpid; then
iniset $file $section rpc_backend ${package}.openstack.common.rpc.impl_qpid
if is_ubuntu; then
diff --git a/openrc b/openrc
index 8af2854..2d5d48a 100644
--- a/openrc
+++ b/openrc
@@ -20,9 +20,6 @@
# Find the other rc files
RC_DIR=$(cd $(dirname "$BASH_SOURCE") && pwd)
-# Import common functions
-source $RC_DIR/functions
-
# Load local configuration
source $RC_DIR/stackrc
@@ -80,7 +77,3 @@
export NOVA_VERSION=${NOVA_VERSION:-1.1}
# In the future this will change names:
export COMPUTE_API_VERSION=${COMPUTE_API_VERSION:-$NOVA_VERSION}
-
-# set log level to DEBUG (helps debug issues)
-# export KEYSTONECLIENT_DEBUG=1
-# export NOVACLIENT_DEBUG=1
diff --git a/stack.sh b/stack.sh
index 3a454d8..9a7f2ab 100755
--- a/stack.sh
+++ b/stack.sh
@@ -626,6 +626,15 @@
# transiently, meaning we avoid the issue of it not being cleaned
# out properly. Note we do this before the track-depends below.
pip_install hgtools
+
+ # The version of python-nose in the RHEL6 repo is incompatible
+ # with Tempest. As a workaround:
+
+ # Install nose 1.1 (Tempest-compatible) from EPEL
+ install_package python-nose1.1
+ # Add a symlink for the new nosetests to allow tox for Tempest to
+ # work unmolested.
+ sudo ln -sf /usr/bin/nosetests1.1 /usr/local/bin/nosetests
fi
TRACK_DEPENDS=${TRACK_DEPENDS:-False}
diff --git a/stackrc b/stackrc
index 871c8a1..edf5a82 100644
--- a/stackrc
+++ b/stackrc
@@ -164,14 +164,25 @@
# Nova hypervisor configuration. We default to libvirt with **kvm** but will
# drop back to **qemu** if we are unable to load the kvm module. ``stack.sh`` can
-# also install an **LXC** or **OpenVZ** based system.
+# also install an **LXC**, **OpenVZ** or **XenAPI** based system.
VIRT_DRIVER=${VIRT_DRIVER:-libvirt}
-LIBVIRT_TYPE=${LIBVIRT_TYPE:-kvm}
-if [[ "$os_VENDOR" =~ (Debian) ]]; then
- LIBVIRT_GROUP=libvirt
-else
- LIBVIRT_GROUP=libvirtd
-fi
+case "$VIRT_DRIVER" in
+ libvirt)
+ LIBVIRT_TYPE=${LIBVIRT_TYPE:-kvm}
+ if [[ "$os_VENDOR" =~ (Debian) ]]; then
+ LIBVIRT_GROUP=libvirt
+ else
+ LIBVIRT_GROUP=libvirtd
+ fi
+ ;;
+ xenserver)
+ # Xen config common to nova and quantum
+ XENAPI_CONNECTION_URL=${XENAPI_CONNECTION_URL:-"http://169.254.0.1"}
+ XENAPI_USER=${XENAPI_USER:-"root"}
+ ;;
+ *)
+ ;;
+esac
# Specify a comma-separated list of UEC images to download and install into glance.
# supported urls here are:
@@ -234,10 +245,6 @@
# Compatibility until it's eradicated from CI
USE_SCREEN=${SCREEN_DEV:-$USE_SCREEN}
-# Xen config common to nova and quantum
-XENAPI_CONNECTION_URL=${XENAPI_CONNECTION_URL:-"http://169.254.0.1"}
-XENAPI_USER=${XENAPI_USER:-"root"}
-
# Local variables:
# mode: shell-script
# End:
diff --git a/tools/xen/README.md b/tools/xen/README.md
index 258d7a3..8f0c10d 100644
--- a/tools/xen/README.md
+++ b/tools/xen/README.md
@@ -8,6 +8,34 @@
machine on the Xenserver host (called OS domU). The VM uses the XAPI toolstack
to communicate with the host.
+The provided localrc helps to build a basic environment.
+The requirements are:
+ - An internet-enabled network with a DHCP server on it
+ - XenServer box plugged in to the same network
+This network will be used as the OpenStack management network. The VM Network
+and the Public Network will not be connected to any physical interfaces, only
+new virtual networks will be created by the `install_os_domU.sh` script.
+
+Steps to follow:
+ - Install XenServer
+ - Download Devstack to XenServer
+ - Customise `localrc`
+ - Start `install_os_domU.sh` script
+
+The `install_os_domU.sh` script will:
+ - Setup XenAPI plugins
+ - Create the named networks, if they don't exist
+ - Install an Ubuntu Virtual Machine, with 4 network interfaces:
+ - eth0 - internal xapi interface
+ - eth1 - VM interface, connected to `VM_BRIDGE_OR_NET_NAME` defaults to
+ `"OpenStack VM Network"`.
+ - eth2 - Management interface, connected to `MGT_BRIDGE_OR_NET_NAME`,
+ defaults to `xenbr0`, XenServer's bridge associated with the Hypervisors
+ `eth0`.
+ - eth3 - Public interface, connected to `PUB_BRIDGE_OR_NET_NAME` defaults to
+ `"OpenStack Public Network"`.
+ - Start devstack inside the created OpenStack VM
+
## Step 1: Install Xenserver
Install XenServer 5.6+ on a clean box. You can get XenServer by signing
up for an account on citrix.com, and then visiting:
@@ -15,13 +43,12 @@
For details on installation, see: http://wiki.openstack.org/XenServer/Install
-Here are some sample Xenserver network settings for when you are just
-getting started (Settings like this have been used with a laptop + cheap wifi router):
-
-* XenServer Host IP: 192.168.1.10
-* XenServer Netmask: 255.255.255.0
-* XenServer Gateway: 192.168.1.1
-* XenServer DNS: 192.168.1.1
+The XenServer IP configuration depends on your local network setup. If you are
+using dhcp, make a reservation for XenServer, so its IP address won't change
+over time. Make a note of the XenServer's IP address, as it has to be specified
+in `localrc`. The other option is to manually specify the IP setup for the
+XenServer box. Please make sure, that a gateway and a nameserver is configured,
+as `install_os_domU.sh` will connect to github.com to get source-code snapshots.
## Step 2: Download devstack
On your XenServer host, run the following commands as root:
@@ -32,45 +59,63 @@
## 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.
+the `XENAPI_PASSWORD` must be your dom0 root password.
Of course, use real passwords if this machine is exposed.
cat > ./localrc <<EOF
+ # Passwords
+ # NOTE: these need to be specified, otherwise devstack will try
+ # to prompt for these passwords, blocking the install process.
+
MYSQL_PASSWORD=my_super_secret
SERVICE_TOKEN=my_super_secret
ADMIN_PASSWORD=my_super_secret
SERVICE_PASSWORD=my_super_secret
RABBIT_PASSWORD=my_super_secret
SWIFT_HASH="66a3d6b56c1f479c8b4e70ab5c2000f5"
- # This is the password for the OpenStack VM (for both stack and root users)
+ # This will be the password for the OpenStack VM (both stack and root users)
GUEST_PASSWORD=my_super_secret
# XenAPI parameters
- # IMPORTANT: The following must be set to your dom0 root password!
+ # NOTE: The following must be set to your XenServer root password!
+
XENAPI_PASSWORD=my_xenserver_root_password
+
XENAPI_CONNECTION_URL="http://address_of_your_xenserver"
VNCSERVER_PROXYCLIENT_ADDRESS=address_of_your_xenserver
- # Do not download the usual images yet!
+ # Do not download the usual images
IMAGE_URLS=""
# Explicitly set virt driver here
VIRT_DRIVER=xenserver
- # Explicitly set multi-host
+ # Explicitly enable multi-host
MULTI_HOST=1
# Give extra time for boot
ACTIVE_TIMEOUT=45
- # Host Interface, i.e. the interface on the nova vm you want to expose the
- # services on. Usually eth2 (management network) or eth3 (public network) and
- # not eth0 (private network with XenServer host) or eth1 (VM traffic network)
- # The default is eth3.
- # HOST_IP_IFACE=eth3
+ # Host Interface, i.e. the interface on the OpenStack vm you want to expose
+ # the services on. The default is eth3, which means the public network, but
+ # as the public network is going to be virtual, we are setting the services
+ # to listen on the management network, which defaults to 'xenbr0', the
+ # XenServer's network.
+ HOST_IP_IFACE=eth2
+
+ # Use DHCP server to configure the Management IP of OpenStack VM
+ MGT_IP="dhcp"
# Settings for netinstalling Ubuntu
- # UBUNTU_INST_RELEASE=precise
+ UBUNTU_INST_RELEASE=precise
- # First time Ubuntu network install params
- # UBUNTU_INST_IFACE="eth3"
- # UBUNTU_INST_IP="dhcp"
+ # First time Ubuntu network install params, use the DHCP server on the
+ # management network
+ UBUNTU_INST_IFACE="eth2"
+ UBUNTU_INST_IP="dhcp"
+
+ # NOTE: the value of FLAT_NETWORK_BRIDGE will automatically be determined
+ # by install_os_domU.sh script.
+
+ # Public IP address is aligned with the devstack defaults (see FLOATING_RANGE)
+ PUB_IP=172.24.4.10
+ PUB_NETMASK=255.255.255.0
EOF
## Step 4: Run `./install_os_domU.sh` from the `tools/xen` directory
diff --git a/tools/xen/functions b/tools/xen/functions
index a7d7798..c6e484d 100644
--- a/tools/xen/functions
+++ b/tools/xen/functions
@@ -65,3 +65,112 @@
function get_local_sr_path {
echo "/var/run/sr-mount/$(get_local_sr)"
}
+
+function find_ip_by_name() {
+ local guest_name="$1"
+ local interface="$2"
+
+ local period=10
+ local max_tries=10
+ local i=0
+
+ while true; do
+ if [ $i -ge $max_tries ]; then
+ echo "Timeout: ip address for interface $interface of $guest_name"
+ exit 11
+ fi
+
+ ipaddress=$(xe vm-list --minimal \
+ name-label=$guest_name \
+ params=networks | sed -ne "s,^.*${interface}/ip: \([0-9.]*\).*\$,\1,p")
+
+ if [ -z "$ipaddress" ]; then
+ sleep $period
+ ((i++))
+ else
+ echo $ipaddress
+ break
+ fi
+ done
+}
+
+function _create_new_network() {
+ local name_label
+ name_label=$1
+
+ xe network-create name-label="$name_label"
+}
+
+function _multiple_networks_with_name() {
+ local name_label
+ name_label=$1
+
+ # A comma indicates multiple matches
+ xe network-list name-label="$name_label" --minimal | grep -q ","
+}
+
+function _network_exists() {
+ local name_label
+ name_label=$1
+
+ ! [ -z $(xe network-list name-label="$name_label" --minimal) ]
+}
+
+function _bridge_exists() {
+ local bridge
+ bridge=$1
+
+ ! [ -z $(xe network-list bridge="$bridge" --minimal) ]
+}
+
+
+function setup_network() {
+ local bridge_or_net_name
+ bridge_or_net_name=$1
+
+ if ! _bridge_exists "$bridge_or_net_name"; then
+ if _network_exists "$bridge_or_net_name"; then
+ if _multiple_networks_with_name "$bridge_or_net_name"; then
+ cat >&2 << EOF
+ERROR: Multiple networks found matching name-label to "$bridge_or_net_name"
+please review your XenServer network configuration / localrc file.
+EOF
+ exit 1
+ fi
+ else
+ _create_new_network "$bridge_or_net_name"
+ fi
+ fi
+}
+
+function bridge_for() {
+ local bridge_or_net_name
+ bridge_or_net_name=$1
+
+ if _bridge_exists "$bridge_or_net_name"; then
+ echo "$bridge_or_net_name"
+ else
+ xe network-list name-label="$bridge_or_net_name" params=bridge --minimal
+ fi
+}
+
+function xenapi_ip_on() {
+ local bridge_or_net_name
+ bridge_or_net_name=$1
+
+ ifconfig $(bridge_for "$bridge_or_net_name") | grep "inet addr" | cut -d ":" -f2 | sed "s/ .*//"
+}
+
+function xenapi_is_listening_on() {
+ local bridge_or_net_name
+ bridge_or_net_name=$1
+
+ ! [ -z $(xenapi_ip_on "$bridge_or_net_name") ]
+}
+
+function parameter_is_specified() {
+ local parameter_name
+ parameter_name=$1
+
+ compgen -v | grep "$parameter_name"
+}
diff --git a/tools/xen/install_os_domU.sh b/tools/xen/install_os_domU.sh
index 0e194fe..161d7e7 100755
--- a/tools/xen/install_os_domU.sh
+++ b/tools/xen/install_os_domU.sh
@@ -67,97 +67,28 @@
#
# Configure Networking
#
+setup_network "$VM_BRIDGE_OR_NET_NAME"
+setup_network "$MGT_BRIDGE_OR_NET_NAME"
+setup_network "$PUB_BRIDGE_OR_NET_NAME"
-# 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)
+if parameter_is_specified "FLAT_NETWORK_BRIDGE"; then
+ cat >&2 << EOF
+ERROR: FLAT_NETWORK_BRIDGE is specified in localrc file
+This is considered as an error, as its value will be derived from the
+VM_BRIDGE_OR_NET_NAME variable's value.
+EOF
+ exit 1
fi
-# dom0 ip, XenAPI is assumed to be listening
-HOST_IP=${HOST_IP:-`ifconfig xenbr0 | grep "inet addr" | cut -d ":" -f2 | sed "s/ .*//"`}
+if ! xenapi_is_listening_on "$MGT_BRIDGE_OR_NET_NAME"; then
+ cat >&2 << EOF
+ERROR: XenAPI does not have an assigned IP address on the management network.
+please review your XenServer network configuration / localrc file.
+EOF
+ exit 1
+fi
+
+HOST_IP=$(xenapi_ip_on "$MGT_BRIDGE_OR_NET_NAME")
# Set up ip forwarding, but skip on xcp-xapi
if [ -a /etc/sysconfig/network ]; then
@@ -263,7 +194,15 @@
# create a new VM with the given template
# creating the correct VIFs and metadata
- $THIS_DIR/scripts/install-os-vpx.sh -t "$UBUNTU_INST_TEMPLATE_NAME" -v $VM_BR -m $MGT_BR -p $PUB_BR -l $GUEST_NAME -r $OSDOMU_MEM_MB -k "flat_network_bridge=${VM_BR}"
+ FLAT_NETWORK_BRIDGE=$(bridge_for "$VM_BRIDGE_OR_NET_NAME")
+ $THIS_DIR/scripts/install-os-vpx.sh \
+ -t "$UBUNTU_INST_TEMPLATE_NAME" \
+ -v "$VM_BRIDGE_OR_NET_NAME" \
+ -m "$MGT_BRIDGE_OR_NET_NAME" \
+ -p "$PUB_BRIDGE_OR_NET_NAME" \
+ -l "$GUEST_NAME" \
+ -r "$OSDOMU_MEM_MB" \
+ -k "flat_network_bridge=${FLAT_NETWORK_BRIDGE}"
# wait for install to finish
wait_for_VM_to_halt
@@ -311,53 +250,26 @@
#
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
+# Get hold of the Management IP of OpenStack VM
+OS_VM_MANAGEMENT_ADDRESS=$MGT_IP
+if [ $OS_VM_MANAGEMENT_ADDRESS == "dhcp" ]; then
+ OS_VM_MANAGEMENT_ADDRESS=$(find_ip_by_name $GUEST_NAME 2)
+fi
+
+# Get hold of the Service IP of OpenStack VM
if [ $HOST_IP_IFACE == "eth2" ]; then
- DOMU_IP=$MGT_IP
+ OS_VM_SERVICES_ADDRESS=$MGT_IP
if [ $MGT_IP == "dhcp" ]; then
- DOMU_IP=$(find_ip_by_name $GUEST_NAME 2)
+ OS_VM_SERVICES_ADDRESS=$(find_ip_by_name $GUEST_NAME 2)
fi
else
- DOMU_IP=$PUB_IP
+ OS_VM_SERVICES_ADDRESS=$PUB_IP
if [ $PUB_IP == "dhcp" ]; then
- DOMU_IP=$(find_ip_by_name $GUEST_NAME 3)
+ OS_VM_SERVICES_ADDRESS=$(find_ip_by_name $GUEST_NAME 3)
fi
fi
@@ -369,11 +281,11 @@
echo "VM Launched - Waiting for startup script"
# wait for log to appear
- while ! ssh_no_check -q stack@$DOMU_IP "[ -e run.sh.log ]"; do
+ while ! ssh_no_check -q stack@$OS_VM_MANAGEMENT_ADDRESS "[ -e run.sh.log ]"; do
sleep 10
done
echo -n "Running"
- while [ `ssh_no_check -q stack@$DOMU_IP pgrep -c run.sh` -ge 1 ]
+ while [ `ssh_no_check -q stack@$OS_VM_MANAGEMENT_ADDRESS pgrep -c run.sh` -ge 1 ]
do
sleep 10
echo -n "."
@@ -382,17 +294,17 @@
set -x
# output the run.sh.log
- ssh_no_check -q stack@$DOMU_IP 'cat run.sh.log'
+ ssh_no_check -q stack@$OS_VM_MANAGEMENT_ADDRESS 'cat run.sh.log'
# Fail if the expected text is not found
- ssh_no_check -q stack@$DOMU_IP 'cat run.sh.log' | grep -q 'stack.sh completed in'
+ ssh_no_check -q stack@$OS_VM_MANAGEMENT_ADDRESS 'cat run.sh.log' | grep -q 'stack.sh completed in'
set +x
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."
+ echo "at http://$OS_VM_SERVICES_ADDRESS, and contact other services at the usual ports."
else
set +x
echo "################################################################################"
@@ -401,9 +313,9 @@
echo "Now, you can monitor the progress of the stack.sh installation by "
echo "tailing /opt/stack/run.sh.log from within your domU."
echo ""
- echo "ssh into your domU now: 'ssh stack@$DOMU_IP' using your password"
+ echo "ssh into your domU now: 'ssh stack@$OS_VM_MANAGEMENT_ADDRESS' 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."
+ echo "at http://$OS_VM_SERVICES_ADDRESS, and contact other services at the usual ports."
fi
diff --git a/tools/xen/scripts/install-os-vpx.sh b/tools/xen/scripts/install-os-vpx.sh
index 241296b..6105a1e 100755
--- a/tools/xen/scripts/install-os-vpx.sh
+++ b/tools/xen/scripts/install-os-vpx.sh
@@ -235,7 +235,7 @@
create_vm_vif()
{
local v="$1"
- echo "Installing management interface on $BRIDGE_V."
+ echo "Installing VM interface on $BRIDGE_V."
local out_network_uuid=$(find_network "$BRIDGE_V")
create_vif "$v" "$out_network_uuid" "1" >/dev/null
}
diff --git a/tools/xen/xenrc b/tools/xen/xenrc
index e50f954..7aaafd2 100644
--- a/tools/xen/xenrc
+++ b/tools/xen/xenrc
@@ -16,6 +16,16 @@
OSDOMU_MEM_MB=1024
OSDOMU_VDI_GB=8
+# Network mapping. Specify bridge names or network names. Network names may
+# differ across localised versions of XenServer. If a given bridge/network
+# was not found, a new network will be created with the specified name.
+
+# The management network is specified by the bridge name. xenbr0 is usually
+# the name of the bridge of the network associated with the hypervisor's eth0.
+MGT_BRIDGE_OR_NET_NAME="xenbr0"
+VM_BRIDGE_OR_NET_NAME="OpenStack VM Network"
+PUB_BRIDGE_OR_NET_NAME="OpenStack Public Network"
+
# VM Password
GUEST_PASSWORD=${GUEST_PASSWORD:-secrete}
@@ -28,28 +38,17 @@
# Our nova host's network info
#
-# A host-only ip that let's the interface come up, otherwise unused
-VM_IP=${VM_IP:-10.255.255.255}
+# Management network
MGT_IP=${MGT_IP:-172.16.100.55}
-PUB_IP=${PUB_IP:-192.168.1.55}
+MGT_NETMASK=${MGT_NETMASK:-255.255.255.0}
+
+# VM Network
+VM_IP=${VM_IP:-10.255.255.255}
+VM_NETMASK=${VM_NETMASK:-255.255.255.0}
# Public network
+PUB_IP=${PUB_IP:-192.168.1.55}
PUB_NETMASK=${PUB_NETMASK:-255.255.255.0}
-PUB_BR=${PUB_BR:-"xenbr0"}
-PUB_VLAN=${PUB_VLAN:--1}
-PUB_DEV=${PUB_DEV:-eth0}
-
-# VM network params
-VM_NETMASK=${VM_NETMASK:-255.255.255.0}
-VM_BR=${VM_BR:-""}
-VM_VLAN=${VM_VLAN:-100}
-VM_DEV=${VM_DEV:-eth0}
-
-# MGMT network params
-MGT_NETMASK=${MGT_NETMASK:-255.255.255.0}
-MGT_BR=${MGT_BR:-""}
-MGT_VLAN=${MGT_VLAN:-101}
-MGT_DEV=${MGT_DEV:-eth0}
# Decide if you should enable eth0,
# the guest installer network
diff --git a/unstack.sh b/unstack.sh
index 3ac2985..d1d0349 100755
--- a/unstack.sh
+++ b/unstack.sh
@@ -109,4 +109,5 @@
if is_service_enabled quantum; then
stop_quantum
stop_quantum_third_party
+ cleanup_quantum
fi