Skip to content

Commit 0fb4262

Browse files
raornblp
authored andcommitted
rhel: Add Red Hat network scripts integration.
[Spec file changes and some documentation updates by Ben Pfaff.]
1 parent df2a06a commit 0fb4262

8 files changed

Lines changed: 260 additions & 11 deletions

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
The following people, in alphabetical order, have either authored or
22
signed off on commits in the Open vSwitch version control repository.
33

4+
Alexey I. Froloff raorn@altlinux.org
45
Andrew Evans aevans@nicira.com
56
Andrew Lambeth wal@nicira.com
67
Andy Southgate andy.southgate@citrix.com

INSTALL.RHEL

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,14 @@ RHEL. On RHEL 5, the default RPM source directory is
6464
in this example: "kmod-openvswitch", "kmod-openvswitch-debug", and
6565
"kmod-openvswitch-kdump".
6666

67+
Red Hat Network Scripts Integration
68+
-----------------------------------
69+
70+
Simple integration with Red Hat network scripts has been implemented.
71+
Please read rhel/README.RHEL in the source tree or
72+
/usr/share/doc/openvswitch/README.RHEL in the installed openvswitch
73+
package for details.
74+
6775
Reporting Bugs
6876
--------------
6977

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ post-v1.3.0
88
- Added ability to modify TTL in IPv4.
99
- ovs-appctl:
1010
- New "fdb/flush" command to flush bridge's MAC learning table.
11+
- RHEL packaging now supports integration with Red Hat network scripts.
1112

1213
v1.3.0 - xx xxx xxxx
1314
------------------------

rhel/README.RHEL

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
Red Hat network scripts integration
2+
-----------------------------------
3+
4+
The RPM packages for Open vSwitch provide some integration with Red
5+
Hat's network scripts. Using this integration is optional.
6+
7+
To use the integration for a Open vSwitch bridge or interface named
8+
<name>, create or edit /etc/sysconfig/network-scripts/ifcfg-<name>.
9+
This is a shell script that consists of a series of VARIABLE=VALUE
10+
assignments. The following OVS-specific variable names are supported:
11+
12+
- DEVICETYPE: Always set to "ovs".
13+
14+
- TYPE: If this is "OVSBridge", then this file represents an OVS
15+
bridge named <name>. Otherwise, it represents a port on an OVS
16+
bridge and TYPE must have one of the following values:
17+
18+
* "OVSPort", if <name> is a physical port (e.g. eth0) or
19+
virtual port (e.g. vif1.0).
20+
21+
* "OVSIntPort", if <name> is an internal port (e.g. a tagged
22+
VLAN).
23+
24+
* "OVSBond", if <name> is an OVS bond.
25+
26+
- OVS_BRIDGE: If TYPE is anything other than "OVSBridge", set to
27+
the name of the OVS bridge to which the port should be attached.
28+
29+
- OVS_OPTIONS: Optionally, extra options to set in the "Port"
30+
table when adding the port to the bridge, as a sequence of
31+
column[:key]=value options. For example, "tag=100" to make the
32+
port an access port for VLAN 100. See the documentation of
33+
"add-port" in ovs-vsctl(8) for syntax and the section on the
34+
Port table in ovs-vswitchd.conf.db(5) for available options.
35+
36+
- OVS_EXTRA: Optionally, additional ovs-vsctl commands, separated
37+
by "--" (double dash).
38+
39+
- BOND_IFACES: For "OVSBond" interfaces, a list of physical
40+
interfaces to bond together.
41+
42+
Note
43+
----
44+
45+
"ifdown" on a bridge will not bring individual ports on the bridge
46+
down. "ifup" on a bridge will not add ports to the bridge. This
47+
behavior should be compatible with standard bridges (with
48+
TYPE=Bridge).
49+
50+
Examples
51+
--------
52+
53+
Standalone bridge:
54+
55+
==> ifcfg-ovsbridge0 <==
56+
DEVICE=ovsbridge0
57+
ONBOOT=yes
58+
DEVICETYPE=ovs
59+
TYPE=OVSBridge
60+
BOOTPROTO=static
61+
IPADDR=A.B.C.D
62+
NETMASK=X.Y.Z.0
63+
HOTPLUG=no
64+
65+
66+
Adding physical eth0 to ovsbridge0 described above:
67+
68+
==> ifcfg-eth0 <==
69+
DEVICE=eth0
70+
ONBOOT=yes
71+
DEVICETYPE=ovs
72+
TYPE=OVSPort
73+
OVS_BRIDGE=internet
74+
BOOTPROTO=none
75+
HOTPLUG=no
76+
77+
78+
Tagged VLAN interface on top of ovsbridge0:
79+
80+
==> ifcfg-vlan100 <==
81+
DEVICE=vlan100
82+
ONBOOT=yes
83+
DEVICETYPE=ovs
84+
TYPE=OVSIntPort
85+
BOOTPROTO=static
86+
IPADDR=A.B.C.D
87+
NETMASK=X.Y.Z.0
88+
OVS_BRIDGE=ovsbridge0
89+
OVS_OPTIONS="tag=100"
90+
OVS_EXTRA="set Interface $DEVICE external-ids:iface-id=$(hostname -s)-$DEVICE-vif"
91+
HOTPLUG=no
92+
93+
94+
Bonding:
95+
96+
==> ifcfg-bond0 <==
97+
DEVICE=bond0
98+
ONBOOT=yes
99+
DEVICETYPE=ovs
100+
TYPE=OVSBond
101+
OVS_BRIDGE=ovsbridge0
102+
BOOTPROTO=none
103+
BOND_IFACES="gige-1b-0 gige-1b-1 gige-21-0 gige-21-1"
104+
OVS_OPTIONS="bond_mode=balance-tcp lacp=active"
105+
HOTPLUG=no
106+
107+
==> ifcfg-gige-* <==
108+
DEVICE=gige-*
109+
ONBOOT=yes
110+
HOTPLUG=no
111+
112+
Reporting Bugs
113+
--------------
114+
115+
Please report problems to bugs@openvswitch.org.

