ovs-vsctl: Initialize the database automatically.
[openvswitch] / 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 .so lib/vlog.man
100 .
101 .SH COMMANDS
102 The commands implemented by \fBovs\-vsctl\fR are described in the
103 sections below.
104 .SS "Open vSwitch Commands"
105 These commands work with an Open vSwitch as a whole.
106 .
107 .IP "\fBinit\fR"
108 Initializes the Open vSwitch database, if it is empty.  If the
109 database has already been initialized, this command has no effect.
110 .IP
111 Any successful \fBovs\-vsctl\fR command automatically initializes the
112 Open vSwitch database if it is empty.  This command is provided to
113 initialize the database without executing any other command.
114 .
115 .SS "Bridge Commands"
116 These commands examine and manipulate Open vSwitch bridges.
117 .
118 .IP "\fBadd\-br \fIbridge\fR"
119 Creates a new bridge named \fIbridge\fR.  Initially the bridge will
120 have no ports (other than \fIbridge\fR itself).
121 .
122 .IP "\fBadd\-br \fIbridge parent vlan\fR"
123 Creates a ``fake bridge'' named \fIbridge\fR within the existing Open
124 vSwitch bridge \fIparent\fR, which must already exist and must not
125 itself be a fake bridge.  The new fake bridge will be on 802.1Q VLAN
126 \fIvlan\fR, which must be an integer between 1 and 4095.  Initially
127 \fIbridge\fR will have no ports (other than \fIbridge\fR itself).
128 .
129 .IP "[\fB\-\-if\-exists\fR] \fBdel\-br \fIbridge\fR"
130 Deletes \fIbridge\fR and all of its ports.  If \fIbridge\fR is a real
131 bridge, this command also deletes any fake bridges that were created
132 with \fIbridge\fR as parent, including all of their ports.
133 .IP
134 Without \fB\-\-if\-exists\fR, attempting to delete a bridge that does
135 not exist is an error.  With \fB\-\-if\-exists\fR, attempting to
136 delete a bridge that does not exist has no effect.
137 .
138 .IP "\fBlist\-br\fR"
139 Lists all existing real and fake bridges on standard output, one per
140 line.
141 .
142 .IP "\fBbr\-exists \fIbridge\fR"
143 Tests whether \fIbridge\fR exists as a real or fake bridge.  If so,
144 \fBovs\-vsctl\fR exits successfully with exit code 0.  If not,
145 \fBovs\-vsctl\fR exits unsuccessfully with exit code 2.
146 .
147 .IP "\fBbr\-to\-vlan \fIbridge\fR"
148 If \fIbridge\fR is a fake bridge, prints the bridge's 802.1Q VLAN as a
149 decimal integer.  If \fIbridge\fR is a real bridge, prints 0.
150 .
151 .IP "\fBbr\-to\-parent \fIbridge\fR"
152 If \fIbridge\fR is a fake bridge, prints the name of its parent
153 bridge.  If \fIbridge\fR is a real bridge, print \fIbridge\fR.
154 .
155 .IP "\fBbr\-set\-external\-id \fIbridge key\fR [\fIvalue\fR]"
156 Sets or clears an ``external ID'' value on \fIbridge\fR.  These values
157 are intended to identify entities external to Open vSwitch with which
158 \fIbridge\fR is associated, e.g. the bridge's identifier in a
159 virtualization management platform.  The Open vSwitch database schema
160 specifies well-known \fIkey\fR values, but \fIkey\fR and \fIvalue\fR
161 are otherwise arbitrary strings.
162 .IP
163 If \fIvalue\fR is specified, then \fIkey\fR is set to \fIvalue\fR for
164 \fIbridge\fR, overwriting any previous value.  If \fIvalue\fR is
165 omitted, then \fIkey\fR is removed from \fIbridge\fR's set of external
166 IDs (if it was present).
167 .
168 .IP "\fBbr\-get\-external\-id \fIbridge\fR [\fIkey\fR]"
169 Queries the external IDs on \fIbridge\fR.  If \fIkey\fR is specified,
170 the output is the value for that \fIkey\fR or the empty string if
171 \fIkey\fR is unset.  If \fIkey\fR is omitted, the output is
172 \fIkey\fB=\fIvalue\fR, one per line, for each key-value pair.
173 .
174 .SS "Port Commands"
175 .
176 These commands examine and manipulate Open vSwitch ports.  These
177 commands treat a bonded port as a single entity.
178 .
179 .IP "\fBlist\-ports \fIbridge\fR"
180 Lists all of the ports within \fIbridge\fR on standard output, one per
181 line.  The local port \fIbridge\fR is not included in the list.
182 .
183 .IP "\fBadd\-port \fIbridge port\fR"
184 Creates on \fIbridge\fR a new port named \fIport\fR from the network
185 device of the same name.
186 .
187 .IP "\fBadd\-bond \fIbridge port iface\fR\&..."
188 Creates on \fIbridge\fR a new port named \fIport\fR that bonds
189 together the network devices given as each \fIiface\fR.  At least two
190 interfaces must be named.
191 .
192 .IP "[\fB\-\-if\-exists\fR] \fBdel\-port \fR[\fIbridge\fR] \fIport\fR"
193 Deletes \fIport\fR.  If \fIbridge\fR is omitted, \fIport\fR is removed
194 from whatever bridge contains it; if \fIbridge\fR is specified, it
195 must be the real or fake bridge that contains \fIport\fR.
196 .IP
197 Without \fB\-\-if\-exists\fR, attempting to delete a port that does
198 not exist is an error.  With \fB\-\-if\-exists\fR, attempting to
199 delete a port that does not exist has no effect.
200 .
201 .IP "\fBport\-to\-br \fIport\fR"
202 Prints the name of the bridge that contains \fIport\fR on standard
203 output.
204 .
205 .IP "\fBport\-set\-external\-id \fIport key\fR [\fIvalue\fR]"
206 Sets or clears an ``external ID'' value on \fIport\fR.  These value
207 are intended to identify entities external to Open vSwitch with which
208 \fIport\fR is associated, e.g. the port's identifier in a
209 virtualization management platform.  The Open vSwitch database schema
210 specifies well-known \fIkey\fR values, but \fIkey\fR and \fIvalue\fR
211 are otherwise arbitrary strings.
212 .IP
213 If \fIvalue\fR is specified, then \fIkey\fR is set to \fIvalue\fR for
214 \fIport\fR, overwriting any previous value.  If \fIvalue\fR is
215 omitted, then \fIkey\fR is removed from \fIport\fR's set of external
216 IDs (if it was present).
217 .
218 .IP "\fBbr\-get\-external\-id \fIport\fR [\fIkey\fR]"
219 Queries the external IDs on \fIport\fR.  If \fIkey\fR is specified,
220 the output is the value for that \fIkey\fR or the empty string if
221 \fIkey\fR is unset.  If \fIkey\fR is omitted, the output is
222 \fIkey\fB=\fIvalue\fR, one per line, for each key-value pair.
223 .
224 .SS "Interface Commands"
225 .
226 These commands examine the interfaces attached to an Open vSwitch
227 bridge.  These commands treat a bonded port as a collection of two or
228 more interfaces, rather than as a single port.
229 .
230 .IP "\fBlist\-ifaces \fIbridge\fR"
231 Lists all of the interfaces within \fIbridge\fR on standard output,
232 one per line.  The local port \fIbridge\fR is not included in the
233 list.
234 .
235 .IP "\fBiface\-to\-br \fIiface\fR"
236 Prints the name of the bridge that contains \fIiface\fR on standard
237 output.
238 .
239 .IP "\fBiface\-set\-external\-id \fIiface key\fR [\fIvalue\fR]"
240 Sets or clears an ``external ID'' value on \fIiface\fR.  These value
241 are intended to identify entities external to Open vSwitch with which
242 \fIiface\fR is associated, e.g. the interface's identifier in a
243 virtualization management platform.  The Open vSwitch database schema
244 specifies well-known \fIkey\fR values, but \fIkey\fR and \fIvalue\fR
245 are otherwise arbitrary strings.
246 .IP
247 If \fIvalue\fR is specified, then \fIkey\fR is set to \fIvalue\fR for
248 \fIiface\fR, overwriting any previous value.  If \fIvalue\fR is
249 omitted, then \fIkey\fR is removed from \fIiface\fR's set of external
250 IDs (if it was present).
251 .
252 .IP "\fBbr\-get\-external\-id \fIiface\fR [\fIkey\fR]"
253 Queries the external IDs on \fIiface\fR.  If \fIkey\fR is specified,
254 the output is the value for that \fIkey\fR or the empty string if
255 \fIkey\fR is unset.  If \fIkey\fR is omitted, the output is
256 \fIkey\fB=\fIvalue\fR, one per line, for each key-value pair.
257 .
258 .SH "EXAMPLES"
259 Create a new bridge named br0 and add port eth0 to it:
260 .IP
261 .B "ovs-vsctl add\-br br0"
262 .br
263 .B "ovs-vsctl add\-port br0 eth0"
264 .PP
265 Alternatively, perform both operations in a single atomic transaction:
266 .IP 
267 .B "ovs-vsctl add\-br br0 \-\- add\-port br0 eth0"
268 .PP
269 Delete bridge \fBbr0\fR, reporting an error if it does not exist:
270 .IP
271 .B "ovs\-vsctl del\-br br0"
272 .PP
273 Delete bridge \fBbr0\fR if it exists (the \fB\-\-\fR is required to
274 separate \fBdel\-br\fR's options from the global options):
275 .IP
276 .B "ovs\-vsctl \-\- \-\-if\-exists del\-br br0"
277 .
278 .SH "EXIT STATUS"
279 .IP "0"
280 Successful program execution.
281 .IP "1"
282 Usage, syntax, or configuration file error.
283 .IP "2"
284 The \fIbridge\fR argument to \fBbr\-exists\fR specified the name of a
285 bridge that does not exist.
286 .SH "SEE ALSO"
287 .
288 .BR ovsdb\-server (1),
289 .BR ovs\-vswitchd (8).