]> git.proxmox.com Git - mirror_ovs.git/blame - utilities/ovs-ctl.8
rhel: add ability to build kmod packages for arbitrary kernel version/variant(s)
[mirror_ovs.git] / utilities / ovs-ctl.8
CommitLineData
43bb5f82
BP
1.\" -*- nroff -*-
2.de IQ
3. br
4. ns
5. IP "\\$1"
6..
7.de ST
8. PP
9. RS -0.15in
10. I "\\$1"
11. RE
12..
13.TH ovs\-ctl 8 "June 2011" "Open vSwitch" "Open vSwitch Manual"
14.ds PN ovs\-ctl
15.
16.SH NAME
17ovs\-ctl \- OVS startup helper script
18.
19.SH SYNOPSIS
b3a375f2 20\fBovs\-ctl\fR \fB\-\-system\-id=random\fR|\fIuuid\fR
43bb5f82
BP
21[\fIoptions\fR] \fBstart
22.br
23\fBovs\-ctl stop
24.br
25\fBovs\-ctl status
26.br
27\fBovs\-ctl version
28.br
b3a375f2
BP
29\fBovs\-ctl
30\fB\-\-system\-id=random\fR|\fIuuid\fR
31[\fIoptions\fR]
32\fBforce\-reload\-kmod\fR
33.br
34\fBovs\-ctl
35\fR[\fB\-\-protocol=\fIprotocol\fR]
36[\fB\-\-sport=\fIsport\fR]
37[\fB\-\-dport=\fIdport\fR]
38\fBenable\-protocol\fR
43bb5f82
BP
39.br
40\fBovs\-ctl help \fR| \fB\-h \fR| \fB\-\-help
41.br
42\fBovs\-ctl \-\-version
43.
44.SH DESCRIPTION
45.
46.PP
47The \fBovs\-ctl\fR program starts, stops, and checks the status of
48Open vSwitch daemons. It is not meant to be invoked directly by
49system administrators but to be called internally by system startup
50scripts.
51.
52.PP
53Each of \fBovs\-ctl\fR's commands is described separately below.
54.
55.SH "The ``start'' command"
56.
57.PP
58The \fBstart\fR command starts Open vSwitch. It performs the
59following tasks:
60.
61.IP 1.
62Loads the Open vSwitch kernel module. If this fails, and the Linux
63bridge module is loaded but no bridges exist, it tries to unload the
64bridge module and tries loading the Open vSwitch kernel module again.
65(This is because the Open vSwitch kernel module cannot coexist with
66the Linux bridge module before 2.6.37.)
67.
9fc47ed7
BP
68.IP 2.
69If \fB\-\-brcompat\fR was specified, loads the Open vSwitch bridge
70compatibility module.
71.
43bb5f82
BP
72.PP
73The \fBstart\fR command skips the following steps if
74\fBovsdb\-server\fR is already running:
9fc47ed7 75.IP 3.
43bb5f82
BP
76If the Open vSwitch database file does not exist, it creates it.
77If the database does exist, but it has an obsolete version, it
78upgrades it to the latest schema.
79.
9fc47ed7 80.IP 4.
43bb5f82
BP
81Starts \fBovsdb-server\fR.
82.
9fc47ed7 83.IP 5.
43bb5f82
BP
84Initializes a few values inside the database.
85.
9fc47ed7 86.IP 6.
43bb5f82
BP
87If the \fB\-\-delete\-bridges\fR option was used, deletes all of the
88bridges from the database.
89.
90.PP
91The \fBstart\fR command skips the following step if
92\fBovs\-vswitchd\fR is already running:
9fc47ed7 93.IP 7.
43bb5f82
BP
94Starts \fBovs\-vswitchd\fR.
95.
9fc47ed7
BP
96.PP
97The \fBstart\fR command skips the following step if
98\fBovs\-brcompatd\fR is already running or if \fB\-\-brcompat\fR is
99not specified:
100.IP 8.
101Starts \fBovs\-brcompatd\fR.
102.
43bb5f82
BP
103.SS "Options"
104.PP
105Several command-line options influence the \fBstart\fR command's
106behavior. Some form of the following option should ordinarily be
107specified:
108.
109.IP "\fB\-\-system\-id=\fIuuid\fR"
110.IQ "\fB\-\-system\-id=random\fR"
111This specifies a unique system identifier to store into
112\fBexternal-ids:system-id\fR in the database's \fBOpen_vSwitch\fR
113table. Remote managers that talk to the Open vSwitch database server
114over network protocols use this value to identify and distinguish Open
115vSwitch instances, so it should be unique (at least) within OVS
116instances that will connect to a single controller.
117.IP
118When \fBrandom\fR is specified, \fBovs\-ctl\fR will generate a random
119ID that persists from one run to another (stored in a file). When
120another string is specified \fBovs\-ctl\fR uses it literally.
121.
122.PP
123On systems that have the \fBlsb_release\fR program, \fBovs\-ctl\fR
124chooses reasonable defaults for the following options. Other systems
125should specify values:
126.
127.IP "\fB\-\-system\-type=\fItype\fR"
128.IQ "\fB\-\-system\-version=\fIversion\fR"
129Sets the value to store in the \fBsystem-type\fR and
130\fBsystem-version\fR columns, respectively, in the database's
131\fBOpen_vSwitch\fR table. Remote managers may use these values to
132determine the kind of system to which they are connected (primarily
133for display to human administrators).
134.
135.PP
136The following options are also likely to be useful:
137.
138.IP "\fB\-\-external\-id=\(dq\fIname\fB=\fIvalue\fB\(dq"
139Sets \fBexternal-ids:\fIname\fR to \fIvalue\fR in the database's
140\fBOpen_vSwitch\fR table. Specifying this option multiple times adds
141multiple key-value pairs.
142.
143.IP "\fB\-\-delete\-bridges\fR"
144Ordinarily Open vSwitch bridges persist from one system boot to the
145next, as long as the database is preserved. Some environments instead
146expect to re-create all of the bridges and other configuration state
147on every boot. This option supports that, by deleting all Open
148vSwitch bridges after starting \fBovsdb\-server\fR but before starting
149\fBovs\-vswitchd\fR.
150.
151.PP
152The following options are less important:
153.
154.IP "\fB\-\-daemon-cwd=\fIdirectory\fR"
155Specifies the current working directory that the OVS daemons should
156run from. The default is \fB/\fR (the root directory) if this option
157is not specified. (This option is useful because most systems create
158core files in a process's current working directory and because a file
159system that is in use as a process's current working directory cannot
160be unmounted.)
161.
162.IP "\fB\-\-no\-force\-corefiles\fR"
163By default, \fBovs\-ctl\fR enables core dumps for the OVS daemons.
164This option disables that behavior.
165.
166.IP "\fB\-\-no\-mlockall\fR"
167By default \fBovs\-ctl\fR passes \fB\-\-mlockall\fR to
168\fBovs\-vswitchd\fR, requesting that it lock all of its virtual
169memory, preventing it from being paged to disk. This option
170suppresses that behavior.
171.
172.IP "\fB\-\-ovsdb\-server\-priority=\fIniceness\fR"
173.IQ "\fB\-\-ovs\-vswitchd\-priority=\fIniceness\fR"
174Sets the \fBnice\fR(1) level used for \fBovsdb\-server\fR and
175\fBovs\-vswitchd\fR, respectively. Both default to \fB\-10\fR.
176.
177.PP
178The following options control file locations. They should only be
179used if the default locations cannot be used. See \fBFILES\fR, below,
180for more information.
181.
182.IP "\fB\-\-db\-file=\fIfile\fR"
183Overrides the file name for the OVS database.
184.
185.IP "\fB\-\-db\-sock=\fIsocket\fR"
186Overrides the file name for the Unix domain socket used to connect to
187\fBovsdb\-server\fR.
188.
189.IP "\fB\-\-db\-schema=\fIschema\fR"
190Overrides the file name for the OVS database schema.
191.
192.SH "The ``stop'' command"
193.
194.PP
9fc47ed7
BP
195The \fBstop\fR command shuts down Open vSwitch. It kills any running
196\fBovs\-brcompatd\fR, \fBovs\-vswitchd\fR, or \fBovsdb\-server\fR
197daemons and waits for them to terminate.
198.
199.PP
200The \fBstop\fR command does not unload the Open vSwitch kernel
201modules.
43bb5f82
BP
202.
203.PP
204This command does nothing and finishes successfully if the OVS daemons
205aren't running.
206.
207.SH "The ``status'' command"
208.
209.PP
9fc47ed7
BP
210The \fBstatus\fR command checks whether the OVS daemons
211\fBovs-vswitchd\fR and \fBovsdb\-server\fR are running and prints
212messages with that information. If \fB\-\-brcompat\fR is specified,
213it also checks for \fBovs\-brcompatd\fR. It exits with status 0 if
43bb5f82
BP
214the daemons are running, 1 otherwise.
215.
216.SH "The ``version'' command"
217.
218.PP
219The \fBversion\fR command runs \fBovsdb\-server \-\-version\fR and
9fc47ed7
BP
220\fBovs\-vswitchd \-\-version\fR. If \fB\-\-brcompat\fR is specified,
221it also runs \fBovs\-brcompatd \-\-version\fR.
43bb5f82
BP
222.
223.SH "The ``force\-reload\-kmod'' command"
224.
225.PP
226The \fBforce\-reload\-kmod\fR command allows upgrading the Open
227vSwitch kernel module without rebooting. It performs the following
228tasks:
229.
230.IP 1.
231Gets a list of OVS ``internal'' interfaces, that is, network devices
232implemented by Open vSwitch. The most common examples of these are
233bridge ``local ports''.
234.
235.IP 2.
236Stops the Open vSwitch daemons, as if by a call to \fBovs\-ctl
237stop\fR.
238.
239.IP 3.
240Saves the kernel configuration state of the OVS internal interfaces
241listed in step 1, including IP and IPv6 addresses and routing table
242entries.
243.
244.IP 4.
9fc47ed7
BP
245Unloads the Open vSwitch kernel module (including the bridge
246compatibility module if it is loaded).
43bb5f82
BP
247.
248.IP 5.
249Starts OVS back up, as if by a call to \fBovs\-ctl start\fR. This
9fc47ed7
BP
250reloads the kernel module and restarts the OVS daemons (including
251\fBovs\-brcompatd\fR, if \fB\-\-brcompat\fR is specified).
43bb5f82
BP
252.
253.IP 6.
254Restores the kernel configuration state that was saved in step 3.
255.
256.PP
257The steps above are often enough to hot-upgrade a new kernel module
258with only a few seconds of downtime. DHCP is a common problem: if the
259ISC DHCP client is running on an OVS internal interface, then it will
260have to be restarted after completing the above procedure.
261.
262.PP
b3a375f2 263\fBforce\-kmod\-reload\fR internally stops and starts OVS, so it
43bb5f82
BP
264accepts all of the options accepted by the \fBstart\fR command.
265.
2bed68ff 266.SH "The ``enable\-protocol'' command"
b3a375f2
BP
267.
268.PP
269The \fBenable\-protocol\fR command checks for rules related to a
270specified protocol in the system's \fBiptables\fR(8) configuration. If there
271are no rules specifically related to that protocol, then it inserts a
272rule to accept the specified protocol.
273.
274.PP
275More specifically:
276.
277.IP \(bu
278If \fBiptables\fR is not installed or not enabled, this command does
279nothing, assuming that lack of filtering means that the protocol is
280enabled.
281.
282.IP \(bu
283If the \fBINPUT\fR chain has a rule that matches the specified
284protocol, then this command does nothing, assuming that whatever rule
285is installed reflects the system administrator's decisions.
286.
287.IP \(bu
288Otherwise, this command installs a rule that accepts traffic of the
289specified protocol.
290.
291.PP
292This command normally completes successfully, even if it does
293nothing. Only the failure of an attempt to insert a rule normally
294causes it to return an exit code other than 0.
295.
296The following options control the protocol to be enabled:
297.
298.IP "\fB\-\-protocol=\fIprotocol\fR"
299The name of the IP protocol to be enabled, such as \fBgre\fR or
300\fBtcp\fR. The default is \fBgre\fR.
301.
302.IP "\fB\-\-sport=\fIsport\fR"
303.IQ "\fB\-\-dport=\fIdport\fR"
304TCP or UDP source or destination port to match. These are optional
305and allowed only with \fB\-\-protocol=tcp\fR or
306\fB\-\-protocol=udp\fR.
307.
2bed68ff 308.SH "The ``help'' command"
43bb5f82
BP
309.
310Prints a usage message and exits successfully.
311.
9fc47ed7
BP
312.SH "OPTIONS"
313.PP
314In addition to the options listed for each command above, this option
315controls the behavior of several of \fBovs\-ctl\fR's commands.
316.
317.IP "\fB\-\-brcompat\fR"
318By default, \fBovs\-ctl\fR does not load the Open vSwitch bridge
319compatibility module and does not start or check the status or report
320the version of the \fBovs\-brcompatd\fR daemon. This option enables
321all of those behaviors.
322.
323.IP
324The \fBstop\fR command always stops \fBovs\-brcompatd\fR, if it is
325running, regardless of this option.
326.
43bb5f82
BP
327.SH "EXIT STATUS"
328.
329\fBovs\-ctl\fR exits with status 0 on success and nonzero on failure.
330The \fBstart\fR command is considered to succeed if OVS is already
331started; the \fBstop\fR command is considered to succeed if OVS is
332already stopped.
333.
334.SH "ENVIRONMENT"
335.
336The following environment variables affect \fBovs\-ctl\fR:
337.
338.IP "\fBPATH\fR"
339\fBovs\-ctl\fR does not hardcode the location of any of the programs
340that it runs. \fBovs\-ctl\fR will add the \fIsbindir\fR and
341\fIbindir\fR that were specified at \fBconfigure\fR time to
342\fBPATH\fR, if they are not already present.
343.
344.IP "\fBOVS_LOGDIR\fR"
345.IQ "\fBOVS_RUNDIR\fR"
346.IQ "\fBOVS_SYSCONFDIR\fR"
347.IQ "\fBOVS_PKGDATADIR\fR"
348.IQ "\fBOVS_BINDIR\fR"
349.IQ "\fBOVS_SBINDIR\fR"
350Setting one of these variables in the environment overrides the
351respective \fBconfigure\fR option, both for \fBovs\-ctl\fR itself and
352for the other Open vSwitch programs that it runs.
353.
354.SH "FILES"
355.
356\fBovs\-ctl\fR uses the following files:
357.
358.IP "\fBovs\-lib.sh"
359Shell function library used internally by \fBovs\-ctl\fR. It must be
360installed in the same directory as \fBovs\-ctl\fR.
361.
362.IP "\fIlogdir\fB/\fIdaemon\fB.log\fR"
363Per-daemon logfiles.
364.
365.IP "\fIrundir\fB/\fIdaemon\fB.pid\fR"
366Per-daemon pidfiles to track whether a daemon is running and with what
367process ID.
368.
369.IP "\fIpkgdatadir\fB/vswitch.ovsschema\fR"
370The OVS database schema used to initialize the database (use
371\fB\-\-db\-schema to override this location).
372.
373.IP "\fIsysconfdir\fB/openvswitch/conf.db\fR"
374The OVS database (use \fB\-\-db\-file\fR to override this location).
375.
376.IP "\fIrundir\fB/openvswitch/db.sock\fR"
377The Unix domain socket used for local communication with
378\fBovsdb\-server\fR (use \fB\-\-db\-sock\fR to override this
379location).
380.
381.IP "\fIsysconfdir\fB/openvswitch/system-id.conf\fR"
382The persistent system UUID created and read by
383\fB\-\-system\-id=random\fR.
384.
385.SH "EXAMPLE"
386.
387.PP
388The files \fBdebian/openvswitch\-switch.init\fR and
389\fBxenserver/etc_init.d_openvswitch\fR in the Open vSwitch source
390distribution are good examples of how to use \fBovs\-ctl\fR.
391.
392.SH "SEE ALSO"
393.
9fc47ed7 394\fBREADME\fR, \fBINSTALL.Linux\fR, \fBovsdb\-server\fR(8),
43bb5f82 395\fBovs\-vswitchd\fR(8).