From 37a8d157a11abe55736707fdec2fc8a273027a2f Mon Sep 17 00:00:00 2001 From: Devananda van der Veen Date: Tue, 15 Jan 2013 17:27:34 -0800 Subject: [PATCH] Add quantum support for baremetal virtual env. Add quantum networking support when nova-baremetal is active. This creates a ctlplane network and br-ctlplane bridge, and moves IPs from PHYSICAL_INTERFACE to OVS_PHYSICAL_BRIDGE. Change-Id: If2026c01b93de0ccc7c3f9112de07b3a9c01ac20 --- lib/quantum | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/quantum b/lib/quantum index d5733b3a8e..5b0455800c 100644 --- a/lib/quantum +++ b/lib/quantum @@ -270,8 +270,19 @@ function create_quantum_initial_network() { # 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_baremetal; then + sudo ovs-vsctl add-port $OVS_PHYSICAL_BRIDGE $PUBLIC_INTERFACE + for IP in $(ip addr show dev $PUBLIC_INTERFACE | grep ' inet ' | awk '{print $2}'); do + sudo ip addr del $IP dev $PUBLIC_INTERFACE + sudo ip addr add $IP dev $OVS_PHYSICAL_BRIDGE + done + NET_ID=$(quantum net-create $PHYSICAL_NETWORK --tenant_id $TENANT_ID --provider:network_type flat --provider:physical_network "$PHYSICAL_NETWORK" | grep ' id ' | get_field 2) + SUBNET_ID=$(quantum subnet-create --tenant_id $TENANT_ID --ip_version 4 ${ALLOCATION_POOL:+--allocation-pool $ALLOCATION_POOL} --gateway $NETWORK_GATEWAY $NET_ID $FIXED_RANGE | grep ' id ' | get_field 2) + sudo ifconfig $OVS_PHYSICAL_BRIDGE up + else + 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) + fi if is_service_enabled q-l3; then # Create a router, and add the private subnet as one of its interfaces