Refactor quantum installation
* Move quantum installation to lib/quantum
* Refactor quantum configuration
* Move Quantum service account creation from keystone_data.sh to lib/quantum
* Define generic functions to install third party programs
* Minor cleanups related to Quantum
* Kill dnsmasq which watches an interface 'ns-XXXXXX' in unstack.sh
* Set default_floating_pool in nova.conf to make default flaoting pool
work when PUBLIC_NETWORK_NAME is other than 'nova'
* Make tempest work even when PRIVATE_NETWORK_NAME is other than 'private'
Change-Id: I4a6e7fcebfb11556968f53ab6a0e862ce16bb139
diff --git a/AUTHORS b/AUTHORS
index cd0acac..ba68e32 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,6 +1,7 @@
Aaron Lee <aaron.lee@rackspace.com>
Aaron Rosen <arosen@nicira.com>
Adam Gandelman <adamg@canonical.com>
+Akihiro MOTOKI <motoki@da.jp.nec.com>
Andrew Laski <andrew.laski@rackspace.com>
Andy Smith <github@anarkystic.com>
Anthony Young <sleepsonthefloor@gmail.com>
diff --git a/files/keystone_data.sh b/files/keystone_data.sh
index 71a8e5e..4c76c9b 100755
--- a/files/keystone_data.sh
+++ b/files/keystone_data.sh
@@ -5,7 +5,6 @@
# Tenant User Roles
# ------------------------------------------------------------------
# service glance admin
-# service quantum admin # if enabled
# service swift admin # if enabled
# service heat admin # if enabled
# service ceilometer admin # if enabled
@@ -148,30 +147,6 @@
fi
fi
-if [[ "$ENABLED_SERVICES" =~ "q-svc" ]]; then
- QUANTUM_USER=$(get_id keystone user-create \
- --name=quantum \
- --pass="$SERVICE_PASSWORD" \
- --tenant_id $SERVICE_TENANT \
- --email=quantum@example.com)
- keystone user-role-add \
- --tenant_id $SERVICE_TENANT \
- --user_id $QUANTUM_USER \
- --role_id $ADMIN_ROLE
- if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then
- QUANTUM_SERVICE=$(get_id keystone service-create \
- --name=quantum \
- --type=network \
- --description="Quantum Service")
- keystone endpoint-create \
- --region RegionOne \
- --service_id $QUANTUM_SERVICE \
- --publicurl "http://$SERVICE_HOST:9696/" \
- --adminurl "http://$SERVICE_HOST:9696/" \
- --internalurl "http://$SERVICE_HOST:9696/"
- fi
-fi
-
if [[ "$ENABLED_SERVICES" =~ "ceilometer" ]]; then
CEILOMETER_USER=$(get_id keystone user-create --name=ceilometer \
--pass="$SERVICE_PASSWORD" \
diff --git a/lib/nova b/lib/nova
index d5cefc9..26c5d3c 100644
--- a/lib/nova
+++ b/lib/nova
@@ -348,6 +348,7 @@
add_nova_opt "dhcpbridge_flagfile=$NOVA_CONF"
add_nova_opt "force_dhcp_release=True"
add_nova_opt "fixed_range=$FIXED_RANGE"
+ add_nova_opt "default_floating_pool=$PUBLIC_NETWORK_NAME"
add_nova_opt "s3_host=$SERVICE_HOST"
add_nova_opt "s3_port=$S3_SERVICE_PORT"
add_nova_opt "osapi_compute_extension=nova.api.openstack.compute.contrib.standard_extensions"
@@ -413,6 +414,16 @@
done
}
+function create_nova_conf_nova_network() {
+ add_nova_opt "network_manager=nova.network.manager.$NET_MAN"
+ add_nova_opt "public_interface=$PUBLIC_INTERFACE"
+ add_nova_opt "vlan_interface=$VLAN_INTERFACE"
+ add_nova_opt "flat_network_bridge=$FLAT_NETWORK_BRIDGE"
+ if [ -n "$FLAT_INTERFACE" ]; then
+ add_nova_opt "flat_interface=$FLAT_INTERFACE"
+ fi
+}
+
# init_nova() - Initialize databases, etc.
function init_nova() {
# Nova Database
diff --git a/lib/quantum b/lib/quantum
index 480aaa1..ea0e311 100644
--- a/lib/quantum
+++ b/lib/quantum
@@ -5,6 +5,36 @@
# ``functions`` file
# ``DEST`` must be defined
+# ``stack.sh`` calls the entry points in this order:
+#
+# install_quantum
+# install_quantumclient
+# install_quantum_agent_packages
+# install_quantum_third_party
+# setup_quantum
+# setup_quantumclient
+# configure_quantum
+# init_quantum
+# configure_quantum_third_party
+# init_quantum_third_party
+# start_quantum_third_party
+# create_nova_conf_quantum
+# start_quantum_service_and_check
+# create_quantum_initial_network
+# setup_quantum_debug
+# start_quantum_agents
+#
+# ``unstack.sh`` calls the entry points in this order:
+#
+# stop_quantum
+
+# Functions in lib/quantum are classified into the following categories:
+#
+# - entry points (called from stack.sh or unstack.sh)
+# - internal functions
+# - quantum exercises
+# - 3rd party programs
+
# Quantum Networking
# ------------------
@@ -31,8 +61,8 @@
set +o xtrace
-# Defaults
-# --------
+# Quantum Network Configuration
+# -----------------------------
# Set up default directories
QUANTUM_DIR=$DEST/quantum
@@ -49,7 +79,6 @@
Q_PORT=${Q_PORT:-9696}
# Default Quantum Host
Q_HOST=${Q_HOST:-$HOST_IP}
-# Which Quantum API nova should use
# Default admin username
Q_ADMIN_USERNAME=${Q_ADMIN_USERNAME:-quantum}
# Default auth strategy
@@ -59,6 +88,8 @@
Q_USE_ROOTWRAP=${Q_USE_ROOTWRAP:-True}
# Meta data IP
Q_META_DATA_IP=${Q_META_DATA_IP:-$HOST_IP}
+# Allow Overlapping IP among subnets
+Q_ALLOW_OVERLAPPING_IP=${Q_ALLOW_OVERLAPPING_IP:-False}
# Use quantum-debug command
Q_USE_DEBUG_COMMAND=${Q_USE_DEBUG_COMMAND:-False}
@@ -70,14 +101,587 @@
QUANTUM_ROOTWRAP=$(get_rootwrap_location quantum)
Q_RR_COMMAND="sudo $QUANTUM_ROOTWRAP $Q_RR_CONF_FILE"
fi
-fi
+ # Provider Network Configurations
+ # --------------------------------
+
+ # The following variables control the Quantum openvswitch and
+ # linuxbridge plugins' allocation of tenant networks and
+ # availability of provider networks. If these are not configured
+ # in localrc, tenant networks will be local to the host (with no
+ # remote connectivity), and no physical resources will be
+ # available for the allocation of provider networks.
+
+ # To use GRE tunnels for tenant networks, set to True in
+ # localrc. GRE tunnels are only supported by the openvswitch
+ # plugin, and currently only on Ubuntu.
+ ENABLE_TENANT_TUNNELS=${ENABLE_TENANT_TUNNELS:-False}
+
+ # If using GRE tunnels for tenant networks, specify the range of
+ # tunnel IDs from which tenant networks are allocated. Can be
+ # overriden in localrc in necesssary.
+ TENANT_TUNNEL_RANGES=${TENANT_TUNNEL_RANGE:-1:1000}
+
+ # To use VLANs for tenant networks, set to True in localrc. VLANs
+ # are supported by the openvswitch and linuxbridge plugins, each
+ # requiring additional configuration described below.
+ ENABLE_TENANT_VLANS=${ENABLE_TENANT_VLANS:-False}
+
+ # If using VLANs for tenant networks, set in localrc to specify
+ # the range of VLAN VIDs from which tenant networks are
+ # allocated. An external network switch must be configured to
+ # trunk these VLANs between hosts for multi-host connectivity.
+ #
+ # Example: ``TENANT_VLAN_RANGE=1000:1999``
+ TENANT_VLAN_RANGE=${TENANT_VLAN_RANGE:-}
+
+ # If using VLANs for tenant networks, or if using flat or VLAN
+ # provider networks, set in localrc to the name of the physical
+ # network, and also configure OVS_PHYSICAL_BRIDGE for the
+ # openvswitch agent or LB_PHYSICAL_INTERFACE for the linuxbridge
+ # agent, as described below.
+ #
+ # Example: ``PHYSICAL_NETWORK=default``
+ PHYSICAL_NETWORK=${PHYSICAL_NETWORK:-}
+
+ # With the openvswitch plugin, if using VLANs for tenant networks,
+ # or if using flat or VLAN provider networks, set in localrc to
+ # the name of the OVS bridge to use for the physical network. The
+ # bridge will be created if it does not already exist, but a
+ # physical interface must be manually added to the bridge as a
+ # port for external connectivity.
+ #
+ # Example: ``OVS_PHYSICAL_BRIDGE=br-eth1``
+ OVS_PHYSICAL_BRIDGE=${OVS_PHYSICAL_BRIDGE:-}
+
+ # With the linuxbridge plugin, if using VLANs for tenant networks,
+ # or if using flat or VLAN provider networks, set in localrc to
+ # the name of the network interface to use for the physical
+ # network.
+ #
+ # Example: ``LB_PHYSICAL_INTERFACE=eth1``
+ LB_PHYSICAL_INTERFACE=${LB_PHYSICAL_INTERFACE:-}
+
+ # With the openvswitch plugin, set to True in localrc to enable
+ # provider GRE tunnels when ``ENABLE_TENANT_TUNNELS`` is False.
+ #
+ # Example: ``OVS_ENABLE_TUNNELING=True``
+ OVS_ENABLE_TUNNELING=${OVS_ENABLE_TUNNELING:-$ENABLE_TENANT_TUNNELS}
+fi
# Entry Points
# ------------
-# configure_quantum_rootwrap() - configure Quantum's rootwrap
-function configure_quantum_rootwrap() {
+# configure_quantum()
+# Set common config for all quantum server and agents.
+function configure_quantum() {
+ _configure_quantum_common
+ _configure_quantum_rpc
+
+ if is_service_enabled q-svc; then
+ _configure_quantum_service
+ fi
+ if is_service_enabled q-agt; then
+ _configure_quantum_plugin_agent
+ fi
+ if is_service_enabled q-dhcp; then
+ _configure_quantum_dhcp_agent
+ fi
+ if is_service_enabled q-l3; then
+ _configure_quantum_l3_agent
+ fi
+ if is_service_enabled q-meta; then
+ _configure_quantum_metadata_agent
+ fi
+
+ _configure_quantum_debug_command
+
+ _cleanup_quantum
+}
+
+function create_nova_conf_quantum() {
+ add_nova_opt "network_api_class=nova.network.quantumv2.api.API"
+ add_nova_opt "quantum_admin_username=$Q_ADMIN_USERNAME"
+ add_nova_opt "quantum_admin_password=$SERVICE_PASSWORD"
+ add_nova_opt "quantum_admin_auth_url=$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_AUTH_PORT/v2.0"
+ add_nova_opt "quantum_auth_strategy=$Q_AUTH_STRATEGY"
+ add_nova_opt "quantum_admin_tenant_name=$SERVICE_TENANT_NAME"
+ add_nova_opt "quantum_url=http://$Q_HOST:$Q_PORT"
+
+ if [[ "$Q_PLUGIN" = "openvswitch" ]]; then
+ NOVA_VIF_DRIVER=${NOVA_VIF_DRIVER:-"nova.virt.libvirt.vif.LibvirtHybridOVSBridgeDriver"}
+ elif [[ "$Q_PLUGIN" = "linuxbridge" ]]; then
+ NOVA_VIF_DRIVER=${NOVA_VIF_DRIVER:-"nova.virt.libvirt.vif.QuantumLinuxBridgeVIFDriver"}
+ elif [[ "$Q_PLUGIN" = "ryu" ]]; then
+ NOVA_VIF_DRIVER=${NOVA_VIF_DRIVER:-"quantum.plugins.ryu.nova.vif.LibvirtOpenVswitchOFPRyuDriver"}
+ add_nova_opt "libvirt_ovs_integration_bridge=$OVS_BRIDGE"
+ add_nova_opt "linuxnet_ovs_ryu_api_host=$RYU_API_HOST:$RYU_API_PORT"
+ add_nova_opt "libvirt_ovs_ryu_api_host=$RYU_API_HOST:$RYU_API_PORT"
+ fi
+ add_nova_opt "libvirt_vif_driver=$NOVA_VIF_DRIVER"
+ add_nova_opt "linuxnet_interface_driver=$LINUXNET_VIF_DRIVER"
+ if is_service_enabled q-meta; then
+ add_nova_opt "service_quantum_metadata_proxy=True"
+ fi
+}
+
+# create_quantum_accounts() - Set up common required quantum accounts
+
+# Tenant User Roles
+# ------------------------------------------------------------------
+# service quantum admin # if enabled
+
+# Migrated from keystone_data.sh
+function create_quantum_accounts() {
+
+ SERVICE_TENANT=$(keystone tenant-list | awk "/ $SERVICE_TENANT_NAME / { print \$2 }")
+ ADMIN_ROLE=$(keystone role-list | awk "/ admin / { print \$2 }")
+
+ if [[ "$ENABLED_SERVICES" =~ "q-svc" ]]; then
+ QUANTUM_USER=$(keystone user-create \
+ --name=quantum \
+ --pass="$SERVICE_PASSWORD" \
+ --tenant_id $SERVICE_TENANT \
+ --email=quantum@example.com \
+ | grep " id " | get_field 2)
+ keystone user-role-add \
+ --tenant_id $SERVICE_TENANT \
+ --user_id $QUANTUM_USER \
+ --role_id $ADMIN_ROLE
+ if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then
+ QUANTUM_SERVICE=$(keystone service-create \
+ --name=quantum \
+ --type=network \
+ --description="Quantum Service" \
+ | grep " id " | get_field 2)
+ keystone endpoint-create \
+ --region RegionOne \
+ --service_id $QUANTUM_SERVICE \
+ --publicurl "http://$SERVICE_HOST:9696/" \
+ --adminurl "http://$SERVICE_HOST:9696/" \
+ --internalurl "http://$SERVICE_HOST:9696/"
+ fi
+ fi
+}
+
+function create_quantum_initial_network() {
+ TENANT_ID=$(keystone tenant-list | grep " demo " | get_field 1)
+
+ # Create a small network
+ # Since quantum command is executed in admin context at this point,
+ # ``--tenant_id`` needs to be specified.
+ NET_ID=$(quantum net-create --tenant_id $TENANT_ID "$PRIVATE_NETWORK_NAME" | grep ' id ' | get_field 2)
+ SUBNET_ID=$(quantum subnet-create --tenant_id $TENANT_ID --ip_version 4 --gateway $NETWORK_GATEWAY $NET_ID $FIXED_RANGE | grep ' id ' | get_field 2)
+
+ if is_service_enabled q-l3; then
+ # Create a router, and add the private subnet as one of its interfaces
+ ROUTER_ID=$(quantum router-create --tenant_id $TENANT_ID router1 | grep ' id ' | get_field 2)
+ quantum router-interface-add $ROUTER_ID $SUBNET_ID
+ # Create an external network, and a subnet. Configure the external network as router gw
+ EXT_NET_ID=$(quantum net-create "$PUBLIC_NETWORK_NAME" -- --router:external=True | grep ' id ' | get_field 2)
+ EXT_GW_IP=$(quantum subnet-create --ip_version 4 $EXT_NET_ID $FLOATING_RANGE -- --enable_dhcp=False | grep 'gateway_ip' | get_field 2)
+ quantum router-gateway-set $ROUTER_ID $EXT_NET_ID
+
+ if is_quantum_ovs_base_plugin "$Q_PLUGIN" && [[ "$Q_USE_NAMESPACE" = "True" ]]; then
+ CIDR_LEN=${FLOATING_RANGE#*/}
+ sudo ip addr add $EXT_GW_IP/$CIDR_LEN dev $PUBLIC_BRIDGE
+ sudo ip link set $PUBLIC_BRIDGE up
+ ROUTER_GW_IP=`quantum port-list -c fixed_ips -c device_owner | grep router_gateway | awk -F '"' '{ print $8; }'`
+ sudo route add -net $FIXED_RANGE gw $ROUTER_GW_IP
+ fi
+ if [[ "$Q_USE_NAMESPACE" == "False" ]]; then
+ # Explicitly set router id in l3 agent configuration
+ iniset $Q_L3_CONF_FILE DEFAULT router_id $ROUTER_ID
+ fi
+ fi
+}
+
+# init_quantum() - Initialize databases, etc.
+function init_quantum() {
+ :
+}
+
+# install_quantum() - Collect source and prepare
+function install_quantum() {
+ git_clone $QUANTUM_REPO $QUANTUM_DIR $QUANTUM_BRANCH
+}
+
+# install_quantumclient() - Collect source and prepare
+function install_quantumclient() {
+ git_clone $QUANTUMCLIENT_REPO $QUANTUMCLIENT_DIR $QUANTUMCLIENT_BRANCH
+}
+
+# install_quantum_agent_packages() - Collect source and prepare
+function install_quantum_agent_packages() {
+ if is_quantum_ovs_base_plugin "$Q_PLUGIN"; then
+ # Install deps
+ # FIXME add to ``files/apts/quantum``, but don't install if not needed!
+ if is_ubuntu; then
+ kernel_version=`cat /proc/version | cut -d " " -f3`
+ install_package make fakeroot dkms openvswitch-switch openvswitch-datapath-dkms linux-headers-$kernel_version
+ else
+ ### FIXME(dtroyer): Find RPMs for OpenVSwitch
+ echo "OpenVSwitch packages need to be located"
+ # Fedora does not started OVS by default
+ restart_service openvswitch
+ fi
+ elif [[ "$Q_PLUGIN" = "linuxbridge" ]]; then
+ install_package bridge-utils
+ fi
+}
+
+function is_quantum_ovs_base_plugin() {
+ local plugin=$1
+ if [[ ",openvswitch,ryu," =~ ,${plugin}, ]]; then
+ return 0
+ fi
+ return 1
+}
+
+function setup_quantum() {
+ setup_develop $QUANTUM_DIR
+}
+
+function setup_quantumclient() {
+ setup_develop $QUANTUMCLIENT_DIR
+}
+
+# Start running processes, including screen
+function start_quantum_service_and_check() {
+ # Start the Quantum service
+ screen_it q-svc "cd $QUANTUM_DIR && python $QUANTUM_DIR/bin/quantum-server --config-file $QUANTUM_CONF --config-file /$Q_PLUGIN_CONF_FILE"
+ echo "Waiting for Quantum to start..."
+ if ! timeout $SERVICE_TIMEOUT sh -c "while ! http_proxy= wget -q -O- http://127.0.0.1:9696; do sleep 1; done"; then
+ echo "Quantum did not start"
+ exit 1
+ fi
+}
+
+# Start running processes, including screen
+function start_quantum_agents() {
+ # Start up the quantum agents if enabled
+ screen_it q-agt "python $AGENT_BINARY --config-file $QUANTUM_CONF --config-file /$Q_PLUGIN_CONF_FILE"
+ screen_it q-dhcp "python $AGENT_DHCP_BINARY --config-file $QUANTUM_CONF --config-file=$Q_DHCP_CONF_FILE"
+ screen_it q-meta "python $AGENT_META_BINARY --config-file $QUANTUM_CONF --config-file=$Q_META_CONF_FILE"
+ screen_it q-l3 "python $AGENT_L3_BINARY --config-file $QUANTUM_CONF --config-file=$Q_L3_CONF_FILE"
+}
+
+# stop_quantum() - Stop running processes (non-screen)
+function stop_quantum() {
+ if is_service_enabled q-dhcp; then
+ pid=$(ps aux | awk '/[d]nsmasq.+interface=(tap|ns-)/ { print $2 }')
+ [ ! -z "$pid" ] && sudo kill -9 $pid
+ fi
+}
+
+# _cleanup_quantum() - Remove residual data files, anything left over from previous
+# runs that a clean run would need to clean up
+function _cleanup_quantum() {
+ :
+}
+
+# _configure_quantum_common()
+# Set common config for all quantum server and agents.
+# This MUST be called before other _configure_quantum_* functions.
+function _configure_quantum_common() {
+ # Put config files in ``QUANTUM_CONF_DIR`` for everyone to find
+ if [[ ! -d $QUANTUM_CONF_DIR ]]; then
+ sudo mkdir -p $QUANTUM_CONF_DIR
+ fi
+ sudo chown `whoami` $QUANTUM_CONF_DIR
+
+ cp $QUANTUM_DIR/etc/quantum.conf $QUANTUM_CONF
+
+ if [[ "$Q_PLUGIN" = "openvswitch" ]]; then
+ Q_PLUGIN_CONF_PATH=etc/quantum/plugins/openvswitch
+ Q_PLUGIN_CONF_FILENAME=ovs_quantum_plugin.ini
+ Q_DB_NAME="ovs_quantum"
+ Q_PLUGIN_CLASS="quantum.plugins.openvswitch.ovs_quantum_plugin.OVSQuantumPluginV2"
+ elif [[ "$Q_PLUGIN" = "linuxbridge" ]]; then
+ Q_PLUGIN_CONF_PATH=etc/quantum/plugins/linuxbridge
+ Q_PLUGIN_CONF_FILENAME=linuxbridge_conf.ini
+ Q_DB_NAME="quantum_linux_bridge"
+ Q_PLUGIN_CLASS="quantum.plugins.linuxbridge.lb_quantum_plugin.LinuxBridgePluginV2"
+ elif [[ "$Q_PLUGIN" = "ryu" ]]; then
+ Q_PLUGIN_CONF_PATH=etc/quantum/plugins/ryu
+ Q_PLUGIN_CONF_FILENAME=ryu.ini
+ Q_DB_NAME="ovs_quantum"
+ Q_PLUGIN_CLASS="quantum.plugins.ryu.ryu_quantum_plugin.RyuQuantumPluginV2"
+ fi
+
+ if [[ $Q_PLUGIN_CONF_PATH == '' || $Q_PLUGIN_CONF_FILENAME == '' || $Q_PLUGIN_CLASS == '' ]]; then
+ echo "Quantum plugin not set.. exiting"
+ exit 1
+ fi
+
+ # If needed, move config file from ``$QUANTUM_DIR/etc/quantum`` to ``QUANTUM_CONF_DIR``
+ mkdir -p /$Q_PLUGIN_CONF_PATH
+ Q_PLUGIN_CONF_FILE=$Q_PLUGIN_CONF_PATH/$Q_PLUGIN_CONF_FILENAME
+ cp $QUANTUM_DIR/$Q_PLUGIN_CONF_FILE /$Q_PLUGIN_CONF_FILE
+
+ database_connection_url dburl $Q_DB_NAME
+ iniset /$Q_PLUGIN_CONF_FILE DATABASE sql_connection $dburl
+ unset dburl
+
+ _quantum_setup_rootwrap
+}
+
+function _configure_quantum_debug_command() {
+ if [[ "$Q_USE_DEBUG_COMMAND" != "True" ]]; then
+ return
+ fi
+
+ cp $QUANTUM_DIR/etc/l3_agent.ini $QUANTUM_TEST_CONFIG_FILE
+
+ iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT verbose False
+ iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT debug False
+ iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT use_namespaces $Q_USE_NAMESPACE
+ iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT root_helper "$Q_RR_COMMAND"
+
+ _quantum_setup_keystone $QUANTUM_TEST_CONFIG_FILE DEFAULT set_auth_url
+ _quantum_setup_interface_driver $QUANTUM_TEST_CONFIG_FILE
+
+ if is_quantum_ovs_base_plugin "$Q_PLUGIN"; then
+ iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT external_network_bridge $PUBLIC_BRIDGE
+ elif [[ "$Q_PLUGIN" = "linuxbridge" ]]; then
+ iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT external_network_bridge ''
+ fi
+
+ if [[ "$Q_PLUGIN" = "ryu" ]]; then
+ iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT ryu_api_host $RYU_API_HOST:$RYU_API_PORT
+ fi
+}
+
+function _configure_quantum_dhcp_agent() {
+ AGENT_DHCP_BINARY="$QUANTUM_DIR/bin/quantum-dhcp-agent"
+ Q_DHCP_CONF_FILE=$QUANTUM_CONF_DIR/dhcp_agent.ini
+
+ cp $QUANTUM_DIR/etc/dhcp_agent.ini $Q_DHCP_CONF_FILE
+
+ iniset $Q_DHCP_CONF_FILE DEFAULT verbose True
+ iniset $Q_DHCP_CONF_FILE DEFAULT debug True
+ iniset $Q_DHCP_CONF_FILE DEFAULT use_namespaces $Q_USE_NAMESPACE
+ iniset $Q_DHCP_CONF_FILE DEFAULT state_path $DATA_DIR/quantum
+ iniset $Q_DHCP_CONF_FILE DEFAULT root_helper "$Q_RR_COMMAND"
+
+ _quantum_setup_keystone $Q_DHCP_CONF_FILE DEFAULT set_auth_url
+ _quantum_setup_interface_driver $Q_DHCP_CONF_FILE
+
+ if [[ "$Q_PLUGIN" = "ryu" ]]; then
+ iniset $Q_DHCP_CONF_FILE DEFAULT ryu_api_host $RYU_API_HOST:$RYU_API_PORT
+ fi
+}
+
+function _configure_quantum_l3_agent() {
+ 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
+
+ iniset $Q_L3_CONF_FILE DEFAULT verbose True
+ iniset $Q_L3_CONF_FILE DEFAULT debug True
+ iniset $Q_L3_CONF_FILE DEFAULT use_namespaces $Q_USE_NAMESPACE
+ iniset $Q_L3_CONF_FILE DEFAULT state_path $DATA_DIR/quantum
+ iniset $Q_L3_CONF_FILE DEFAULT root_helper "$Q_RR_COMMAND"
+
+ _quantum_setup_keystone $Q_L3_CONF_FILE DEFAULT set_auth_url
+ _quantum_setup_interface_driver $Q_L3_CONF_FILE
+
+ if is_quantum_ovs_base_plugin "$Q_PLUGIN"; then
+ iniset $Q_L3_CONF_FILE DEFAULT external_network_bridge $PUBLIC_BRIDGE
+ _quantum_setup_external_bridge $PUBLIC_BRIDGE
+ elif [[ "$Q_PLUGIN" = "linuxbridge" ]]; then
+ iniset $Q_L3_CONF_FILE DEFAULT external_network_bridge ''
+ fi
+
+ if [[ "$Q_PLUGIN" = "ryu" ]]; then
+ iniset $Q_L3_CONF_FILE DEFAULT ryu_api_host $RYU_API_HOST:$RYU_API_PORT
+ fi
+}
+
+function _configure_quantum_metadata_agent() {
+ AGENT_META_BINARY="$QUANTUM_DIR/bin/quantum-metadata-agent"
+ Q_META_CONF_FILE=$QUANTUM_CONF_DIR/metadata_agent.ini
+
+ cp $QUANTUM_DIR/etc/metadata_agent.ini $Q_META_CONF_FILE
+
+ iniset $Q_META_CONF_FILE DEFAULT verbose True
+ iniset $Q_META_CONF_FILE DEFAULT debug True
+ iniset $Q_META_CONF_FILE DEFAULT state_path $DATA_DIR/quantum
+ iniset $Q_META_CONF_FILE DEFAULT nova_metadata_ip $Q_META_DATA_IP
+ iniset $Q_META_CONF_FILE DEFAULT root_helper "$Q_RR_COMMAND"
+
+ _quantum_setup_keystone $Q_META_CONF_FILE DEFAULT set_auth_url
+}
+
+# _configure_quantum_plugin_agent() - Set config files for quantum plugin agent
+# It is called when q-agt is enabled.
+function _configure_quantum_plugin_agent() {
+ # Configure agent for plugin
+ if [[ "$Q_PLUGIN" = "openvswitch" ]]; then
+ _configure_quantum_plugin_agent_openvswitch
+ elif [[ "$Q_PLUGIN" = "linuxbridge" ]]; then
+ _configure_quantum_plugin_agent_linuxbridge
+ elif [[ "$Q_PLUGIN" = "ryu" ]]; then
+ _configure_quantum_plugin_agent_ryu
+ fi
+
+ iniset /$Q_PLUGIN_CONF_FILE AGENT root_helper "$Q_RR_COMMAND"
+}
+
+function _configure_quantum_plugin_agent_linuxbridge() {
+ # Setup physical network interface mappings. Override
+ # ``LB_VLAN_RANGES`` and ``LB_INTERFACE_MAPPINGS`` in ``localrc`` for more
+ # complex physical network configurations.
+ if [[ "$LB_INTERFACE_MAPPINGS" = "" ]] && [[ "$PHYSICAL_NETWORK" != "" ]] && [[ "$LB_PHYSICAL_INTERFACE" != "" ]]; then
+ LB_INTERFACE_MAPPINGS=$PHYSICAL_NETWORK:$LB_PHYSICAL_INTERFACE
+ fi
+ if [[ "$LB_INTERFACE_MAPPINGS" != "" ]]; then
+ iniset /$Q_PLUGIN_CONF_FILE LINUX_BRIDGE physical_interface_mappings $LB_INTERFACE_MAPPINGS
+ fi
+ AGENT_BINARY="$QUANTUM_DIR/bin/quantum-linuxbridge-agent"
+}
+
+function _configure_quantum_plugin_agent_openvswitch() {
+ # Setup integration bridge
+ OVS_BRIDGE=${OVS_BRIDGE:-br-int}
+ _quantum_setup_ovs_bridge $OVS_BRIDGE
+
+ # Setup agent for tunneling
+ if [[ "$OVS_ENABLE_TUNNELING" = "True" ]]; then
+ # Verify tunnels are supported
+ # REVISIT - also check kernel module support for GRE and patch ports
+ OVS_VERSION=`ovs-vsctl --version | head -n 1 | awk '{print $4;}'`
+ if [ $OVS_VERSION \< "1.4" ] && ! is_service_enabled q-svc ; then
+ echo "You are running OVS version $OVS_VERSION."
+ echo "OVS 1.4+ is required for tunneling between multiple hosts."
+ exit 1
+ fi
+ iniset /$Q_PLUGIN_CONF_FILE OVS enable_tunneling True
+ iniset /$Q_PLUGIN_CONF_FILE OVS local_ip $HOST_IP
+ fi
+
+ # Setup physical network bridge mappings. Override
+ # ``OVS_VLAN_RANGES`` and ``OVS_BRIDGE_MAPPINGS`` in ``localrc`` for more
+ # complex physical network configurations.
+ if [[ "$OVS_BRIDGE_MAPPINGS" = "" ]] && [[ "$PHYSICAL_NETWORK" != "" ]] && [[ "$OVS_PHYSICAL_BRIDGE" != "" ]]; then
+ OVS_BRIDGE_MAPPINGS=$PHYSICAL_NETWORK:$OVS_PHYSICAL_BRIDGE
+
+ # Configure bridge manually with physical interface as port for multi-node
+ sudo ovs-vsctl --no-wait -- --may-exist add-br $OVS_PHYSICAL_BRIDGE
+ fi
+ if [[ "$OVS_BRIDGE_MAPPINGS" != "" ]]; then
+ iniset /$Q_PLUGIN_CONF_FILE OVS bridge_mappings $OVS_BRIDGE_MAPPINGS
+ fi
+ AGENT_BINARY="$QUANTUM_DIR/bin/quantum-openvswitch-agent"
+}
+
+function _configure_quantum_plugin_agent_ryu() {
+ # Set up integration bridge
+ OVS_BRIDGE=${OVS_BRIDGE:-br-int}
+ _quantum_setup_ovs_bridge $OVS_BRIDGE
+ if [ -n "$RYU_INTERNAL_INTERFACE" ]; then
+ sudo ovs-vsctl --no-wait -- --may-exist add-port $OVS_BRIDGE $RYU_INTERNAL_INTERFACE
+ fi
+ AGENT_BINARY="$QUANTUM_DIR/quantum/plugins/ryu/agent/ryu_quantum_agent.py"
+}
+
+# Quantum RPC support - must be updated prior to starting any of the services
+function _configure_quantum_rpc() {
+ iniset $QUANTUM_CONF DEFAULT control_exchange quantum
+ if is_service_enabled qpid ; then
+ iniset $QUANTUM_CONF DEFAULT rpc_backend quantum.openstack.common.rpc.impl_qpid
+ elif is_service_enabled zeromq; then
+ iniset $QUANTUM_CONF DEFAULT rpc_backend quantum.openstack.common.rpc.impl_zmq
+ elif [ -n "$RABBIT_HOST" ] && [ -n "$RABBIT_PASSWORD" ]; then
+ iniset $QUANTUM_CONF DEFAULT rabbit_host $RABBIT_HOST
+ iniset $QUANTUM_CONF DEFAULT rabbit_password $RABBIT_PASSWORD
+ fi
+}
+
+# _configure_quantum_service() - Set config files for quantum service
+# It is called when q-svc is enabled.
+function _configure_quantum_service() {
+ Q_API_PASTE_FILE=$QUANTUM_CONF_DIR/api-paste.ini
+ Q_POLICY_FILE=$QUANTUM_CONF_DIR/policy.json
+
+ cp $QUANTUM_DIR/etc/api-paste.ini $Q_API_PASTE_FILE
+ cp $QUANTUM_DIR/etc/policy.json $Q_POLICY_FILE
+
+ if is_service_enabled $DATABASE_BACKENDS; then
+ recreate_database $Q_DB_NAME utf8
+ else
+ echo "A database must be enabled in order to use the $Q_PLUGIN Quantum plugin."
+ exit 1
+ fi
+
+ # Update either configuration file with plugin
+ iniset $QUANTUM_CONF DEFAULT core_plugin $Q_PLUGIN_CLASS
+
+ iniset $QUANTUM_CONF DEFAULT verbose True
+ iniset $QUANTUM_CONF DEFAULT debug True
+ iniset $QUANTUM_CONF DEFAULT allow_overlapping_ips $Q_ALLOW_OVERLAPPING_IP
+
+ iniset $QUANTUM_CONF DEFAULT auth_strategy $Q_AUTH_STRATEGY
+ _quantum_setup_keystone $Q_API_PASTE_FILE filter:authtoken
+
+ # Configure plugin
+ if [[ "$Q_PLUGIN" = "openvswitch" ]]; then
+ if [[ "$ENABLE_TENANT_TUNNELS" = "True" ]]; then
+ iniset /$Q_PLUGIN_CONF_FILE OVS tenant_network_type gre
+ iniset /$Q_PLUGIN_CONF_FILE OVS tunnel_id_ranges $TENANT_TUNNEL_RANGES
+ elif [[ "$ENABLE_TENANT_VLANS" = "True" ]]; then
+ iniset /$Q_PLUGIN_CONF_FILE OVS tenant_network_type vlan
+ else
+ echo "WARNING - The openvswitch plugin is using local tenant networks, with no connectivity between hosts."
+ fi
+
+ # Override ``OVS_VLAN_RANGES`` and ``OVS_BRIDGE_MAPPINGS`` in ``localrc``
+ # for more complex physical network configurations.
+ if [[ "$OVS_VLAN_RANGES" = "" ]] && [[ "$PHYSICAL_NETWORK" != "" ]]; then
+ OVS_VLAN_RANGES=$PHYSICAL_NETWORK
+ if [[ "$TENANT_VLAN_RANGE" != "" ]]; then
+ OVS_VLAN_RANGES=$OVS_VLAN_RANGES:$TENANT_VLAN_RANGE
+ fi
+ fi
+ if [[ "$OVS_VLAN_RANGES" != "" ]]; then
+ iniset /$Q_PLUGIN_CONF_FILE OVS network_vlan_ranges $OVS_VLAN_RANGES
+ fi
+
+ # Enable tunnel networks if selected
+ if [[ $OVS_ENABLE_TUNNELING = "True" ]]; then
+ iniset /$Q_PLUGIN_CONF_FILE OVS enable_tunneling True
+ fi
+ elif [[ "$Q_PLUGIN" = "linuxbridge" ]]; then
+ if [[ "$ENABLE_TENANT_VLANS" = "True" ]]; then
+ iniset /$Q_PLUGIN_CONF_FILE VLANS tenant_network_type vlan
+ else
+ echo "WARNING - The linuxbridge plugin is using local tenant networks, with no connectivity between hosts."
+ fi
+
+ # Override ``LB_VLAN_RANGES`` and ``LB_INTERFACE_MAPPINGS`` in ``localrc``
+ # for more complex physical network configurations.
+ if [[ "$LB_VLAN_RANGES" = "" ]] && [[ "$PHYSICAL_NETWORK" != "" ]]; then
+ LB_VLAN_RANGES=$PHYSICAL_NETWORK
+ if [[ "$TENANT_VLAN_RANGE" != "" ]]; then
+ LB_VLAN_RANGES=$LB_VLAN_RANGES:$TENANT_VLAN_RANGE
+ fi
+ fi
+ if [[ "$LB_VLAN_RANGES" != "" ]]; then
+ iniset /$Q_PLUGIN_CONF_FILE VLANS network_vlan_ranges $LB_VLAN_RANGES
+ fi
+ elif [[ "$Q_PLUGIN" = "ryu" ]]; then
+ iniset /$Q_PLUGIN_CONF_FILE OVS openflow_controller $RYU_OFP_HOST:$RYU_OFP_PORT
+ iniset /$Q_PLUGIN_CONF_FILE OVS openflow_rest_api $RYU_API_HOST:$RYU_API_PORT
+ fi
+}
+
+# Utility Functions
+#------------------
+
+# _quantum_setup_rootwrap() - configure Quantum's rootwrap
+function _quantum_setup_rootwrap() {
if [[ "$Q_USE_ROOTWRAP" == "False" ]]; then
return
fi
@@ -109,7 +713,7 @@
}
# Configures keystone integration for quantum service and agents
-function quantum_setup_keystone() {
+function _quantum_setup_keystone() {
local conf_file=$1
local section=$2
local use_auth_url=$3
@@ -130,39 +734,54 @@
rm -f $QUANTUM_AUTH_CACHE_DIR/*
}
-function quantum_setup_ovs_bridge() {
+function _quantum_setup_ovs_bridge() {
local bridge=$1
- for PORT in `sudo ovs-vsctl --no-wait list-ports $bridge`; do
- if [[ "$PORT" =~ tap* ]]; then echo `sudo ip link delete $PORT` > /dev/null; fi
- sudo ovs-vsctl --no-wait del-port $bridge $PORT
- done
- sudo ovs-vsctl --no-wait -- --if-exists del-br $bridge
- sudo ovs-vsctl --no-wait add-br $bridge
+ quantum-ovs-cleanup --ovs_integration_bridge $bridge
+ sudo ovs-vsctl --no-wait -- --may-exist add-br $bridge
sudo ovs-vsctl --no-wait br-set-external-id $bridge bridge-id $bridge
}
-function quantum_setup_external_bridge() {
+function _quantum_setup_interface_driver() {
+ local conf_file=$1
+ if [[ "$Q_PLUGIN" == "openvswitch" ]]; then
+ iniset $conf_file DEFAULT interface_driver quantum.agent.linux.interface.OVSInterfaceDriver
+ elif [[ "$Q_PLUGIN" = "linuxbridge" ]]; then
+ iniset $conf_file DEFAULT interface_driver quantum.agent.linux.interface.BridgeInterfaceDriver
+ elif [[ "$Q_PLUGIN" = "ryu" ]]; then
+ iniset $conf_file DEFAULT interface_driver quantum.agent.linux.interface.RyuInterfaceDriver
+ fi
+}
+
+function _quantum_setup_external_bridge() {
local bridge=$1
- # Create it if it does not exist
+ quantum-ovs-cleanup --external_network_bridge $bridge
sudo ovs-vsctl --no-wait -- --may-exist add-br $bridge
- # remove internal ports
- for PORT in `sudo ovs-vsctl --no-wait list-ports $bridge`; do
- TYPE=$(sudo ovs-vsctl get interface $PORT type)
- if [[ "$TYPE" == "internal" ]]; then
- echo `sudo ip link delete $PORT` > /dev/null
- sudo ovs-vsctl --no-wait del-port $bridge $PORT
- fi
- done
# ensure no IP is configured on the public bridge
sudo ip addr flush dev $bridge
}
-function is_quantum_ovs_base_plugin() {
- local plugin=$1
- if [[ ",openvswitch,ryu," =~ ,${plugin}, ]]; then
- return 0
+# Functions for Quantum Exercises
+#--------------------------------
+
+function delete_probe() {
+ local from_net="$1"
+ net_id=`_get_net_id $from_net`
+ probe_id=`quantum-debug --os-tenant-name admin --os-username admin --os-password $ADMIN_PASSWORD probe-list -c id -c network_id | grep $net_id | awk '{print $2}'`
+ quantum-debug --os-tenant-name admin --os-username admin probe-delete $probe_id
+}
+
+function setup_quantum_debug() {
+ if [[ "$Q_USE_DEBUG_COMMAND" == "True" ]]; then
+ public_net_id=`_get_net_id $PUBLIC_NETWORK_NAME`
+ quantum-debug --os-tenant-name admin --os-username admin --os-password $ADMIN_PASSWORD probe-create $public_net_id
+ private_net_id=`_get_net_id $PRIVATE_NETWORK_NAME`
+ quantum-debug --os-tenant-name admin --os-username admin --os-password $ADMIN_PASSWORD probe-create $private_net_id
fi
- return 1
+}
+
+function teardown_quantum_debug() {
+ delete_probe $PUBLIC_NETWORK_NAME
+ delete_probe $PRIVATE_NETWORK_NAME
}
function _get_net_id() {
@@ -176,13 +795,6 @@
echo "$Q_RR_COMMAND ip netns exec qprobe-$probe_id"
}
-function delete_probe() {
- local from_net="$1"
- net_id=`_get_net_id $from_net`
- probe_id=`quantum-debug --os-tenant-name admin --os-username admin --os-password $ADMIN_PASSWORD probe-list -c id -c network_id | grep $net_id | awk '{print $2}'`
- quantum-debug --os-tenant-name admin --os-username admin probe-delete $probe_id
-}
-
function _ping_check_quantum() {
local from_net=$1
local ip=$2
@@ -220,17 +832,59 @@
fi
}
-function setup_quantum() {
- public_net_id=`_get_net_id $PUBLIC_NETWORK_NAME`
- quantum-debug --os-tenant-name admin --os-username admin --os-password $ADMIN_PASSWORD probe-create $public_net_id
- private_net_id=`_get_net_id $PRIVATE_NETWORK_NAME`
- quantum-debug --os-tenant-name admin --os-username admin --os-password $ADMIN_PASSWORD probe-create $private_net_id
+# Quantum 3rd party programs
+#---------------------------
+# A comma-separated list of 3rd party programs
+QUANTUM_THIRD_PARTIES="ryu"
+for third_party in ${QUANTUM_THIRD_PARTIES//,/ }; do
+ source lib/$third_party
+done
+
+# configure_quantum_third_party() - Set config files, create data dirs, etc
+function configure_quantum_third_party() {
+ for third_party in ${QUANTUM_THIRD_PARTIES//,/ }; do
+ if is_service_enabled $third_party; then
+ configure_${third_party}
+ fi
+ done
}
-function teardown_quantum() {
- delete_probe $PUBLIC_NETWORK_NAME
- delete_probe $PRIVATE_NETWORK_NAME
+# init_quantum_third_party() - Initialize databases, etc.
+function init_quantum_third_party() {
+ for third_party in ${QUANTUM_THIRD_PARTIES//,/ }; do
+ if is_service_enabled $third_party; then
+ init_${third_party}
+ fi
+ done
}
+# install_quantum_third_party() - Collect source and prepare
+function install_quantum_third_party() {
+ for third_party in ${QUANTUM_THIRD_PARTIES//,/ }; do
+ if is_service_enabled $third_party; then
+ install_${third_party}
+ fi
+ done
+}
+
+# start_quantum_third_party() - Start running processes, including screen
+function start_quantum_third_party() {
+ for third_party in ${QUANTUM_THIRD_PARTIES//,/ }; do
+ if is_service_enabled $third_party; then
+ start_${third_party}
+ fi
+ done
+}
+
+# stop_quantum_third_party - Stop running processes (non-screen)
+function stop_quantum_third_party() {
+ for third_party in ${QUANTUM_THIRD_PARTIES//,/ }; do
+ if is_service_enabled $third_party; then
+ stop_${third_party}
+ fi
+ done
+}
+
+
# Restore xtrace
$XTRACE
diff --git a/lib/ryu b/lib/ryu
new file mode 100644
index 0000000..ac3462b
--- /dev/null
+++ b/lib/ryu
@@ -0,0 +1,63 @@
+# Ryu OpenFlow Controller
+# -----------------------
+
+# Save trace setting
+XTRACE=$(set +o | grep xtrace)
+set +o xtrace
+
+
+RYU_DIR=$DEST/ryu
+# Ryu API Host
+RYU_API_HOST=${RYU_API_HOST:-127.0.0.1}
+# Ryu API Port
+RYU_API_PORT=${RYU_API_PORT:-8080}
+# Ryu OFP Host
+RYU_OFP_HOST=${RYU_OFP_HOST:-127.0.0.1}
+# Ryu OFP Port
+RYU_OFP_PORT=${RYU_OFP_PORT:-6633}
+# Ryu Applications
+RYU_APPS=${RYU_APPS:-ryu.app.simple_isolation,ryu.app.rest}
+
+function configure_ryu() {
+ setup_develop $RYU_DIR
+}
+
+function init_ryu() {
+ RYU_CONF_DIR=/etc/ryu
+ if [[ ! -d $RYU_CONF_DIR ]]; then
+ sudo mkdir -p $RYU_CONF_DIR
+ fi
+ sudo chown `whoami` $RYU_CONF_DIR
+ RYU_CONF=$RYU_CONF_DIR/ryu.conf
+ sudo rm -rf $RYU_CONF
+
+ cat <<EOF > $RYU_CONF
+--app_lists=$RYU_APPS
+--wsapi_host=$RYU_API_HOST
+--wsapi_port=$RYU_API_PORT
+--ofp_listen_host=$RYU_OFP_HOST
+--ofp_tcp_listen_port=$RYU_OFP_PORT
+EOF
+}
+
+function install_ryu() {
+ git_clone $RYU_REPO $RYU_DIR $RYU_BRANCH
+}
+
+function is_ryu_required() {
+ if is_service_enabled ryu || (is_service_enabled quantum && [[ "$Q_PLUGIN" = "ryu" ]]); then
+ return 0
+ fi
+ return 1
+}
+
+function start_ryu() {
+ screen_it ryu "cd $RYU_DIR && $RYU_DIR/bin/ryu-manager --flagfile $RYU_CONF"
+}
+
+function stop_ryu() {
+ :
+}
+
+# Restore xtrace
+$XTRACE
diff --git a/lib/tempest b/lib/tempest
index 1859921..337be75 100644
--- a/lib/tempest
+++ b/lib/tempest
@@ -190,7 +190,7 @@
#Skip until #1074039 is fixed
iniset $TEMPEST_CONF compute run_ssh False
iniset $TEMPEST_CONF compute ssh_user ${DEFAULT_INSTANCE_USER:-$OS_USERNAME}
- iniset $TEMPEST_CONF compute network_for_ssh private
+ iniset $TEMPEST_CONF compute network_for_ssh $PRIVATE_NETWORK_NAME
iniset $TEMPEST_CONF compute ip_version_for_ssh 4
iniset $TEMPEST_CONF compute ssh_timeout 4
iniset $TEMPEST_CONF compute image_ref $image_uuid
@@ -199,7 +199,7 @@
iniset $TEMPEST_CONF compute flavor_ref_alt $flavor_ref_alt
iniset $TEMPEST_CONF compute source_dir $NOVA_SOURCE_DIR
iniset $TEMPEST_CONF compute live_migration_available ${LIVE_MIGRATION_AVAILABLE:-False}
- iniset $TEMPEST_CONF compute use_block_migration_for_live_migration ${USE_BLOCK_MIGRATION_FOR_LIVE_MIGRATION:-False}
+ iniset $TEMPEST_CONF compute use_block_migration_for_live_migration ${USE_BLOCK_MIGRATION_FOR_LIVE_MIGRATION:-False}
# Inherited behavior, might be wrong
iniset $TEMPEST_CONF compute bin_dir $NOVA_BIN_DIR
# TODO(jaypipes): Create the key file here... right now, no whitebox
diff --git a/stack.sh b/stack.sh
index cf638e8..10a8620 100755
--- a/stack.sh
+++ b/stack.sh
@@ -329,18 +329,6 @@
NOVNC_DIR=$DEST/noVNC
SWIFT3_DIR=$DEST/swift3
-RYU_DIR=$DEST/ryu
-# Ryu API Host
-RYU_API_HOST=${RYU_API_HOST:-127.0.0.1}
-# Ryu API Port
-RYU_API_PORT=${RYU_API_PORT:-8080}
-# Ryu OFP Host
-RYU_OFP_HOST=${RYU_OFP_HOST:-127.0.0.1}
-# Ryu OFP Port
-RYU_OFP_PORT=${RYU_OFP_PORT:-6633}
-# Ryu Applications
-RYU_APPS=${RYU_APPS:-ryu.app.simple_isolation,ryu.app.rest}
-
# Should cinder perform secure deletion of volumes?
# Defaults to true, can be set to False to avoid this bug when testing:
# https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1023755
@@ -703,21 +691,7 @@
fi
if is_service_enabled q-agt; then
- if is_quantum_ovs_base_plugin "$Q_PLUGIN"; then
- # Install deps
- # FIXME add to ``files/apts/quantum``, but don't install if not needed!
- if is_ubuntu; then
- kernel_version=`cat /proc/version | cut -d " " -f3`
- install_package make fakeroot dkms openvswitch-switch openvswitch-datapath-dkms linux-headers-$kernel_version
- else
- ### FIXME(dtroyer): Find RPMs for OpenVSwitch
- echo "OpenVSwitch packages need to be located"
- # Fedora does not started OVS by default
- restart_service openvswitch
- fi
- elif [[ "$Q_PLUGIN" = "linuxbridge" ]]; then
- install_package bridge-utils
- fi
+ install_quantum_agent_packages
fi
TRACK_DEPENDS=${TRACK_DEPENDS:-False}
@@ -778,11 +752,9 @@
install_horizon
fi
if is_service_enabled quantum; then
- git_clone $QUANTUMCLIENT_REPO $QUANTUMCLIENT_DIR $QUANTUMCLIENT_BRANCH
-fi
-if is_service_enabled quantum; then
- # quantum
- git_clone $QUANTUM_REPO $QUANTUM_DIR $QUANTUM_BRANCH
+ install_quantum
+ install_quantumclient
+ install_quantum_third_party
fi
if is_service_enabled heat; then
install_heat
@@ -797,9 +769,6 @@
if is_service_enabled tempest; then
install_tempest
fi
-if is_service_enabled ryu || (is_service_enabled quantum && [[ "$Q_PLUGIN" = "ryu" ]]); then
- git_clone $RYU_REPO $RYU_DIR $RYU_BRANCH
-fi
# Initialization
@@ -837,8 +806,8 @@
configure_horizon
fi
if is_service_enabled quantum; then
- setup_develop $QUANTUMCLIENT_DIR
- setup_develop $QUANTUM_DIR
+ setup_quantumclient
+ setup_quantum
fi
if is_service_enabled heat; then
configure_heat
@@ -847,9 +816,6 @@
if is_service_enabled cinder; then
configure_cinder
fi
-if is_service_enabled ryu || (is_service_enabled quantum && [[ "$Q_PLUGIN" = "ryu" ]]); then
- setup_develop $RYU_DIR
-fi
if [[ $TRACK_DEPENDS = True ]] ; then
$DEST/.venv/bin/pip freeze > $DEST/requires-post-pip
@@ -962,6 +928,7 @@
create_keystone_accounts
create_nova_accounts
create_cinder_accounts
+ create_quantum_accounts
# ``keystone_data.sh`` creates services, admin and demo users, and roles.
ADMIN_PASSWORD=$ADMIN_PASSWORD SERVICE_TENANT_NAME=$SERVICE_TENANT_NAME SERVICE_PASSWORD=$SERVICE_PASSWORD \
@@ -1011,392 +978,22 @@
fi
-# Ryu
-# ---
-
-# Ryu is not a part of OpenStack project. Please ignore following block if
-# you are not interested in Ryu.
-# launch ryu manager
-if is_service_enabled ryu; then
- RYU_CONF_DIR=/etc/ryu
- if [[ ! -d $RYU_CONF_DIR ]]; then
- sudo mkdir -p $RYU_CONF_DIR
- fi
- sudo chown `whoami` $RYU_CONF_DIR
- RYU_CONF=$RYU_CONF_DIR/ryu.conf
- sudo rm -rf $RYU_CONF
-
- cat <<EOF > $RYU_CONF
---app_lists=$RYU_APPS
---wsapi_host=$RYU_API_HOST
---wsapi_port=$RYU_API_PORT
---ofp_listen_host=$RYU_OFP_HOST
---ofp_tcp_listen_port=$RYU_OFP_PORT
-EOF
- screen_it ryu "cd $RYU_DIR && $RYU_DIR/bin/ryu-manager --flagfile $RYU_CONF"
-fi
-
-
# Quantum
# -------
-# Quantum Network Configuration
if is_service_enabled quantum; then
echo_summary "Configuring Quantum"
- # The following variables control the Quantum openvswitch and
- # linuxbridge plugins' allocation of tenant networks and
- # availability of provider networks. If these are not configured
- # in localrc, tenant networks will be local to the host (with no
- # remote connectivity), and no physical resources will be
- # available for the allocation of provider networks.
-
- # To use GRE tunnels for tenant networks, set to True in
- # localrc. GRE tunnels are only supported by the openvswitch
- # plugin, and currently only on Ubuntu.
- ENABLE_TENANT_TUNNELS=${ENABLE_TENANT_TUNNELS:-False}
-
- # If using GRE tunnels for tenant networks, specify the range of
- # tunnel IDs from which tenant networks are allocated. Can be
- # overriden in localrc in necesssary.
- TENANT_TUNNEL_RANGES=${TENANT_TUNNEL_RANGE:-1:1000}
-
- # To use VLANs for tenant networks, set to True in localrc. VLANs
- # are supported by the openvswitch and linuxbridge plugins, each
- # requiring additional configuration described below.
- ENABLE_TENANT_VLANS=${ENABLE_TENANT_VLANS:-False}
-
- # If using VLANs for tenant networks, set in localrc to specify
- # the range of VLAN VIDs from which tenant networks are
- # allocated. An external network switch must be configured to
- # trunk these VLANs between hosts for multi-host connectivity.
- #
- # Example: ``TENANT_VLAN_RANGE=1000:1999``
- TENANT_VLAN_RANGE=${TENANT_VLAN_RANGE:-}
-
- # If using VLANs for tenant networks, or if using flat or VLAN
- # provider networks, set in localrc to the name of the physical
- # network, and also configure OVS_PHYSICAL_BRIDGE for the
- # openvswitch agent or LB_PHYSICAL_INTERFACE for the linuxbridge
- # agent, as described below.
- #
- # Example: ``PHYSICAL_NETWORK=default``
- PHYSICAL_NETWORK=${PHYSICAL_NETWORK:-}
-
- # With the openvswitch plugin, if using VLANs for tenant networks,
- # or if using flat or VLAN provider networks, set in localrc to
- # the name of the OVS bridge to use for the physical network. The
- # bridge will be created if it does not already exist, but a
- # physical interface must be manually added to the bridge as a
- # port for external connectivity.
- #
- # Example: ``OVS_PHYSICAL_BRIDGE=br-eth1``
- OVS_PHYSICAL_BRIDGE=${OVS_PHYSICAL_BRIDGE:-}
-
- # With the linuxbridge plugin, if using VLANs for tenant networks,
- # or if using flat or VLAN provider networks, set in localrc to
- # the name of the network interface to use for the physical
- # network.
- #
- # Example: ``LB_PHYSICAL_INTERFACE=eth1``
- LB_PHYSICAL_INTERFACE=${LB_PHYSICAL_INTERFACE:-}
-
- # With the openvswitch plugin, set to True in localrc to enable
- # provider GRE tunnels when ``ENABLE_TENANT_TUNNELS`` is False.
- #
- # Example: ``OVS_ENABLE_TUNNELING=True``
- OVS_ENABLE_TUNNELING=${OVS_ENABLE_TUNNELING:-$ENABLE_TENANT_TUNNELS}
-
- # Put config files in ``QUANTUM_CONF_DIR`` for everyone to find
- if [[ ! -d $QUANTUM_CONF_DIR ]]; then
- sudo mkdir -p $QUANTUM_CONF_DIR
- fi
- sudo chown `whoami` $QUANTUM_CONF_DIR
-
- if [[ "$Q_PLUGIN" = "openvswitch" ]]; then
- Q_PLUGIN_CONF_PATH=etc/quantum/plugins/openvswitch
- Q_PLUGIN_CONF_FILENAME=ovs_quantum_plugin.ini
- Q_DB_NAME="ovs_quantum"
- Q_PLUGIN_CLASS="quantum.plugins.openvswitch.ovs_quantum_plugin.OVSQuantumPluginV2"
- elif [[ "$Q_PLUGIN" = "linuxbridge" ]]; then
- Q_PLUGIN_CONF_PATH=etc/quantum/plugins/linuxbridge
- Q_PLUGIN_CONF_FILENAME=linuxbridge_conf.ini
- Q_DB_NAME="quantum_linux_bridge"
- Q_PLUGIN_CLASS="quantum.plugins.linuxbridge.lb_quantum_plugin.LinuxBridgePluginV2"
- elif [[ "$Q_PLUGIN" = "ryu" ]]; then
- Q_PLUGIN_CONF_PATH=etc/quantum/plugins/ryu
- Q_PLUGIN_CONF_FILENAME=ryu.ini
- Q_DB_NAME="ovs_quantum"
- Q_PLUGIN_CLASS="quantum.plugins.ryu.ryu_quantum_plugin.RyuQuantumPluginV2"
- fi
-
- if [[ $Q_PLUGIN_CONF_PATH == '' || $Q_PLUGIN_CONF_FILENAME == '' || $Q_PLUGIN_CLASS == '' ]]; then
- echo "Quantum plugin not set.. exiting"
- exit 1
- fi
-
- # If needed, move config file from ``$QUANTUM_DIR/etc/quantum`` to ``QUANTUM_CONF_DIR``
- mkdir -p /$Q_PLUGIN_CONF_PATH
- Q_PLUGIN_CONF_FILE=$Q_PLUGIN_CONF_PATH/$Q_PLUGIN_CONF_FILENAME
- cp $QUANTUM_DIR/$Q_PLUGIN_CONF_FILE /$Q_PLUGIN_CONF_FILE
-
- database_connection_url dburl $Q_DB_NAME
- iniset /$Q_PLUGIN_CONF_FILE DATABASE sql_connection $dburl
- unset dburl
-
- cp $QUANTUM_DIR/etc/quantum.conf $QUANTUM_CONF
- configure_quantum_rootwrap
+ configure_quantum
+ init_quantum
fi
-# Quantum service (for controller node)
-if is_service_enabled q-svc; then
- Q_API_PASTE_FILE=$QUANTUM_CONF_DIR/api-paste.ini
- Q_POLICY_FILE=$QUANTUM_CONF_DIR/policy.json
-
- cp $QUANTUM_DIR/etc/api-paste.ini $Q_API_PASTE_FILE
- cp $QUANTUM_DIR/etc/policy.json $Q_POLICY_FILE
-
- if is_service_enabled $DATABASE_BACKENDS; then
- recreate_database $Q_DB_NAME utf8
- else
- echo "A database must be enabled in order to use the $Q_PLUGIN Quantum plugin."
- exit 1
- fi
-
- # Update either configuration file with plugin
- iniset $QUANTUM_CONF DEFAULT core_plugin $Q_PLUGIN_CLASS
-
- iniset $QUANTUM_CONF DEFAULT auth_strategy $Q_AUTH_STRATEGY
- quantum_setup_keystone $Q_API_PASTE_FILE filter:authtoken
-
- # Configure plugin
- if [[ "$Q_PLUGIN" = "openvswitch" ]]; then
- if [[ "$ENABLE_TENANT_TUNNELS" = "True" ]]; then
- iniset /$Q_PLUGIN_CONF_FILE OVS tenant_network_type gre
- iniset /$Q_PLUGIN_CONF_FILE OVS tunnel_id_ranges $TENANT_TUNNEL_RANGES
- elif [[ "$ENABLE_TENANT_VLANS" = "True" ]]; then
- iniset /$Q_PLUGIN_CONF_FILE OVS tenant_network_type vlan
- else
- echo "WARNING - The openvswitch plugin is using local tenant networks, with no connectivity between hosts."
- fi
-
- # Override ``OVS_VLAN_RANGES`` and ``OVS_BRIDGE_MAPPINGS`` in ``localrc``
- # for more complex physical network configurations.
- if [[ "$OVS_VLAN_RANGES" = "" ]] && [[ "$PHYSICAL_NETWORK" != "" ]]; then
- OVS_VLAN_RANGES=$PHYSICAL_NETWORK
- if [[ "$TENANT_VLAN_RANGE" != "" ]]; then
- OVS_VLAN_RANGES=$OVS_VLAN_RANGES:$TENANT_VLAN_RANGE
- fi
- fi
- if [[ "$OVS_VLAN_RANGES" != "" ]]; then
- iniset /$Q_PLUGIN_CONF_FILE OVS network_vlan_ranges $OVS_VLAN_RANGES
- fi
-
- # Enable tunnel networks if selected
- if [[ $OVS_ENABLE_TUNNELING = "True" ]]; then
- iniset /$Q_PLUGIN_CONF_FILE OVS enable_tunneling True
- fi
- elif [[ "$Q_PLUGIN" = "linuxbridge" ]]; then
- if [[ "$ENABLE_TENANT_VLANS" = "True" ]]; then
- iniset /$Q_PLUGIN_CONF_FILE VLANS tenant_network_type vlan
- else
- echo "WARNING - The linuxbridge plugin is using local tenant networks, with no connectivity between hosts."
- fi
-
- # Override ``LB_VLAN_RANGES`` and ``LB_INTERFACE_MAPPINGS`` in ``localrc``
- # for more complex physical network configurations.
- if [[ "$LB_VLAN_RANGES" = "" ]] && [[ "$PHYSICAL_NETWORK" != "" ]]; then
- LB_VLAN_RANGES=$PHYSICAL_NETWORK
- if [[ "$TENANT_VLAN_RANGE" != "" ]]; then
- LB_VLAN_RANGES=$LB_VLAN_RANGES:$TENANT_VLAN_RANGE
- fi
- fi
- if [[ "$LB_VLAN_RANGES" != "" ]]; then
- iniset /$Q_PLUGIN_CONF_FILE VLANS network_vlan_ranges $LB_VLAN_RANGES
- fi
- elif [[ "$Q_PLUGIN" = "ryu" ]]; then
- iniset /$Q_PLUGIN_CONF_FILE OVS openflow_controller $RYU_OFP_HOST:$RYU_OFP_PORT
- iniset /$Q_PLUGIN_CONF_FILE OVS openflow_rest_api $RYU_API_HOST:$RYU_API_PORT
- fi
-fi
-
-# Quantum agent (for compute nodes)
-if is_service_enabled q-agt; then
- # Configure agent for plugin
- if [[ "$Q_PLUGIN" = "openvswitch" ]]; then
- # Setup integration bridge
- OVS_BRIDGE=${OVS_BRIDGE:-br-int}
- quantum_setup_ovs_bridge $OVS_BRIDGE
-
- # Setup agent for tunneling
- if [[ "$OVS_ENABLE_TUNNELING" = "True" ]]; then
- # Verify tunnels are supported
- # REVISIT - also check kernel module support for GRE and patch ports
- OVS_VERSION=`ovs-vsctl --version | head -n 1 | awk '{print $4;}'`
- if [ $OVS_VERSION \< "1.4" ] && ! is_service_enabled q-svc ; then
- echo "You are running OVS version $OVS_VERSION."
- echo "OVS 1.4+ is required for tunneling between multiple hosts."
- exit 1
- fi
- iniset /$Q_PLUGIN_CONF_FILE OVS enable_tunneling True
- iniset /$Q_PLUGIN_CONF_FILE OVS local_ip $HOST_IP
- fi
-
- # Setup physical network bridge mappings. Override
- # ``OVS_VLAN_RANGES`` and ``OVS_BRIDGE_MAPPINGS`` in ``localrc`` for more
- # complex physical network configurations.
- if [[ "$OVS_BRIDGE_MAPPINGS" = "" ]] && [[ "$PHYSICAL_NETWORK" != "" ]] && [[ "$OVS_PHYSICAL_BRIDGE" != "" ]]; then
- OVS_BRIDGE_MAPPINGS=$PHYSICAL_NETWORK:$OVS_PHYSICAL_BRIDGE
-
- # Configure bridge manually with physical interface as port for multi-node
- sudo ovs-vsctl --no-wait -- --may-exist add-br $OVS_PHYSICAL_BRIDGE
- fi
- if [[ "$OVS_BRIDGE_MAPPINGS" != "" ]]; then
- iniset /$Q_PLUGIN_CONF_FILE OVS bridge_mappings $OVS_BRIDGE_MAPPINGS
- fi
- AGENT_BINARY="$QUANTUM_DIR/bin/quantum-openvswitch-agent"
- elif [[ "$Q_PLUGIN" = "linuxbridge" ]]; then
- # Setup physical network interface mappings. Override
- # ``LB_VLAN_RANGES`` and ``LB_INTERFACE_MAPPINGS`` in ``localrc`` for more
- # complex physical network configurations.
- if [[ "$LB_INTERFACE_MAPPINGS" = "" ]] && [[ "$PHYSICAL_NETWORK" != "" ]] && [[ "$LB_PHYSICAL_INTERFACE" != "" ]]; then
- LB_INTERFACE_MAPPINGS=$PHYSICAL_NETWORK:$LB_PHYSICAL_INTERFACE
- fi
- if [[ "$LB_INTERFACE_MAPPINGS" != "" ]]; then
- iniset /$Q_PLUGIN_CONF_FILE LINUX_BRIDGE physical_interface_mappings $LB_INTERFACE_MAPPINGS
- fi
- AGENT_BINARY="$QUANTUM_DIR/bin/quantum-linuxbridge-agent"
- elif [[ "$Q_PLUGIN" = "ryu" ]]; then
- # Set up integration bridge
- OVS_BRIDGE=${OVS_BRIDGE:-br-int}
- quantum_setup_ovs_bridge $OVS_BRIDGE
- if [ -n "$RYU_INTERNAL_INTERFACE" ]; then
- sudo ovs-vsctl --no-wait -- --may-exist add-port $OVS_BRIDGE $RYU_INTERNAL_INTERFACE
- fi
- AGENT_BINARY="$QUANTUM_DIR/quantum/plugins/ryu/agent/ryu_quantum_agent.py"
- fi
- # Update config w/rootwrap
- iniset /$Q_PLUGIN_CONF_FILE AGENT root_helper "$Q_RR_COMMAND"
-fi
-
-# Quantum DHCP
-if is_service_enabled q-dhcp; then
- AGENT_DHCP_BINARY="$QUANTUM_DIR/bin/quantum-dhcp-agent"
-
- Q_DHCP_CONF_FILE=$QUANTUM_CONF_DIR/dhcp_agent.ini
-
- cp $QUANTUM_DIR/etc/dhcp_agent.ini $Q_DHCP_CONF_FILE
-
- # Set verbose
- iniset $Q_DHCP_CONF_FILE DEFAULT verbose True
- # Set debug
- iniset $Q_DHCP_CONF_FILE DEFAULT debug True
- iniset $Q_DHCP_CONF_FILE DEFAULT use_namespaces $Q_USE_NAMESPACE
- iniset $Q_DHCP_CONF_FILE DEFAULT state_path $DATA_DIR/quantum
-
- quantum_setup_keystone $Q_DHCP_CONF_FILE DEFAULT set_auth_url
-
- # Update config w/rootwrap
- iniset $Q_DHCP_CONF_FILE DEFAULT root_helper "$Q_RR_COMMAND"
-
- if [[ "$Q_PLUGIN" = "openvswitch" ]]; then
- iniset $Q_DHCP_CONF_FILE DEFAULT interface_driver quantum.agent.linux.interface.OVSInterfaceDriver
- elif [[ "$Q_PLUGIN" = "linuxbridge" ]]; then
- iniset $Q_DHCP_CONF_FILE DEFAULT interface_driver quantum.agent.linux.interface.BridgeInterfaceDriver
- elif [[ "$Q_PLUGIN" = "ryu" ]]; then
- iniset $Q_DHCP_CONF_FILE DEFAULT interface_driver quantum.agent.linux.interface.RyuInterfaceDriver
- iniset $Q_DHCP_CONF_FILE DEFAULT ryu_api_host $RYU_API_HOST:$RYU_API_PORT
- fi
-fi
-
-# Quantum L3
-if is_service_enabled q-l3; then
- 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
-
- # Set verbose
- iniset $Q_L3_CONF_FILE DEFAULT verbose True
- # Set debug
- iniset $Q_L3_CONF_FILE DEFAULT debug True
-
- iniset $Q_L3_CONF_FILE DEFAULT use_namespaces $Q_USE_NAMESPACE
-
- iniset $Q_L3_CONF_FILE DEFAULT state_path $DATA_DIR/quantum
-
- iniset $Q_L3_CONF_FILE DEFAULT root_helper "$Q_RR_COMMAND"
-
- quantum_setup_keystone $Q_L3_CONF_FILE DEFAULT set_auth_url
- if [[ "$Q_PLUGIN" == "openvswitch" ]]; then
- iniset $Q_L3_CONF_FILE DEFAULT interface_driver quantum.agent.linux.interface.OVSInterfaceDriver
- iniset $Q_L3_CONF_FILE DEFAULT external_network_bridge $PUBLIC_BRIDGE
- # Set up external bridge
- quantum_setup_external_bridge $PUBLIC_BRIDGE
- elif [[ "$Q_PLUGIN" = "linuxbridge" ]]; then
- iniset $Q_L3_CONF_FILE DEFAULT interface_driver quantum.agent.linux.interface.BridgeInterfaceDriver
- iniset $Q_L3_CONF_FILE DEFAULT external_network_bridge ''
- elif [[ "$Q_PLUGIN" = "ryu" ]]; then
- iniset $Q_L3_CONF_FILE DEFAULT interface_driver quantum.agent.linux.interface.RyuInterfaceDriver
- iniset $Q_L3_CONF_FILE DEFAULT external_network_bridge $PUBLIC_BRIDGE
- iniset $Q_L3_CONF_FILE DEFAULT ryu_api_host $RYU_API_HOST:$RYU_API_PORT
- # Set up external bridge
- quantum_setup_external_bridge $PUBLIC_BRIDGE
- fi
-fi
-
-#Quantum Metadata
-if is_service_enabled q-meta; then
- AGENT_META_BINARY="$QUANTUM_DIR/bin/quantum-metadata-agent"
- Q_META_CONF_FILE=$QUANTUM_CONF_DIR/metadata_agent.ini
-
- cp $QUANTUM_DIR/etc/metadata_agent.ini $Q_META_CONF_FILE
-
- # Set verbose
- iniset $Q_META_CONF_FILE DEFAULT verbose True
- # Set debug
- iniset $Q_META_CONF_FILE DEFAULT debug True
-
- iniset $Q_META_CONF_FILE DEFAULT state_path $DATA_DIR/quantum
-
- iniset $Q_META_CONF_FILE DEFAULT nova_metadata_ip $Q_META_DATA_IP
-
- iniset $Q_META_CONF_FILE DEFAULT root_helper "$Q_RR_COMMAND"
-
- quantum_setup_keystone $Q_META_CONF_FILE DEFAULT set_auth_url
-fi
-
-# Quantum RPC support - must be updated prior to starting any of the services
+# Some Quantum plugins require network controllers which are not
+# a part of the OpenStack project. Configure and start them.
if is_service_enabled quantum; then
- iniset $QUANTUM_CONF DEFAULT control_exchange quantum
- if is_service_enabled qpid ; then
- iniset $QUANTUM_CONF DEFAULT rpc_backend quantum.openstack.common.rpc.impl_qpid
- elif is_service_enabled zeromq; then
- iniset $QUANTUM_CONF DEFAULT rpc_backend quantum.openstack.common.rpc.impl_zmq
- elif [ -n "$RABBIT_HOST" ] && [ -n "$RABBIT_PASSWORD" ]; then
- iniset $QUANTUM_CONF DEFAULT rabbit_host $RABBIT_HOST
- iniset $QUANTUM_CONF DEFAULT rabbit_password $RABBIT_PASSWORD
- fi
- if [[ "$Q_USE_DEBUG_COMMAND" == "True" ]]; then
- cp $QUANTUM_DIR/etc/l3_agent.ini $QUANTUM_TEST_CONFIG_FILE
- iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT verbose False
- iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT debug False
- iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT use_namespaces $Q_USE_NAMESPACE
- iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT root_helper "$Q_RR_COMMAND"
- quantum_setup_keystone $QUANTUM_TEST_CONFIG_FILE DEFAULT set_auth_url
- if [[ "$Q_PLUGIN" == "openvswitch" ]]; then
- iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT interface_driver quantum.agent.linux.interface.OVSInterfaceDriver
- iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT external_network_bridge $PUBLIC_BRIDGE
- elif [[ "$Q_PLUGIN" = "linuxbridge" ]]; then
- iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT interface_driver quantum.agent.linux.interface.BridgeInterfaceDriver
- iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT external_network_bridge ''
- elif [[ "$Q_PLUGIN" = "ryu" ]]; then
- iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT interface_driver quantum.agent.linux.interface.RyuInterfaceDriver
- iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT external_network_bridge $PUBLIC_BRIDGE
- iniset $QUANTUM_TEST_CONFIG_FILE DEFAULT ryu_api_host $RYU_API_HOST:$RYU_API_PORT
- fi
- fi
+ configure_quantum_third_party
+ init_quantum_third_party
+ start_quantum_third_party
fi
@@ -1445,37 +1042,9 @@
# Additional Nova configuration that is dependent on other services
if is_service_enabled quantum; then
- add_nova_opt "network_api_class=nova.network.quantumv2.api.API"
- add_nova_opt "quantum_admin_username=$Q_ADMIN_USERNAME"
- add_nova_opt "quantum_admin_password=$SERVICE_PASSWORD"
- add_nova_opt "quantum_admin_auth_url=$KEYSTONE_SERVICE_PROTOCOL://$KEYSTONE_SERVICE_HOST:$KEYSTONE_AUTH_PORT/v2.0"
- add_nova_opt "quantum_auth_strategy=$Q_AUTH_STRATEGY"
- add_nova_opt "quantum_admin_tenant_name=$SERVICE_TENANT_NAME"
- add_nova_opt "quantum_url=http://$Q_HOST:$Q_PORT"
-
- if [[ "$Q_PLUGIN" = "openvswitch" ]]; then
- NOVA_VIF_DRIVER=${NOVA_VIF_DRIVER:-"nova.virt.libvirt.vif.LibvirtHybridOVSBridgeDriver"}
- elif [[ "$Q_PLUGIN" = "linuxbridge" ]]; then
- NOVA_VIF_DRIVER=${NOVA_VIF_DRIVER:-"nova.virt.libvirt.vif.QuantumLinuxBridgeVIFDriver"}
- elif [[ "$Q_PLUGIN" = "ryu" ]]; then
- NOVA_VIF_DRIVER=${NOVA_VIF_DRIVER:-"quantum.plugins.ryu.nova.vif.LibvirtOpenVswitchOFPRyuDriver"}
- add_nova_opt "libvirt_ovs_integration_bridge=$OVS_BRIDGE"
- add_nova_opt "linuxnet_ovs_ryu_api_host=$RYU_API_HOST:$RYU_API_PORT"
- add_nova_opt "libvirt_ovs_ryu_api_host=$RYU_API_HOST:$RYU_API_PORT"
- fi
- add_nova_opt "libvirt_vif_driver=$NOVA_VIF_DRIVER"
- add_nova_opt "linuxnet_interface_driver=$LINUXNET_VIF_DRIVER"
- if is_service_enabled q-meta; then
- add_nova_opt "service_quantum_metadata_proxy=True"
- fi
+ create_nova_conf_quantum
elif is_service_enabled n-net; then
- add_nova_opt "network_manager=nova.network.manager.$NET_MAN"
- add_nova_opt "public_interface=$PUBLIC_INTERFACE"
- add_nova_opt "vlan_interface=$VLAN_INTERFACE"
- add_nova_opt "flat_network_bridge=$FLAT_NETWORK_BRIDGE"
- if [ -n "$FLAT_INTERFACE" ]; then
- add_nova_opt "flat_interface=$FLAT_INTERFACE"
- fi
+ create_nova_conf_nova_network
fi
# All nova-compute workers need to know the vnc configuration options
# These settings don't hurt anything if n-xvnc and n-novnc are disabled
@@ -1584,64 +1153,24 @@
if is_service_enabled q-svc; then
echo_summary "Starting Quantum"
- # Start the Quantum service
- screen_it q-svc "cd $QUANTUM_DIR && python $QUANTUM_DIR/bin/quantum-server --config-file $QUANTUM_CONF --config-file /$Q_PLUGIN_CONF_FILE"
- echo "Waiting for Quantum to start..."
- if ! timeout $SERVICE_TIMEOUT sh -c "while ! http_proxy= wget -q -O- http://127.0.0.1:9696; do sleep 1; done"; then
- echo "Quantum did not start"
- exit 1
- fi
- # Configure Quantum elements
- # Configure internal network & subnet
-
- TENANT_ID=$(keystone tenant-list | grep " demo " | get_field 1)
-
- # Create a small network
- # Since quantum command is executed in admin context at this point,
- # ``--tenant_id`` needs to be specified.
- NET_ID=$(quantum net-create --tenant_id $TENANT_ID "$PRIVATE_NETWORK_NAME" | grep ' id ' | get_field 2)
- SUBNET_ID=$(quantum subnet-create --tenant_id $TENANT_ID --ip_version 4 --gateway $NETWORK_GATEWAY $NET_ID $FIXED_RANGE | grep ' id ' | get_field 2)
- if is_service_enabled q-l3; then
- # Create a router, and add the private subnet as one of its interfaces
- ROUTER_ID=$(quantum router-create --tenant_id $TENANT_ID router1 | grep ' id ' | get_field 2)
- quantum router-interface-add $ROUTER_ID $SUBNET_ID
- # Create an external network, and a subnet. Configure the external network as router gw
- EXT_NET_ID=$(quantum net-create "$PUBLIC_NETWORK_NAME" -- --router:external=True | grep ' id ' | get_field 2)
- EXT_GW_IP=$(quantum subnet-create --ip_version 4 $EXT_NET_ID $FLOATING_RANGE -- --enable_dhcp=False | grep 'gateway_ip' | get_field 2)
- quantum router-gateway-set $ROUTER_ID $EXT_NET_ID
- if is_quantum_ovs_base_plugin "$Q_PLUGIN" && [[ "$Q_USE_NAMESPACE" = "True" ]]; then
- CIDR_LEN=${FLOATING_RANGE#*/}
- sudo ip addr add $EXT_GW_IP/$CIDR_LEN dev $PUBLIC_BRIDGE
- sudo ip link set $PUBLIC_BRIDGE up
- ROUTER_GW_IP=`quantum port-list -c fixed_ips -c device_owner | grep router_gateway | awk -F '"' '{ print $8; }'`
- sudo route add -net $FIXED_RANGE gw $ROUTER_GW_IP
- fi
- if [[ "$Q_USE_NAMESPACE" == "False" ]]; then
- # Explicitly set router id in l3 agent configuration
- iniset $Q_L3_CONF_FILE DEFAULT router_id $ROUTER_ID
- fi
- fi
- if [[ "$Q_USE_DEBUG_COMMAND" == "True" ]]; then
- setup_quantum
- fi
+ start_quantum_service_and_check
+ create_quantum_initial_network
+ setup_quantum_debug
elif is_service_enabled $DATABASE_BACKENDS && is_service_enabled n-net; then
# Create a small network
$NOVA_BIN_DIR/nova-manage network create "$PRIVATE_NETWORK_NAME" $FIXED_RANGE 1 $FIXED_NETWORK_SIZE $NETWORK_CREATE_ARGS
# Create some floating ips
- $NOVA_BIN_DIR/nova-manage floating create $FLOATING_RANGE --pool=$PUBLIC_NETWORK
+ $NOVA_BIN_DIR/nova-manage floating create $FLOATING_RANGE --pool=$PUBLIC_NETWORK_NAME
# Create a second pool
$NOVA_BIN_DIR/nova-manage floating create --ip_range=$TEST_FLOATING_RANGE --pool=$TEST_FLOATING_POOL
fi
-# Start up the quantum agents if enabled
-screen_it q-agt "python $AGENT_BINARY --config-file $QUANTUM_CONF --config-file /$Q_PLUGIN_CONF_FILE"
-screen_it q-dhcp "python $AGENT_DHCP_BINARY --config-file $QUANTUM_CONF --config-file=$Q_DHCP_CONF_FILE"
-screen_it q-meta "python $AGENT_META_BINARY --config-file $QUANTUM_CONF --config-file=$Q_META_CONF_FILE"
-screen_it q-l3 "python $AGENT_L3_BINARY --config-file $QUANTUM_CONF --config-file=$Q_L3_CONF_FILE"
-
+if is_service_enabled quantum; then
+ start_quantum_agents
+fi
if is_service_enabled nova; then
echo_summary "Starting Nova"
start_nova
diff --git a/unstack.sh b/unstack.sh
index 09e0de6..975a079 100755
--- a/unstack.sh
+++ b/unstack.sh
@@ -28,6 +28,7 @@
source $TOP_DIR/lib/cinder
source $TOP_DIR/lib/horizon
source $TOP_DIR/lib/swift
+source $TOP_DIR/lib/quantum
# Determine what system we are running on. This provides ``os_VENDOR``,
# ``os_RELEASE``, ``os_UPDATE``, ``os_PACKAGE``, ``os_CODENAME``
@@ -39,8 +40,7 @@
if [[ "$Q_USE_DEBUG_COMMAND" == "True" ]]; then
source $TOP_DIR/openrc
- source $TOP_DIR/lib/quantum
- teardown_quantum
+ teardown_quantum_debug
fi
# Shut down devstack's screen to get the bulk of OpenStack services in one shot
@@ -119,8 +119,7 @@
fi
fi
-# Quantum dhcp agent runs dnsmasq
-if is_service_enabled q-dhcp; then
- pid=$(ps aux | awk '/[d]nsmasq.+interface=tap/ { print $2 }')
- [ ! -z "$pid" ] && sudo kill -9 $pid
+if is_service_enabled quantum; then
+ stop_quantum
+ stop_quantum_third_party
fi