28fc1e
From 490db96efaf89c63656b192d5ca287b0908a6c77 Mon Sep 17 00:00:00 2001
28fc1e
From: Flavio Leitner <fbl@redhat.com>
28fc1e
Date: Tue, 14 Jan 2014 00:22:07 -0200
28fc1e
Subject: [PATCH] rhel: Enable DHCP support for internal ports.
28fc1e
28fc1e
The current initscripts ifup-ovs brings up internal ports as
28fc1e
an ordinary ethernet device, so BOOTPROTO=dhcp|none does not
28fc1e
consider any OVS/bridge detail.
28fc1e
28fc1e
Since DHCP requires a port in the bridge to reach the server,
28fc1e
bring up the required port before in the same way it does for
28fc1e
OVS bridge.
28fc1e
28fc1e
Signed-off-by: Flavio Leitner <fbl@redhat.com>
28fc1e
Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
28fc1e
---
28fc1e
 rhel/README.RHEL                            | 38 +++++++++++++++++++++++++++++
28fc1e
 rhel/etc_sysconfig_network-scripts_ifup-ovs |  7 +++++-
28fc1e
 2 files changed, 44 insertions(+), 1 deletion(-)
28fc1e
28fc1e
diff --git a/rhel/README.RHEL b/rhel/README.RHEL
28fc1e
index 435772f..cb6ab88 100644
28fc1e
--- a/rhel/README.RHEL
28fc1e
+++ b/rhel/README.RHEL
28fc1e
@@ -87,6 +87,44 @@ OVSBOOTPROTO="dhcp"
28fc1e
 OVSDHCPINTERFACES="eth0"
28fc1e
 HOTPLUG=no
28fc1e
 
28fc1e
+
28fc1e
+Adding Internal Port to ovsbridge0:
28fc1e
+
28fc1e
+==> ifcfg-intbr0 <==
28fc1e
+DEVICE=intbr0
28fc1e
+ONBOOT=yes
28fc1e
+DEVICETYPE=ovs
28fc1e
+TYPE=OVSIntPort
28fc1e
+OVS_BRIDGE=ovsbridge0
28fc1e
+HOTPLUG=no
28fc1e
+
28fc1e
+
28fc1e
+Internal Port with fixed IP address:
28fc1e
+
28fc1e
+DEVICE=intbr0
28fc1e
+ONBOOT=yes
28fc1e
+DEVICETYPE=ovs
28fc1e
+TYPE=OVSIntPort
28fc1e
+OVS_BRIDGE=ovsbridge0
28fc1e
+BOOTPROTO=static
28fc1e
+IPADDR=A.B.C.D
28fc1e
+NETMASK=X.Y.Z.0
28fc1e
+HOTPLUG=no
28fc1e
+
28fc1e
+Internal Port with DHCP:
28fc1e
+* Needs OVSBOOTPROTO or BOOTPROTO.
28fc1e
+* All the interfaces that can reach the DHCP server
28fc1e
+as a space separated list in OVSDHCPINTERFACES.
28fc1e
+
28fc1e
+DEVICE=intbr0
28fc1e
+ONBOOT=yes
28fc1e
+DEVICETYPE=ovs
28fc1e
+TYPE=OVSIntPort
28fc1e
+OVS_BRIDGE=ovsbridge0
28fc1e
+OVSBOOTPROTO="dhcp"
28fc1e
+OVSDHCPINTERFACES="eth0"
28fc1e
+HOTPLUG=no
28fc1e
+
28fc1e
 Adding physical eth0 to ovsbridge0 described above:
28fc1e
 
28fc1e
 ==> ifcfg-eth0 <==
28fc1e
diff --git a/rhel/etc_sysconfig_network-scripts_ifup-ovs b/rhel/etc_sysconfig_network-scripts_ifup-ovs
28fc1e
index 3f31c30..0ee7b21 100755
28fc1e
--- a/rhel/etc_sysconfig_network-scripts_ifup-ovs
28fc1e
+++ b/rhel/etc_sysconfig_network-scripts_ifup-ovs
28fc1e
@@ -115,7 +115,12 @@ case "$TYPE" in
28fc1e
 	OVSIntPort)
28fc1e
 		ifup_ovs_bridge
28fc1e
 		ovs-vsctl -t ${TIMEOUT} -- --may-exist add-port "$OVS_BRIDGE" "$DEVICE" $OVS_OPTIONS -- set Interface "$DEVICE" type=internal ${OVS_EXTRA+-- $OVS_EXTRA}
28fc1e
-		${OTHERSCRIPT} ${CONFIG} ${2}
28fc1e
+		if [ -n "${OVSDHCPINTERFACES}" ]; then
28fc1e
+			for _iface in ${OVSDHCPINTERFACES}; do
28fc1e
+				/sbin/ifup ${_iface}
28fc1e
+			done
28fc1e
+		fi
28fc1e
+		BOOTPROTO="${OVSBOOTPROTO}" ${OTHERSCRIPT} ${CONFIG} ${2}
28fc1e
 		;;
28fc1e
 	OVSBond)
28fc1e
 		ifup_ovs_bridge
28fc1e
-- 
28fc1e
1.8.4.2
28fc1e