rhel/automake.mk

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@
66
# without warranty of any kind.
77

88
EXTRA_DIST += \
9+
rhel/README.RHEL \
910
rhel/automake.mk \
1011
rhel/etc_init.d_openvswitch \
1112
rhel/etc_logrotate.d_openvswitch \
13+
rhel/etc_sysconfig_network-scripts_ifdown-ovs \
14+
rhel/etc_sysconfig_network-scripts_ifup-ovs \
1215
rhel/kmodtool-openvswitch-el5.sh \
1316
rhel/openvswitch-kmod-rhel5.spec \
1417
rhel/openvswitch-kmod-rhel5.spec.in \
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/bin/bash
2+
3+
# Copyright (c) 2011 Alexey I. Froloff.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at:
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
. /etc/init.d/functions
18+
19+
cd /etc/sysconfig/network-scripts
20+
. ./network-functions
21+
22+
[ -f ../network ] && . ../network
23+
24+
CONFIG=${1}
25+
26+
source_config
27+
28+
. /etc/sysconfig/network
29+
30+
OTHERSCRIPT="/etc/sysconfig/network-scripts/ifdown-${REAL_DEVICETYPE}"
31+
32+
if [ ! -x ${OTHERSCRIPT} ]; then
33+
OTHERSCRIPT="/etc/sysconfig/network-scripts/ifdown-eth"
34+
fi
35+
36+
case "$TYPE" in
37+
OVSBridge)
38+
${OTHERSCRIPT} ${CONFIG} $2
39+
retval=$?
40+
ovs-vsctl -- --if-exists del-br "$DEVICE"
41+
;;
42+
OVSPort|OVSIntPort|OVSBond)
43+
${OTHERSCRIPT} ${CONFIG} $2
44+
retval=$?
45+
ovs-vsctl -- --if-exists del-port "$OVS_BRIDGE" "$DEVICE"
46+
;;
47+
*)
48+
echo $"Invalid OVS interface type $TYPE"
49+
exit 1
50+
;;
51+
esac
52+
53+
exit $retval
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#!/bin/bash
2+
3+
# Copyright (c) 2011 Alexey I. Froloff.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at:
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
. /etc/init.d/functions
18+
19+
cd /etc/sysconfig/network-scripts
20+
. ./network-functions
21+
22+
[ -f ../network ] && . ../network
23+
24+
CONFIG=${1}
25+
26+
need_config ${CONFIG}
27+
28+
source_config
29+
30+
OTHERSCRIPT="/etc/sysconfig/network-scripts/ifup-${REAL_DEVICETYPE}"
31+
32+
if [ ! -x ${OTHERSCRIPT} ]; then
33+
OTHERSCRIPT="/etc/sysconfig/network-scripts/ifup-eth"
34+
fi
35+
36+
case "$TYPE" in
37+
OVSBridge)
38+
ovs-vsctl -- --may-exist add-br "$DEVICE" $OVS_OPTIONS ${OVS_EXTRA+-- $OVS_EXTRA}
39+
${OTHERSCRIPT} ${CONFIG} ${2}
40+
;;
41+
OVSPort)
42+
/sbin/ifup "$OVS_BRIDGE"
43+
${OTHERSCRIPT} ${CONFIG} ${2}
44+
ovs-vsctl -- --may-exist add-port "$OVS_BRIDGE" "$DEVICE" $OVS_OPTIONS ${OVS_EXTRA+-- $OVS_EXTRA}
45+
;;
46+
OVSIntPort)
47+
/sbin/ifup "$OVS_BRIDGE"
48+
ovs-vsctl -- --may-exist add-port "$OVS_BRIDGE" "$DEVICE" $OVS_OPTIONS -- set Interface "$DEVICE" type=internal ${OVS_EXTRA+-- $OVS_EXTRA}
49+
${OTHERSCRIPT} ${CONFIG} ${2}
50+
;;
51+
OVSBond)
52+
/sbin/ifup "$OVS_BRIDGE"
53+
for _iface in $BOND_IFACES; do
54+
/sbin/ifup ${_iface}
55+
done
56+
ovs-vsctl -- --fake-iface add-bond "$OVS_BRIDGE" "$DEVICE" ${BOND_IFACES} $OVS_OPTIONS ${OVS_EXTRA+-- $OVS_EXTRA}
57+
${OTHERSCRIPT} ${CONFIG} ${2}
58+
;;
59+
*)
60+
echo $"Invalid OVS interface type $TYPE"
61+
exit 1
62+
;;
63+
esac

