Improve quantum l3 and tempest config.

* Previously, configuration for the q-l3 agent was creating a
   tenant-owned router.  This change maintains that behaviour if
   namespaces are enabled, but creates a public (not tenant-owned)
   router if namespaces are disabled.  Since the L3 agent can only
   manage a single router if namespaces are disabled, the change
   ensures that the single router can be shared by multiple tenants.
 * Add tempest configuration for the public router.

Change-Id: I2878a7eb9797bfd71082a55d4773519dc5198abc
This commit is contained in:
Maru Newby 2012-12-19 03:59:20 +00:00
parent f7e7c6f29f
commit 31c94ab510
2 changed files with 21 additions and 1 deletions

View File

@ -92,6 +92,8 @@ Q_META_DATA_IP=${Q_META_DATA_IP:-$HOST_IP}
Q_ALLOW_OVERLAPPING_IP=${Q_ALLOW_OVERLAPPING_IP:-False} Q_ALLOW_OVERLAPPING_IP=${Q_ALLOW_OVERLAPPING_IP:-False}
# Use quantum-debug command # Use quantum-debug command
Q_USE_DEBUG_COMMAND=${Q_USE_DEBUG_COMMAND:-False} Q_USE_DEBUG_COMMAND=${Q_USE_DEBUG_COMMAND:-False}
# The name of the default q-l3 router
Q_ROUTER_NAME=${Q_ROUTER_NAME:-router1}
if is_service_enabled quantum; then if is_service_enabled quantum; then
Q_RR_CONF_FILE=$QUANTUM_CONF_DIR/rootwrap.conf Q_RR_CONF_FILE=$QUANTUM_CONF_DIR/rootwrap.conf
@ -277,7 +279,14 @@ function create_quantum_initial_network() {
if is_service_enabled q-l3; then if is_service_enabled q-l3; then
# Create a router, and add the private subnet as one of its interfaces # 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) if [[ "$Q_USE_NAMESPACE" == "True" ]]; then
# If namespaces are enabled, create a tenant-owned router.
ROUTER_ID=$(quantum router-create --tenant_id $TENANT_ID $Q_ROUTER_NAME | grep ' id ' | get_field 2)
else
# If namespaces are disabled, the L3 agent can only target
# a single router, which should not be tenant-owned.
ROUTER_ID=$(quantum router-create $Q_ROUTER_NAME | grep ' id ' | get_field 2)
fi
quantum router-interface-add $ROUTER_ID $SUBNET_ID quantum router-interface-add $ROUTER_ID $SUBNET_ID
# Create an external network, and a subnet. Configure the external network as router gw # 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_NET_ID=$(quantum net-create "$PUBLIC_NETWORK_NAME" -- --router:external=True | grep ' id ' | get_field 2)

View File

@ -11,6 +11,9 @@
# - ``S3_SERVICE_PORT`` # - ``S3_SERVICE_PORT``
# - ``SERVICE_HOST`` # - ``SERVICE_HOST``
# - ``BASE_SQL_CONN`` ``lib/database`` declares # - ``BASE_SQL_CONN`` ``lib/database`` declares
# - ``PUBLIC_NETWORK_NAME``
# - ``Q_USE_NAMESPACE``
# - ``Q_ROUTER_NAME``
# Optional Dependencies: # Optional Dependencies:
# IDENTITY_USE_SSL, IDENTITY_HOST, IDENTITY_PORT, IDENTITY_PATH # IDENTITY_USE_SSL, IDENTITY_HOST, IDENTITY_PORT, IDENTITY_PATH
# ALT_* (similar vars exists in keystone_data.sh) # ALT_* (similar vars exists in keystone_data.sh)
@ -61,6 +64,7 @@ function configure_tempest() {
local flavors_ref local flavors_ref
local flavor_lines local flavor_lines
local public_network_id local public_network_id
local public_router_id
local tenant_networks_reachable local tenant_networks_reachable
# TODO(afazekas): # TODO(afazekas):
@ -175,6 +179,12 @@ function configure_tempest() {
if is_service_enabled q-l3; then if is_service_enabled q-l3; then
public_network_id=$(quantum net-list | grep $PUBLIC_NETWORK_NAME | \ public_network_id=$(quantum net-list | grep $PUBLIC_NETWORK_NAME | \
awk '{print $2}') awk '{print $2}')
if [ "$Q_USE_NAMESPACE" == "False" ]; then
# If namespaces are disabled, devstack will create a single
# public router that tempest should be configured to use.
public_router_id=$(quantum router-list | awk "/ $Q_ROUTER_NAME / \
{ print \$2 }")
fi
fi fi
# Timeouts # Timeouts
@ -243,6 +253,7 @@ function configure_tempest() {
iniset $TEMPEST_CONF network password "$password" iniset $TEMPEST_CONF network password "$password"
iniset $TEMPEST_CONF network tenant_networks_reachable "$tenant_networks_reachable" iniset $TEMPEST_CONF network tenant_networks_reachable "$tenant_networks_reachable"
iniset $TEMPEST_CONF network public_network_id "$public_network_id" iniset $TEMPEST_CONF network public_network_id "$public_network_id"
iniset $TEMPEST_CONF network public_router_id "$public_router_id"
#boto #boto
iniset $TEMPEST_CONF boto ec2_url "http://$SERVICE_HOST:8773/services/Cloud" iniset $TEMPEST_CONF boto ec2_url "http://$SERVICE_HOST:8773/services/Cloud"