Browse code

add --may-exist when adding port to a bridge

When devstack is rerun repeatedly, port and bridges may have already
existed, so when adding port to a bridge, add option to allow port
to pre-exist in the bridge.

Change-Id: Ib102075564c44e45035f3c05ddd909783bfe7f36

Jerry Zhao authored on 2015/08/11 09:28:53
Showing 1 changed files
... ...
@@ -507,7 +507,7 @@ function create_neutron_initial_network {
507 507
         if [[ "$PUBLIC_INTERFACE" == '' || "$OVS_PHYSICAL_BRIDGE" == '' ]]; then
508 508
             die $LINENO "Neutron settings for baremetal not set.. exiting"
509 509
         fi
510
-        sudo ovs-vsctl add-port $OVS_PHYSICAL_BRIDGE $PUBLIC_INTERFACE
510
+        sudo ovs-vsctl --no-wait -- --may-exist add-port $OVS_PHYSICAL_BRIDGE $PUBLIC_INTERFACE
511 511
         for IP in $(ip addr show dev $PUBLIC_INTERFACE | grep ' inet ' | awk '{print $2}'); do
512 512
             sudo ip addr del $IP dev $PUBLIC_INTERFACE
513 513
             sudo ip addr add $IP dev $OVS_PHYSICAL_BRIDGE
... ...
@@ -655,7 +655,7 @@ function start_neutron_agents {
655 655
     run_process q-dhcp "python $AGENT_DHCP_BINARY --config-file $NEUTRON_CONF --config-file=$Q_DHCP_CONF_FILE"
656 656
 
657 657
     if is_provider_network; then
658
-        sudo ovs-vsctl add-port $OVS_PHYSICAL_BRIDGE $PUBLIC_INTERFACE
658
+        sudo ovs-vsctl --no-wait -- --may-exist add-port $OVS_PHYSICAL_BRIDGE $PUBLIC_INTERFACE
659 659
         sudo ip link set $OVS_PHYSICAL_BRIDGE up
660 660
         sudo ip link set br-int up
661 661
         sudo ip link set $PUBLIC_INTERFACE up