X-Git-Url: http://git.cascardo.eti.br/?a=blobdiff_plain;f=rhel%2Fetc_sysconfig_network-scripts_ifup-ovs;h=478c5c393698fa3d3cff1013593887542c2e2b66;hb=81270993ab95b463ffc3a7779a352ee5a6a27f21;hp=3f31c3048e2a37a35208d3f3af3249e60bdd517e;hpb=b49c106ef00438b1c59876dad90d00e8d6e7b627;p=cascardo%2Fovs.git diff --git a/rhel/etc_sysconfig_network-scripts_ifup-ovs b/rhel/etc_sysconfig_network-scripts_ifup-ovs index 3f31c3048..478c5c393 100755 --- a/rhel/etc_sysconfig_network-scripts_ifup-ovs +++ b/rhel/etc_sysconfig_network-scripts_ifup-ovs @@ -85,6 +85,14 @@ case "$TYPE" in OVSBRIDGECONFIGURED="yes" fi + # If MACADDR is provided in the interface configuration file, + # we need to set it using ovs-vsctl; setting it with the "ip" + # command in ifup-eth does not make the change persistent. + if [ -n "$MACADDR" ]; then + ovs-vsctl -t ${TIMEOUT} -- set bridge "$DEVICE" \ + other-config:hwaddr="$MACADDR" + fi + # When dhcp is enabled, the assumption is that there will be a port to # attach (otherwise, we can't reach out for dhcp). So, we do not # configure the bridge through rhel's ifup infrastructure unless @@ -109,27 +117,38 @@ case "$TYPE" in OVSPort) ifup_ovs_bridge ${OTHERSCRIPT} ${CONFIG} ${2} - ovs-vsctl -t ${TIMEOUT} -- --may-exist add-port "$OVS_BRIDGE" "$DEVICE" $OVS_OPTIONS ${OVS_EXTRA+-- $OVS_EXTRA} + # The port might be already in the database but not yet + # in the datapath. So, remove the stale interface first. + ovs-vsctl -t ${TIMEOUT} \ + -- --if-exists del-port "$OVS_BRIDGE" "$DEVICE" \ + -- add-port "$OVS_BRIDGE" "$DEVICE" $OVS_OPTIONS ${OVS_EXTRA+-- $OVS_EXTRA} OVSINTF=${DEVICE} /sbin/ifup "$OVS_BRIDGE" ;; OVSIntPort) ifup_ovs_bridge ovs-vsctl -t ${TIMEOUT} -- --may-exist add-port "$OVS_BRIDGE" "$DEVICE" $OVS_OPTIONS -- set Interface "$DEVICE" type=internal ${OVS_EXTRA+-- $OVS_EXTRA} - ${OTHERSCRIPT} ${CONFIG} ${2} + if [ -n "${OVSDHCPINTERFACES}" ]; then + for _iface in ${OVSDHCPINTERFACES}; do + /sbin/ifup ${_iface} + done + fi + BOOTPROTO="${OVSBOOTPROTO}" ${OTHERSCRIPT} ${CONFIG} ${2} ;; OVSBond) ifup_ovs_bridge for _iface in $BOND_IFACES; do /sbin/ifup ${_iface} done - ovs-vsctl -t ${TIMEOUT} -- --fake-iface add-bond "$OVS_BRIDGE" "$DEVICE" ${BOND_IFACES} $OVS_OPTIONS ${OVS_EXTRA+-- $OVS_EXTRA} - ${OTHERSCRIPT} ${CONFIG} ${2} + ovs-vsctl -t ${TIMEOUT} -- --may-exist add-bond "$OVS_BRIDGE" "$DEVICE" ${BOND_IFACES} $OVS_OPTIONS ${OVS_EXTRA+-- $OVS_EXTRA} OVSINTF=${DEVICE} /sbin/ifup "$OVS_BRIDGE" ;; OVSTunnel) ifup_ovs_bridge ovs-vsctl -t ${TIMEOUT} -- --may-exist add-port "$OVS_BRIDGE" "$DEVICE" $OVS_OPTIONS -- set Interface "$DEVICE" type=$OVS_TUNNEL_TYPE $OVS_TUNNEL_OPTIONS ${OVS_EXTRA+-- $OVS_EXTRA} - ${OTHERSCRIPT} ${CONFIG} ${2} + ;; + OVSPatchPort) + ifup_ovs_bridge + ovs-vsctl -t ${TIMEOUT} -- --may-exist add-port "$OVS_BRIDGE" "$DEVICE" $OVS_OPTIONS -- set Interface "$DEVICE" type=patch options:peer="${OVS_PATCH_PEER}" ${OVS_EXTRA+-- $OVS_EXTRA} ;; *) echo $"Invalid OVS interface type $TYPE"