Browse code

Merge "Add quantum support for baremetal virtual env."

Jenkins authored on 2013/02/13 01:48:52
Showing 1 changed files
... ...
@@ -270,8 +270,19 @@ function create_quantum_initial_network() {
270 270
     # Create a small network
271 271
     # Since quantum command is executed in admin context at this point,
272 272
     # ``--tenant_id`` needs to be specified.
273
-    NET_ID=$(quantum net-create --tenant_id $TENANT_ID "$PRIVATE_NETWORK_NAME" | grep ' id ' | get_field 2)
274
-    SUBNET_ID=$(quantum subnet-create --tenant_id $TENANT_ID --ip_version 4 --gateway $NETWORK_GATEWAY $NET_ID $FIXED_RANGE | grep ' id ' | get_field 2)
273
+    if is_baremetal; then
274
+        sudo ovs-vsctl add-port $OVS_PHYSICAL_BRIDGE $PUBLIC_INTERFACE
275
+        for IP in $(ip addr show dev $PUBLIC_INTERFACE | grep ' inet ' | awk '{print $2}'); do
276
+            sudo ip addr del $IP dev $PUBLIC_INTERFACE
277
+            sudo ip addr add $IP dev $OVS_PHYSICAL_BRIDGE
278
+        done
279
+        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)
280
+        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)
281
+        sudo ifconfig $OVS_PHYSICAL_BRIDGE up
282
+    else
283
+        NET_ID=$(quantum net-create --tenant_id $TENANT_ID "$PRIVATE_NETWORK_NAME" | grep ' id ' | get_field 2)
284
+        SUBNET_ID=$(quantum subnet-create --tenant_id $TENANT_ID --ip_version 4 --gateway $NETWORK_GATEWAY $NET_ID $FIXED_RANGE | grep ' id ' | get_field 2)
285
+    fi
275 286
 
276 287
     if is_service_enabled q-l3; then
277 288
         # Create a router, and add the private subnet as one of its interfaces