From ddafb0e40dc1c2491df35b4eca604309e185351e Mon Sep 17 00:00:00 2001 From: Bartosz Zurkowski Date: Thu, 21 Mar 2019 08:57:59 +0100 Subject: [PATCH] Share networks created by Trove Devstack plugin Trove implies strict network requirements. All Trove instances must be launched in a network that is connected to the management network so that Guest Agents residing in the data plane could communicate with control plane services, e.g. RabbitMQ and Trove Conductor. Trove Devstack plugin creates a management network bound to management physnet (trove-mgmt), as well as tenant network (alt-private) connected to it via a router. Consequently, Trove instances deployed in the tenant network can easily access the management services mentioned above. However, these networks are visible only from the perspective of the tenant that created the networks. Since Tempest does not provide an easy way to create a similar management network, and as such does not enable creating tenant network for Trove instances automatically, this change adds --share flag to networks created by Devstack so that Tempest could reuse them. Change-Id: I8c642ab6150858478c48291a51675ef9d15dafaa Signed-off-by: Bartosz Zurkowski --- devstack/plugin.sh | 12 +++++++++--- devstack/settings | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/devstack/plugin.sh b/devstack/plugin.sh index c9d42e7686..2dbcfafb70 100644 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -456,8 +456,14 @@ function set_up_network() { local NET_NAME=$3 local SUBNET_NAME=$4 local IPV6_SUBNET_NAME=$5 + local SHARED=$6 - NEW_NET_ID=$(openstack --os-cloud ${CLOUD_USER} --os-region "$REGION_NAME" network create --project ${PROJECT_ID} "$NET_NAME" | grep ' id ' | get_field 2) + local share_flag="" + if [[ "${SHARED}" == "TRUE" ]]; then + share_flag="--share" + fi + + NEW_NET_ID=$(openstack --os-cloud ${CLOUD_USER} --os-region "$REGION_NAME" network create --project ${PROJECT_ID} ${share_flag} "$NET_NAME" | grep ' id ' | get_field 2) if [[ "$IP_VERSION" =~ 4.* ]]; then NEW_SUBNET_ID=$(_create_private_subnet_v4 ${PROJECT_ID} ${NEW_NET_ID} ${SUBNET_NAME} ${CLOUD_USER}) openstack --os-cloud ${CLOUD_USER} --os-region "$REGION_NAME" router add subnet $ROUTER_ID $NEW_SUBNET_ID @@ -493,14 +499,14 @@ function finalize_trove_network { ALT_PRIVATE_NETWORK_NAME=${TROVE_PRIVATE_NETWORK_NAME} ALT_PRIVATE_SUBNET_NAME=${TROVE_PRIVATE_SUBNET_NAME} ALT_PRIVATE_IPV6_SUBNET_NAME=ipv6-${ALT_PRIVATE_SUBNET_NAME} - ALT_NET_ID=$(set_up_network $ADMIN_ALT_DEMO_CLOUD $ALT_TENANT_ID $ALT_PRIVATE_NETWORK_NAME $ALT_PRIVATE_SUBNET_NAME $ALT_PRIVATE_IPV6_SUBNET_NAME) + ALT_NET_ID=$(set_up_network $ADMIN_ALT_DEMO_CLOUD $ALT_TENANT_ID $ALT_PRIVATE_NETWORK_NAME $ALT_PRIVATE_SUBNET_NAME $ALT_PRIVATE_IPV6_SUBNET_NAME $TROVE_SHARE_NETWORKS) echo "Created network ${ALT_PRIVATE_NETWORK_NAME} (${ALT_NET_ID})" # Set up a management network to test that functionality ALT_MGMT_NETWORK_NAME=trove-mgmt ALT_MGMT_SUBNET_NAME=${ALT_MGMT_NETWORK_NAME}-subnet ALT_MGMT_IPV6_SUBNET_NAME=ipv6-${ALT_MGMT_SUBNET_NAME} - ALT_MGMT_ID=$(set_up_network $ADMIN_ALT_DEMO_CLOUD $ALT_TENANT_ID $ALT_MGMT_NETWORK_NAME $ALT_MGMT_SUBNET_NAME $ALT_MGMT_IPV6_SUBNET_NAME) + ALT_MGMT_ID=$(set_up_network $ADMIN_ALT_DEMO_CLOUD $ALT_TENANT_ID $ALT_MGMT_NETWORK_NAME $ALT_MGMT_SUBNET_NAME $ALT_MGMT_IPV6_SUBNET_NAME $TROVE_SHARE_NETWORKS) echo "Created network ${ALT_MGMT_NETWORK_NAME} (${ALT_MGMT_ID})" # Make sure we can reach the VMs diff --git a/devstack/settings b/devstack/settings index 096be6c9b3..5462654dc0 100644 --- a/devstack/settings +++ b/devstack/settings @@ -58,6 +58,7 @@ if is_service_enabled neutron; then else TROVE_HOST_GATEWAY=${NETWORK_GATEWAY:-10.0.0.1} fi +TROVE_SHARE_NETWORKS=$(trueorfalse TRUE TROVE_SHARE_NETWORKS) # Support entry points installation of console scripts if [[ -d $TROVE_DIR/bin ]]; then