rhel/openvswitch.spec.in

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,19 @@ make %{_smp_mflags}
3535
%install
3636
rm -rf $RPM_BUILD_ROOT
3737
make install DESTDIR=$RPM_BUILD_ROOT
38-
install -d -m 755 $RPM_BUILD_ROOT/etc
39-
install -d -m 755 $RPM_BUILD_ROOT/etc/init.d
40-
install -m 755 rhel/etc_init.d_openvswitch \
41-
$RPM_BUILD_ROOT/etc/init.d/openvswitch
42-
install -d -m 755 $RPM_BUILD_ROOT/etc/sysconfig
43-
install -d -m 755 $RPM_BUILD_ROOT/etc/logrotate.d
44-
install -m 755 rhel/etc_logrotate.d_openvswitch \
45-
$RPM_BUILD_ROOT/etc/logrotate.d/openvswitch
46-
install -d -m 755 $RPM_BUILD_ROOT/usr/share/openvswitch/scripts
47-
install -m 755 rhel/usr_share_openvswitch_scripts_sysconfig.template \
48-
$RPM_BUILD_ROOT/usr/share/openvswitch/scripts/sysconfig.template
38+
for base in \
39+
etc_init.d_openvswitch \
40+
etc_logrotate.d_openvswitch \
41+
etc_sysconfig_network-scripts_ifup-ovs \
42+
etc_sysconfig_network-scripts_ifdown-ovs \
43+
usr_share_openvswitch_scripts_sysconfig.template; do
44+
dst=$RPM_BUILD_ROOT/$(echo $base | sed 's,_,/,g')
45+
install -d -m755 "$(dirname $dst)"
46+
install rhel/$base "$dst"
47+
done
48+
docdir=$RPM_BUILD_ROOT/usr/share/doc/openvswitch-%{version}
49+
install -d -m755 "$docdir"
50+
install rhel/README.RHEL "$docdir"
4951
install python/compat/uuid.py $RPM_BUILD_ROOT/usr/share/openvswitch/python
5052
install python/compat/argparse.py $RPM_BUILD_ROOT/usr/share/openvswitch/python
5153

@@ -100,6 +102,8 @@ exit 0
100102
%defattr(-,root,root)
101103
/etc/init.d/openvswitch
102104
/etc/logrotate.d/openvswitch
105+
/etc/sysconfig/network-scripts/ifup-ovs
106+
/etc/sysconfig/network-scripts/ifdown-ovs
103107
/etc/openvswitch/bugtool-plugins/*
104108
/usr/bin/ovs-appctl
105109
/usr/bin/ovs-benchmark
@@ -142,4 +146,5 @@ exit 0
142146
/usr/share/openvswitch/scripts/ovs-save
143147
/usr/share/openvswitch/scripts/sysconfig.template
144148
/usr/share/openvswitch/vswitch.ovsschema
149+
/usr/share/doc/openvswitch-%{version}/README.RHEL
145150
/var/lib/openvswitch

0 commit comments

Comments
 (0)