ovs-vsctl: Add -t or --timeout option to limit runtime.
[sliver-openvswitch.git] / utilities / ovs-vsctl.8.in
1 .\" -*- nroff -*-
2 .de IQ
3 .  br
4 .  ns
5 .  IP "\\$1"
6 ..
7 .TH ovs\-vsctl 8 "November 2009" "Open vSwitch" "Open vSwitch Manual"
8 .ds PN ovs\-vsctl
9 .
10 .SH NAME
11 ovs\-vsctl \- utility for querying and configuring \fBovs\-vswitchd\fR
12 .
13 .SH SYNOPSIS
14 \fBovs\-vsctl\fR [\fIoptions\fR] [\fB\-\-\fR] \fIcommand \fR[\fIargs\fR\&...]
15 [\fB\-\-\fR \fIcommand \fR[\fIargs\fR\&...]]
16 .
17 .SH DESCRIPTION
18 The \fBovs\-vsctl\fR program configures \fBovs\-vswitchd\fR(8) by
19 providing a high\-level interface to editing its configuration
20 database.  This program is mainly intended for use when
21 \fBovs\-vswitchd\fR is running.  If it is used when
22 \fBovs\-vswitchd\fR is not running, then \fB\-\-no\-wait\fR should be
23 specified and configuration changes will only take effect when
24 \fBovs\-vswitchd\fR is started.
25 .PP
26 By default, each time \fBovs\-vsctl\fR runs, it connects to an
27 \fBovsdb\-server\fR process that maintains an Open vSwitch
28 configuration database.  Using this connection, it queries and
29 possibly applies changes to the database, depending on the supplied
30 commands.  Then, if it applied any changes, it waits until
31 \fBovs\-vswitchd\fR has finished reconfiguring itself before it exits.
32 .PP
33 \fBovs\-vsctl\fR can perform any number of commands in a single run,
34 implemented as a single atomic transaction against the database.
35 Commands are separated on the command line by \fB\-\-\fR arguments.
36 .
37 .SS "Linux VLAN Bridging Compatibility"
38 The \fBovs\-vsctl\fR program supports the model of a bridge
39 implemented by Open vSwitch, in which a single bridge supports ports
40 on multiple VLANs.  In this model, each port on a bridge is either a
41 trunk port that potentially passes packets tagged with 802.1Q headers
42 that designate VLANs or it is assigned a single implicit VLAN that is
43 never tagged with an 802.1Q header.
44 .PP
45 For compatibility with software designed for the Linux bridge,
46 \fBovs\-vsctl\fR also supports a model in which traffic associated
47 with a given 802.1Q VLAN is segregated into a separate bridge.  A
48 special form of the \fBadd\-br\fR command (see below) creates a ``fake
49 bridge'' within an Open vSwitch bridge to simulate this behavior.
50 When such a ``fake bridge'' is active, \fBovs\-vsctl\fR will treat it
51 much like a bridge separate from its ``parent bridge,'' but the actual
52 implementation in Open vSwitch uses only a single bridge, with ports on
53 the fake bridge assigned the implicit VLAN of the fake bridge of which
54 they are members.
55 .
56 .SH OPTIONS
57 .
58 The following options affect the behavior \fBovs\-vsctl\fR as a whole.
59 Some individual commands also accept their own options, which are
60 given just before the command name.  If the first command on the
61 command line has options, then those options must be separated from
62 the global options by \fB\-\-\fR.
63 .
64 .IP "\fB\-\-db=\fIserver\fR"
65 Sets \fIserver\fR as the database server that \fBovs\-vsctl\fR
66 contacts to query or modify configuration.  The default is
67 \fBunix:@RUNDIR@/ovsdb\-server\fR.  \fIserver\fR must take one of the
68 following forms:
69 .RS
70 .IP "\fBtcp:\fIip\fB:\fIport\fR"
71 Connect to the given TCP \fIport\fR on \fIip\fR.
72 .IP "\fBunix:\fIfile\fR"
73 Connect to the Unix domain server socket named \fIfile\fR.
74 .RE
75 .IP "\fB\-\-no\-wait\fR"
76 Prevents \fBovs\-vsctl\fR from waiting for \fBovs\-vswitchd\fR to
77 reconfigure itself according to the the modified database.  This
78 option should be used if \fBovs\-vswitchd\fR is not running;
79 otherwise, \fBovs-vsctl\fR will not exit until \fBovs-vswitchd\fR
80 starts.
81 .IP
82 This option has no effect if the commands specified do not change the
83 database.
84 .
85 .IP "\fB\-\-no\-syslog\fR"
86 By default, \fBovs\-vsctl\fR logs its arguments and the details of any
87 changes that it makes to the system log.  This option disables this
88 logging.
89 .IP
90 This option is equivalent to \fB\-\-verbose=vvsctl:syslog:warn\fR.
91 .
92 .IP "\fB\-\-oneline\fR"
93 Modifies the output format so that the output for each command is printed
94 on a single line.  New-line characters that would otherwise separate
95 lines are printed as \fB\\n\fR, and any instances of \fB\\\fR that
96 would otherwise appear in the output are doubled.
97 Prints a blank line for each command that has no output.
98 .
99 .IP "\fB\-\-dry\-run\fR"
100 Prevents \fBovs\-vsctl\fR from actually modifying the database.
101 .
102 .IP "\fB-t \fIsecs\fR"
103 .IQ "\fB--timeout=\fIsecs\fR"
104 Limits runtime to approximately \fIsecs\fR seconds.  If the timeout
105 expires, \fBovs\-vsctl\fR will exit with a \fBSIGALRM\fR signal.
106 (This would normally happen only if the database cannot be contacted.)
107 .
108 .so lib/vlog.man
109 .
110 .SH COMMANDS
111 The commands implemented by \fBovs\-vsctl\fR are described in the
112 sections below.
113 .SS "Open vSwitch Commands"
114 These commands work with an Open vSwitch as a whole.
115 .
116 .IP "\fBinit\fR"
117 Initializes the Open vSwitch database, if it is empty.  If the
118 database has already been initialized, this command has no effect.
119 .IP
120 Any successful \fBovs\-vsctl\fR command automatically initializes the
121 Open vSwitch database if it is empty.  This command is provided to
122 initialize the database without executing any other command.
123 .
124 .SS "Bridge Commands"
125 These commands examine and manipulate Open vSwitch bridges.
126 .
127 .IP "\fBadd\-br \fIbridge\fR"
128 Creates a new bridge named \fIbridge\fR.  Initially the bridge will
129 have no ports (other than \fIbridge\fR itself).
130 .
131 .IP "\fBadd\-br \fIbridge parent vlan\fR"
132 Creates a ``fake bridge'' named \fIbridge\fR within the existing Open
133 vSwitch bridge \fIparent\fR, which must already exist and must not
134 itself be a fake bridge.  The new fake bridge will be on 802.1Q VLAN
135 \fIvlan\fR, which must be an integer between 1 and 4095.  Initially
136 \fIbridge\fR will have no ports (other than \fIbridge\fR itself).
137 .
138 .IP "[\fB\-\-if\-exists\fR] \fBdel\-br \fIbridge\fR"
139 Deletes \fIbridge\fR and all of its ports.  If \fIbridge\fR is a real
140 bridge, this command also deletes any fake bridges that were created
141 with \fIbridge\fR as parent, including all of their ports.
142 .IP
143 Without \fB\-\-if\-exists\fR, attempting to delete a bridge that does
144 not exist is an error.  With \fB\-\-if\-exists\fR, attempting to
145 delete a bridge that does not exist has no effect.
146 .
147 .IP "\fBlist\-br\fR"
148 Lists all existing real and fake bridges on standard output, one per
149 line.
150 .
151 .IP "\fBbr\-exists \fIbridge\fR"
152 Tests whether \fIbridge\fR exists as a real or fake bridge.  If so,
153 \fBovs\-vsctl\fR exits successfully with exit code 0.  If not,
154 \fBovs\-vsctl\fR exits unsuccessfully with exit code 2.
155 .
156 .IP "\fBbr\-to\-vlan \fIbridge\fR"
157 If \fIbridge\fR is a fake bridge, prints the bridge's 802.1Q VLAN as a
158 decimal integer.  If \fIbridge\fR is a real bridge, prints 0.
159 .
160 .IP "\fBbr\-to\-parent \fIbridge\fR"
161 If \fIbridge\fR is a fake bridge, prints the name of its parent
162 bridge.  If \fIbridge\fR is a real bridge, print \fIbridge\fR.
163 .
164 .IP "\fBbr\-set\-external\-id \fIbridge key\fR [\fIvalue\fR]"
165 Sets or clears an ``external ID'' value on \fIbridge\fR.  These values
166 are intended to identify entities external to Open vSwitch with which
167 \fIbridge\fR is associated, e.g. the bridge's identifier in a
168 virtualization management platform.  The Open vSwitch database schema
169 specifies well-known \fIkey\fR values, but \fIkey\fR and \fIvalue\fR
170 are otherwise arbitrary strings.
171 .IP
172 If \fIvalue\fR is specified, then \fIkey\fR is set to \fIvalue\fR for
173 \fIbridge\fR, overwriting any previous value.  If \fIvalue\fR is
174 omitted, then \fIkey\fR is removed from \fIbridge\fR's set of external
175 IDs (if it was present).
176 .
177 .IP "\fBbr\-get\-external\-id \fIbridge\fR [\fIkey\fR]"
178 Queries the external IDs on \fIbridge\fR.  If \fIkey\fR is specified,
179 the output is the value for that \fIkey\fR or the empty string if
180 \fIkey\fR is unset.  If \fIkey\fR is omitted, the output is
181 \fIkey\fB=\fIvalue\fR, one per line, for each key-value pair.
182 .
183 .SS "Port Commands"
184 .
185 These commands examine and manipulate Open vSwitch ports.  These
186 commands treat a bonded port as a single entity.
187 .
188 .IP "\fBlist\-ports \fIbridge\fR"
189 Lists all of the ports within \fIbridge\fR on standard output, one per
190 line.  The local port \fIbridge\fR is not included in the list.
191 .
192 .IP "\fBadd\-port \fIbridge port\fR"
193 Creates on \fIbridge\fR a new port named \fIport\fR from the network
194 device of the same name.
195 .
196 .IP "\fBadd\-bond \fIbridge port iface\fR\&..."
197 Creates on \fIbridge\fR a new port named \fIport\fR that bonds
198 together the network devices given as each \fIiface\fR.  At least two
199 interfaces must be named.
200 .
201 .IP "[\fB\-\-if\-exists\fR] \fBdel\-port \fR[\fIbridge\fR] \fIport\fR"
202 Deletes \fIport\fR.  If \fIbridge\fR is omitted, \fIport\fR is removed
203 from whatever bridge contains it; if \fIbridge\fR is specified, it
204 must be the real or fake bridge that contains \fIport\fR.
205 .IP
206 Without \fB\-\-if\-exists\fR, attempting to delete a port that does
207 not exist is an error.  With \fB\-\-if\-exists\fR, attempting to
208 delete a port that does not exist has no effect.
209 .
210 .IP "\fBport\-to\-br \fIport\fR"
211 Prints the name of the bridge that contains \fIport\fR on standard
212 output.
213 .
214 .IP "\fBport\-set\-external\-id \fIport key\fR [\fIvalue\fR]"
215 Sets or clears an ``external ID'' value on \fIport\fR.  These value
216 are intended to identify entities external to Open vSwitch with which
217 \fIport\fR is associated, e.g. the port's identifier in a
218 virtualization management platform.  The Open vSwitch database schema
219 specifies well-known \fIkey\fR values, but \fIkey\fR and \fIvalue\fR
220 are otherwise arbitrary strings.
221 .IP
222 If \fIvalue\fR is specified, then \fIkey\fR is set to \fIvalue\fR for
223 \fIport\fR, overwriting any previous value.  If \fIvalue\fR is
224 omitted, then \fIkey\fR is removed from \fIport\fR's set of external
225 IDs (if it was present).
226 .
227 .IP "\fBbr\-get\-external\-id \fIport\fR [\fIkey\fR]"
228 Queries the external IDs on \fIport\fR.  If \fIkey\fR is specified,
229 the output is the value for that \fIkey\fR or the empty string if
230 \fIkey\fR is unset.  If \fIkey\fR is omitted, the output is
231 \fIkey\fB=\fIvalue\fR, one per line, for each key-value pair.
232 .
233 .SS "Interface Commands"
234 .
235 These commands examine the interfaces attached to an Open vSwitch
236 bridge.  These commands treat a bonded port as a collection of two or
237 more interfaces, rather than as a single port.
238 .
239 .IP "\fBlist\-ifaces \fIbridge\fR"
240 Lists all of the interfaces within \fIbridge\fR on standard output,
241 one per line.  The local port \fIbridge\fR is not included in the
242 list.
243 .
244 .IP "\fBiface\-to\-br \fIiface\fR"
245 Prints the name of the bridge that contains \fIiface\fR on standard
246 output.
247 .
248 .IP "\fBiface\-set\-external\-id \fIiface key\fR [\fIvalue\fR]"
249 Sets or clears an ``external ID'' value on \fIiface\fR.  These value
250 are intended to identify entities external to Open vSwitch with which
251 \fIiface\fR is associated, e.g. the interface's identifier in a
252 virtualization management platform.  The Open vSwitch database schema
253 specifies well-known \fIkey\fR values, but \fIkey\fR and \fIvalue\fR
254 are otherwise arbitrary strings.
255 .IP
256 If \fIvalue\fR is specified, then \fIkey\fR is set to \fIvalue\fR for
257 \fIiface\fR, overwriting any previous value.  If \fIvalue\fR is
258 omitted, then \fIkey\fR is removed from \fIiface\fR's set of external
259 IDs (if it was present).
260 .
261 .IP "\fBbr\-get\-external\-id \fIiface\fR [\fIkey\fR]"
262 Queries the external IDs on \fIiface\fR.  If \fIkey\fR is specified,
263 the output is the value for that \fIkey\fR or the empty string if
264 \fIkey\fR is unset.  If \fIkey\fR is omitted, the output is
265 \fIkey\fB=\fIvalue\fR, one per line, for each key-value pair.
266 .
267 .SH "EXAMPLES"
268 Create a new bridge named br0 and add port eth0 to it:
269 .IP
270 .B "ovs-vsctl add\-br br0"
271 .br
272 .B "ovs-vsctl add\-port br0 eth0"
273 .PP
274 Alternatively, perform both operations in a single atomic transaction:
275 .IP 
276 .B "ovs-vsctl add\-br br0 \-\- add\-port br0 eth0"
277 .PP
278 Delete bridge \fBbr0\fR, reporting an error if it does not exist:
279 .IP
280 .B "ovs\-vsctl del\-br br0"
281 .PP
282 Delete bridge \fBbr0\fR if it exists (the \fB\-\-\fR is required to
283 separate \fBdel\-br\fR's options from the global options):
284 .IP
285 .B "ovs\-vsctl \-\- \-\-if\-exists del\-br br0"
286 .
287 .SH "EXIT STATUS"
288 .IP "0"
289 Successful program execution.
290 .IP "1"
291 Usage, syntax, or configuration file error.
292 .IP "2"
293 The \fIbridge\fR argument to \fBbr\-exists\fR specified the name of a
294 bridge that does not exist.
295 .SH "SEE ALSO"
296 .
297 .BR ovsdb\-server (1),
298 .BR ovs\-vswitchd (8).