ovsdb: Force columns that contain weak references to be immutable.
[cascardo/ovs.git] / ovsdb / ovsdb-server.1.in
1 .\" -*- nroff -*-
2 .de IQ
3 .  br
4 .  ns
5 .  IP "\\$1"
6 ..
7 .TH ovsdb\-server 1 "@VERSION@" "Open vSwitch" "Open vSwitch Manual"
8 .\" This program's name:
9 .ds PN ovsdb\-server
10 .
11 .SH NAME
12 ovsdb\-server \- Open vSwitch database server
13 .
14 .SH SYNOPSIS
15 \fBovsdb\-server\fR
16 [\fIdatabase\fR]\&...
17 [\fB\-\-remote=\fIremote\fR]\&...
18 [\fB\-\-run=\fIcommand\fR]
19 .so lib/daemon-syn.man
20 .so lib/service-syn.man
21 .so lib/vlog-syn.man
22 .so lib/ssl-syn.man
23 .so lib/ssl-bootstrap-syn.man
24 .so lib/ssl-peer-ca-cert-syn.man
25 .so lib/unixctl-syn.man
26 .so lib/common-syn.man
27 .
28 .SH DESCRIPTION
29 The \fBovsdb\-server\fR program provides RPC interfaces to one or more
30 Open vSwitch databases (OVSDBs).  It supports JSON-RPC client
31 connections over active or passive TCP/IP or Unix domain sockets.
32 .PP
33 Each OVSDB file may be specified on the command line as \fIdatabase\fR.
34 If none is specified, the default is \fB@DBDIR@/conf.db\fR.  The database
35 files must already have been created and initialized using, for
36 example, \fBovsdb\-tool create\fR.
37 .
38 .SH OPTIONS
39 .
40 .IP "\fB\-\-remote=\fIremote\fR"
41 Adds \fIremote\fR as a connection method used by \fBovsdb\-server\fR.
42 \fIremote\fR must take one of the following forms:
43 .
44 .RS
45 .so ovsdb/remote-passive.man
46 .so ovsdb/remote-active.man
47 .
48 .IP "\fBdb:\fIdb\fB,\fItable\fB,\fIcolumn\fR"
49 Reads additional connection methods from \fIcolumn\fR in all of the
50 rows in \fItable\fR within \fIdb\fR.  As the contents of \fIcolumn\fR changes,
51 \fBovsdb\-server\fR also adds and drops connection methods accordingly.
52 .IP
53 If \fIcolumn\fR's type is string or set of strings, then the
54 connection methods are taken directly from the column.  The connection
55 methods in the column must have one of the forms described above.
56 .IP
57 If \fIcolumn\fR's type is UUID or set of UUIDs and references a table,
58 then each UUID is looked up in the referenced table to obtain a row.
59 The following columns in the row, if present and of the correct type,
60 configure a connection method.  Any additional columns are ignored.
61 .RS
62 .IP "\fBtarget\fR (string)"
63 Connection method, in one of the forms described above.  This column
64 is mandatory: if it is missing or empty then no connection method can
65 be configured.
66 .IP "\fBmax_backoff\fR (integer)"
67 Maximum number of milliseconds to wait between connection attempts.
68 .IP "\fBinactivity_probe\fR (integer)"
69 Maximum number of milliseconds of idle time on connection to
70 client before sending an inactivity probe message.
71 .RE
72 .IP
73 It is an error for \fIcolumn\fR to have another type.
74 .RE
75 .
76 .IP
77 To connect or listen on multiple connection methods, use multiple
78 \fB\-\-remote\fR options.
79 .
80 .IP "\fB\-\-run=\fIcommand\fR]"
81 Ordinarily \fBovsdb\-server\fR runs forever, or until it is told to
82 exit (see \fBRUNTIME MANAGEMENT COMMANDS\fR below).  With this option,
83 \fBovsdb\-server\fR instead starts a shell subprocess running
84 \fIcommand\fR.  When the subprocess terminates, \fBovsdb\-server\fR
85 also exits gracefully.  If the subprocess exits normally with exit
86 code 0, then \fBovsdb\-server\fR exits with exit code 0 also;
87 otherwise, it exits with exit code 1.
88 .IP
89 This option can be useful where a database server is needed only to
90 run a single command, e.g.:
91 .B "ovsdb\-server \-\-remote=punix:socket \-\-run='ovsdb\-client dump unix:socket Open_vSwitch'"
92 .IP
93 This option is not supported on Windows platform.
94 .SS "Daemon Options"
95 .ds DD \
96 \fBovsdb\-server\fR detaches only after it starts listening on all \
97 configured remotes.
98 .so lib/daemon.man
99 .SS "Service Options"
100 .so lib/service.man
101 .SS "Logging Options"
102 .so lib/vlog.man
103 .SS "Public Key Infrastructure Options"
104 The options described below for configuring the SSL public key
105 infrastructure accept a special syntax for obtaining their
106 configuration from the database.  If any of these options is given
107 \fBdb:\fIdb\fB,\fItable\fB,\fIcolumn\fR as its argument, then the
108 actual file name is read from the specified \fIcolumn\fR in \fItable\fR
109 within the \fIdb\fR database.  The \fIcolumn\fR must have type
110 string or set of strings.  The first nonempty string in the table is taken
111 as the file name.  (This means that ordinarily there should be at most
112 one row in \fItable\fR.)
113 .so lib/ssl.man
114 .so lib/ssl-bootstrap.man
115 .so lib/ssl-peer-ca-cert.man
116 .SS "Other Options"
117 .so lib/unixctl.man
118 .so lib/common.man
119 .SH "RUNTIME MANAGEMENT COMMANDS"
120 \fBovs\-appctl\fR(8) can send commands to a running
121 \fBovsdb\-server\fR process.  The currently supported commands are
122 described below.
123 .SS "OVSDB\-SERVER COMMANDS"
124 These commands are specific to \fBovsdb\-server\fR.
125 .IP "\fBexit\fR"
126 Causes \fBovsdb\-server\fR to gracefully terminate.
127 .IP "\fBovsdb\-server/compact\fR [\fIdb\fR]\&..."
128 Compacts each database \fIdb\fR in-place.  If no \fIdb\fR is
129 specified, compacts every database in-place.  A database is also
130 compacted automatically when a transaction is logged if it is over 4
131 times as large as its previous compacted size (and at least 10 MB),
132 but not before 100 commits have been added or 10 minutes have elapsed
133 since the last compaction.
134 .
135 .IP "\fBovsdb\-server/reconnect\fR"
136 Makes \fBovsdb\-server\fR drop all of the JSON\-RPC
137 connections to database clients and reconnect.
138 .IP
139 This command might be useful for debugging issues with database
140 clients.
141 .
142 .IP "\fBovsdb\-server/add\-remote \fIremote\fR"
143 Adds a remote, as if \fB\-\-remote=\fIremote\fR had been specified on
144 the \fBovsdb\-server\fR command line.  (If \fIremote\fR is already a
145 remote, this command succeeds without changing the configuration.)
146 .
147 .IP "\fBovsdb\-server/remove\-remote \fIremote\fR"
148 Removes the specified \fIremote\fR from the configuration, failing
149 with an error if \fIremote\fR is not configured as a remote.  This
150 command only works with remotes that were named on \fB\-\-remote\fR or
151 \fBovsdb\-server/add\-remote\fR, that is, it will not remove remotes
152 added indirectly because they were read from the database by
153 configuring a \fBdb:\fIdb\fB,\fItable\fB,\fIcolumn\fR remote.
154 (You can remove a database source with \fBovsdb\-server/remove\-remote
155 \fBdb:\fIdb\fB,\fItable\fB,\fIcolumn\fR, but not individual
156 remotes found indirectly through the database.)
157 .
158 .IP "\fBovsdb\-server/list\-remotes"
159 Outputs a list of the currently configured remotes named on
160 \fB\-\-remote\fR or \fBovsdb\-server/add\-remote\fR, that is, it does
161 not list remotes added indirectly because they were read from the
162 database by configuring a
163 \fBdb:\fIdb\fB,\fItable\fB,\fIcolumn\fR remote.
164 .
165 .IP "\fBovsdb\-server/add\-db \fIdatabase\fR"
166 Adds the \fIdatabase\fR to the running \fBovsdb\-server\fR.  The database
167 file must already have been created and initialized using, for example,
168 \fBovsdb\-tool create\fR.
169 .
170 .IP "\fBovsdb\-server/remove\-db \fIdatabase\fR"
171 Removes \fIdatabase\fR from the running \fBovsdb\-server\fR.  \fIdatabase\fR
172 must be a database name as listed by \fBovsdb-server/list\-dbs\fR.
173 .IP
174 If a remote has been configured that points to the specified
175 \fIdatabase\fR (e.g. \fB\-\-remote=db:\fIdatabase\fB,\fR... on the
176 command line), then it will be disabled until another database with
177 the same name is added again (with \fBovsdb\-server/add\-db\fR).
178 .IP
179 Any public key infrastructure options specified through this database
180 (e.g. \fB\-\-private\-key=db:\fIdatabase,\fR... on the command line)
181 will be disabled until another database with the same name is added
182 again (with \fBovsdb\-server/add\-db\fR).
183 .
184 .IP "\fBovsdb\-server/list\-dbs"
185 Outputs a list of the currently configured databases added either through
186 the command line or through the \fBovsdb\-server/add\-db\fR command.
187 .
188 .so lib/vlog-unixctl.man
189 .so lib/memory-unixctl.man
190 .so lib/coverage-unixctl.man
191 .SH "SPECIFICATIONS"
192 .
193 .PP
194 \fBovsdb\-server\fR implements the Open vSwitch Database (OVSDB)
195 protocol specified in RFC 7047, with the following clarifications:
196 .
197 .IP "3.1. JSON Usage"
198 RFC 4627 says that names within a JSON object should be unique.
199 The Open vSwitch JSON parser discards all but the last value
200 for a name that is specified more than once.
201 .
202 .IP
203 The definition of <error> allows for implementation extensions.
204 Currently \fBovsdb\-server\fR uses the following additional "error"
205 strings which might change in later releases):
206 .
207 .RS
208 .IP "\fBsyntax error\fR or \fBunknown column\fR"
209 The request could not be parsed as an OVSDB request.  An additional
210 "syntax" member, whose value is a string that contains JSON, may
211 narrow down the particular syntax that could not be parsed.
212 .IP "\fBinternal error\fR"
213 The request triggered a bug in \fBovsdb\-server\fR.
214 .IP "\fBovsdb error\fR"
215 A map or set contains a duplicate key.
216 .RE
217 .
218 .IP "3.2. Schema Format"
219 RFC 7047 requires the "version" field in <database-schema>.  Current
220 versions of \fBovsdb\-server\fR allow it to be omitted (future
221 versions are likely to require it).
222 .IP
223 RFC 7047 allows columns that contain weak references to be immutable.
224 This raises the issue of the behavior of the weak reference when the
225 rows that it references are deleted.  Since version 2.6,
226 \fBovsdb\-server\fR forces columns that contain weak references to be
227 mutable.
228 .
229 .IP "4. Wire Protocol"
230 The original OVSDB specifications included the following reason,
231 omitted from RFC 7047, to operate JSON-RPC directly over a stream
232 instead of over HTTP:
233 .
234 .RS
235 .IP \(bu
236 JSON-RPC is a peer-to-peer protocol, but HTTP is a client-server
237 protocol, which is a poor match.  Thus, JSON-RPC over HTTP requires
238 the client to periodically poll the server to receive server requests.
239 .IP \(bu
240 HTTP is more complicated than stream connections and doesn't provide
241 any corresponding advantage.
242 .IP \(bu
243 The JSON-RPC specification for HTTP transport is incomplete.
244 .RE
245 .
246 .IP "4.1.5. Monitor"
247 For backward compatibility, \fBovsdb\-server\fR currently permits a
248 single <monitor-request> to be used instead of an array; it is treated
249 as a single-element array.  Future versions of \fBovsdb\-server\fR
250 might remove this compatibility feature.
251 .IP
252 Because the <json-value> parameter is used to match subsequent update
253 notifications (see below) to the request, it must be unique among all
254 active monitors.  \fBovsdb\-server\fR rejects attempt to create two
255 monitors with the same identifier.
256 .
257 .IP "4.1.12. Monitor2"
258 A new monitor method added in Open vSwitch version 2.5. Monitor2 allows
259 for more efficient update notifications (described below).
260 .IP
261 The monitor method described in Section 4.1.5 also applies to
262 monitor2, with the following exceptions.
263 .
264 .RS
265 .IP \(bu
266 RPC request method becomes "monitor2".
267 .IP \(bu
268 Replay result follows <table-updates2>, described in Section 4.1.13.
269 .IP \(bu
270 Subsequent changes are sent to the client using the "update2" monitor
271 notification, described in Section 4.1.13
272 .RE
273 .
274 .IP
275 Both monitor and monitor2 sessions can exist concurrently. However,
276 monitor and monitor2 shares the same <json-value> parameter space; it
277 must be unique among all monitor and monitor2 sessions.
278 .
279 .IP "4.1.13. Update2 notification"
280 The "update2" notification is sent by the server to the client to report
281 changes in tables that are being monitored following a "monitor2" request
282 as described above. The notification has the following members:
283 .
284 .RS
285 .nf
286 "method": "update2"
287 "params": [<json-value>, <table-updates2>]
288 "id": null
289 .fi
290 .RE
291 .
292 .IP
293 The <json-value> in "params" is the same as the value passed as the
294 <json-value>  in "params" for the corresponding "monitor" request.
295 <table-updates2> is an object that maps from a table name to a <table-update2>.
296 A <table-update2> is an object that maps from row's UUID to a <row-update2> object. A <row-update2> is an object with one of the following members:
297 .
298 .RS
299 .IP "\(dqinitial\(dq: <row>"
300 present for "initial" updates
301 .IP "\(dqinsert\(dq: <row>"
302 present for "insert" updates
303 .IP "\(dqdelete\(dq: <row>"
304 present for "delete" updates
305 .IP "\(dqmodify\(dq: <row>"
306 present for "modify" updates
307 .RE
308 .
309 .IP
310 The format of <row> is described in Section 5.1.
311 .
312 .IP
313 <row> is always a null object for a "delete" update. In "initial" and
314 "insert" updates, <row> omits columns whose values equal the default
315 value of the column type.
316 .
317 .IP
318 For a "modify" update, <row> contains only the columns that are modified.
319 <row> stores the difference between the old and new value for those columns,
320 as described below.
321 .
322 .IP
323 For columns with single value, the difference is the value of the new
324 column.
325 .
326 .IP
327 The difference between two sets are all elements that only belong
328 to one of the sets.
329 .
330 .IP
331 The difference between two maps are all key-value pairs whose keys
332 appears in only one of the maps, plus the key-value pairs whose keys
333 appear in both maps but with different values.  For the latter
334 elements, <row> includes the value from the new column.
335 .
336 .IP
337 Initial views of rows are not presented in update2 notifications,
338 but in the response object to the monitor2 request. The formatting of the
339 <table-updates2> object, however, is the same in either case.
340 .
341 .IP "5.1. Notation"
342 For <condition>, RFC 7047 only allows the use of \fB!=\fR, \fB==\fR,
343 \fBincludes\fR, and \fBexcludes\fR operators with set types.  Open
344 vSwitch 2.4 and later extend <condition> to allow the use of \fB<\fR,
345 \fB<=\fR, \fB>=\fR, and \fB>\fR operators with columns with type ``set
346 of 0 or 1 integer'' and ``set of 0 or 1 real''.  These conditions
347 evaluate to false when the column is empty, and otherwise as described
348 in RFC 7047 for integer and real types.
349 .
350 .SH "BUGS"
351 .
352 In Open vSwitch before version 2.4, when \fBovsdb\-server\fR sent
353 JSON-RPC error responses to some requests, it incorrectly formulated
354 them with the \fBresult\fR and \fBerror\fR swapped, so that the
355 response appeared to indicate success (with a nonsensical result)
356 rather than an error.  The requests that suffered from this problem
357 were:
358 .
359 .IP \fBtransact\fR
360 .IQ \fBget_schema\fR
361 Only if the request names a nonexistent database.
362 .IP \fBmonitor\fR
363 .IQ \fBlock\fR
364 .IQ \fBunlock\fR
365 In all error cases.
366 .
367 .PP
368 Of these cases, the only error that a well-written application is
369 likely to encounter in practice is \fBmonitor\fR of tables or columns
370 that do not exist, in an situation where the application has been
371 upgraded but the old database schema is still temporarily in use.  To
372 handle this situation gracefully, we recommend that clients should
373 treat a \fBmonitor\fR response with a \fBresult\fR that contains an
374 \fBerror\fR key-value pair as an error (assuming that the database
375 being monitored does not contain a table named \fBerror\fR).
376 .
377 .SH "SEE ALSO"
378 .
379 .BR ovsdb\-tool (1).