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