]> git.proxmox.com Git - mirror_ovs.git/blame - lib/db-ctl-base.man
ovn-ctl: add support for SSL nb/sb db connections
[mirror_ovs.git] / lib / db-ctl-base.man
CommitLineData
f6a2e156
AW
1.ST "Database Values"
2.PP
3Each column in the database accepts a fixed type of data. The
4currently defined basic types, and their representations, are:
5.IP "integer"
6A decimal integer in the range \-2**63 to 2**63\-1, inclusive.
7.IP "real"
8A floating-point number.
9.IP "Boolean"
10True or false, written \fBtrue\fR or \fBfalse\fR, respectively.
11.IP "string"
12An arbitrary Unicode string, except that null bytes are not allowed.
13Quotes are optional for most strings that begin with an English letter
14or underscore and consist only of letters, underscores, hyphens, and
15periods. However, \fBtrue\fR and \fBfalse\fR and strings that match
16the syntax of UUIDs (see below) must be enclosed in double quotes to
17distinguish them from other basic types. When double quotes are used,
18the syntax is that of strings in JSON, e.g. backslashes may be used to
19escape special characters. The empty string must be represented as a
20pair of double quotes (\fB""\fR).
21.IP "UUID"
22Either a universally unique identifier in the style of RFC 4122,
23e.g. \fBf81d4fae\-7dec\-11d0\-a765\-00a0c91e6bf6\fR, or an \fB@\fIname\fR
24defined by a \fBget\fR or \fBcreate\fR command within the same \fB\*(PN\fR
25invocation.
26.PP
27Multiple values in a single column may be separated by spaces or a
28single comma. When multiple values are present, duplicates are not
29allowed, and order is not important. Conversely, some database
30columns can have an empty set of values, represented as \fB[]\fR, and
31square brackets may optionally enclose other non-empty sets or single
32values as well.
33.PP
34A few database columns are ``maps'' of key-value pairs, where the key
35and the value are each some fixed database type. These are specified
36in the form \fIkey\fB=\fIvalue\fR, where \fIkey\fR and \fIvalue\fR
37follow the syntax for the column's key type and value type,
38respectively. When multiple pairs are present (separated by spaces or
39a comma), duplicate keys are not allowed, and again the order is not
40important. Duplicate values are allowed. An empty map is represented
41as \fB{}\fR. Curly braces may optionally enclose non-empty maps as
42well (but use quotes to prevent the shell from expanding
43\fBother-config={0=x,1=y}\fR into \fBother-config=0=x
44other-config=1=y\fR, which may not have the desired effect).
45.
46.ST "Database Command Syntax"
47.
48.IP "[\fB\-\-if\-exists\fR] [\fB\-\-columns=\fIcolumn\fR[\fB,\fIcolumn\fR]...] \fBlist \fItable \fR[\fIrecord\fR]..."
49Lists the data in each specified \fIrecord\fR. If no
50records are specified, lists all the records in \fItable\fR.
51.IP
52If \fB\-\-columns\fR is specified, only the requested columns are
53listed, in the specified order. Otherwise, all columns are listed, in
54alphabetical order by column name.
55.IP
56Without \fB\-\-if-exists\fR, it is an error if any specified
57\fIrecord\fR does not exist. With \fB\-\-if-exists\fR, the command
58ignores any \fIrecord\fR that does not exist, without producing any
59output.
60.
61.IP "[\fB\-\-columns=\fIcolumn\fR[\fB,\fIcolumn\fR]...] \fBfind \fItable \fR[\fIcolumn\fR[\fB:\fIkey\fR]\fB=\fIvalue\fR]..."
62Lists the data in each record in \fItable\fR whose \fIcolumn\fR equals
63\fIvalue\fR or, if \fIkey\fR is specified, whose \fIcolumn\fR contains
64a \fIkey\fR with the specified \fIvalue\fR. The following operators
65may be used where \fB=\fR is written in the syntax summary:
66.RS
67.IP "\fB= != < > <= >=\fR"
68Selects records in which \fIcolumn\fR[\fB:\fIkey\fR] equals, does not
69equal, is less than, is greater than, is less than or equal to, or is
70greater than or equal to \fIvalue\fR, respectively.
71.IP
72Consider \fIcolumn\fR[\fB:\fIkey\fR] and \fIvalue\fR as sets of
73elements. Identical sets are considered equal. Otherwise, if the
74sets have different numbers of elements, then the set with more
75elements is considered to be larger. Otherwise, consider a element
76from each set pairwise, in increasing order within each set. The
77first pair that differs determines the result. (For a column that
78contains key-value pairs, first all the keys are compared, and values
79are considered only if the two sets contain identical keys.)
80.IP "\fB{=} {!=}\fR"
81Test for set equality or inequality, respectively.
82.IP "\fB{<=}\fR"
83Selects records in which \fIcolumn\fR[\fB:\fIkey\fR] is a subset of
84\fIvalue\fR. For example, \fBflood-vlans{<=}1,2\fR selects records in
85which the \fBflood-vlans\fR column is the empty set or contains 1 or 2
86or both.
87.IP "\fB{<}\fR"
88Selects records in which \fIcolumn\fR[\fB:\fIkey\fR] is a proper
89subset of \fIvalue\fR. For example, \fBflood-vlans{<}1,2\fR selects
90records in which the \fBflood-vlans\fR column is the empty set or
91contains 1 or 2 but not both.
92.IP "\fB{>=} {>}\fR"
93Same as \fB{<=}\fR and \fB{<}\fR, respectively, except that the
94relationship is reversed. For example, \fBflood-vlans{>=}1,2\fR
95selects records in which the \fBflood-vlans\fR column contains both 1
96and 2.
97.RE
98.IP
99For arithmetic operators (\fB= != < > <= >=\fR), when \fIkey\fR is
100specified but a particular record's \fIcolumn\fR does not contain
101\fIkey\fR, the record is always omitted from the results. Thus, the
102condition \fBother-config:mtu!=1500\fR matches records that have a
103\fBmtu\fR key whose value is not 1500, but not those that lack an
104\fBmtu\fR key.
105.IP
106For the set operators, when \fIkey\fR is specified but a particular
107record's \fIcolumn\fR does not contain \fIkey\fR, the comparison is
108done against an empty set. Thus, the condition
109\fBother-config:mtu{!=}1500\fR matches records that have a \fBmtu\fR
110key whose value is not 1500 and those that lack an \fBmtu\fR key.
111.IP
112Don't forget to escape \fB<\fR or \fB>\fR from interpretation by the
113shell.
114.IP
115If \fB\-\-columns\fR is specified, only the requested columns are
116listed, in the specified order. Otherwise all columns are listed, in
117alphabetical order by column name.
118.IP
119The UUIDs shown for rows created in the same \fB\*(PN\fR
120invocation will be wrong.
121.
122.IP "[\fB\-\-if\-exists\fR] [\fB\-\-id=@\fIname\fR] \fBget \fItable record \fR[\fIcolumn\fR[\fB:\fIkey\fR]]..."
123Prints the value of each specified \fIcolumn\fR in the given
124\fIrecord\fR in \fItable\fR. For map columns, a \fIkey\fR may
125optionally be specified, in which case the value associated with
126\fIkey\fR in the column is printed, instead of the entire map.
127.IP
128Without \fB\-\-if\-exists\fR, it is an error if \fIrecord\fR does not
129exist or \fIkey\fR is specified, if \fIkey\fR does not exist in
130\fIrecord\fR. With \fB\-\-if\-exists\fR, a missing \fIrecord\fR
131yields no output and a missing \fIkey\fR prints a blank line.
132.IP
133If \fB@\fIname\fR is specified, then the UUID for \fIrecord\fR may be
134referred to by that name later in the same \fB\*(PN\fR
135invocation in contexts where a UUID is expected.
136.IP
137Both \fB\-\-id\fR and the \fIcolumn\fR arguments are optional, but
138usually at least one or the other should be specified. If both are
139omitted, then \fBget\fR has no effect except to verify that
140\fIrecord\fR exists in \fItable\fR.
141.IP
142\fB\-\-id\fR and \fB\-\-if\-exists\fR cannot be used together.
143.
144.IP "[\fB\-\-if\-exists\fR] \fBset \fItable record column\fR[\fB:\fIkey\fR]\fB=\fIvalue\fR..."
145Sets the value of each specified \fIcolumn\fR in the given
146\fIrecord\fR in \fItable\fR to \fIvalue\fR. For map columns, a
147\fIkey\fR may optionally be specified, in which case the value
148associated with \fIkey\fR in that column is changed (or added, if none
149exists), instead of the entire map.
150.IP
151Without \fB\-\-if-exists\fR, it is an error if \fIrecord\fR does not
152exist. With \fB\-\-if-exists\fR, this command does nothing if
153\fIrecord\fR does not exist.
154.
155.IP "[\fB\-\-if\-exists\fR] \fBadd \fItable record column \fR[\fIkey\fB=\fR]\fIvalue\fR..."
156Adds the specified value or key-value pair to \fIcolumn\fR in
157\fIrecord\fR in \fItable\fR. If \fIcolumn\fR is a map, then \fIkey\fR
158is required, otherwise it is prohibited. If \fIkey\fR already exists
159in a map column, then the current \fIvalue\fR is not replaced (use the
160\fBset\fR command to replace an existing value).
161.IP
162Without \fB\-\-if-exists\fR, it is an error if \fIrecord\fR does not
163exist. With \fB\-\-if-exists\fR, this command does nothing if
164\fIrecord\fR does not exist.
165.
166.IP "[\fB\-\-if\-exists\fR] \fBremove \fItable record column \fR\fIvalue\fR..."
167.IQ "[\fB\-\-if\-exists\fR] \fBremove \fItable record column \fR\fIkey\fR..."
168.IQ "[\fB\-\-if\-exists\fR] \fBremove \fItable record column \fR\fIkey\fB=\fR\fIvalue\fR..."
169Removes the specified values or key-value pairs from \fIcolumn\fR in
170\fIrecord\fR in \fItable\fR. The first form applies to columns that
171are not maps: each specified \fIvalue\fR is removed from the column.
172The second and third forms apply to map columns: if only a \fIkey\fR
173is specified, then any key-value pair with the given \fIkey\fR is
174removed, regardless of its value; if a \fIvalue\fR is given then a
175pair is removed only if both key and value match.
176.IP
177It is not an error if the column does not contain the specified key or
178value or pair.
179.IP
180Without \fB\-\-if-exists\fR, it is an error if \fIrecord\fR does not
181exist. With \fB\-\-if-exists\fR, this command does nothing if
182\fIrecord\fR does not exist.
183.
184.IP "[\fB\-\-if\-exists\fR] \fBclear\fR \fItable record column\fR..."
185Sets each \fIcolumn\fR in \fIrecord\fR in \fItable\fR to the empty set
186or empty map, as appropriate. This command applies only to columns
187that are allowed to be empty.
188.IP
189Without \fB\-\-if-exists\fR, it is an error if \fIrecord\fR does not
190exist. With \fB\-\-if-exists\fR, this command does nothing if
191\fIrecord\fR does not exist.
192.
193.IP "[\fB\-\-id=@\fIname\fR] \fBcreate\fR \fItable column\fR[\fB:\fIkey\fR]\fB=\fIvalue\fR..."
194Creates a new record in \fItable\fR and sets the initial values of
195each \fIcolumn\fR. Columns not explicitly set will receive their
196default values. Outputs the UUID of the new row.
197.IP
198If \fB@\fIname\fR is specified, then the UUID for the new row may be
199referred to by that name elsewhere in the same \fB\*(PN\fR
200invocation in contexts where a UUID is expected. Such references may
201precede or follow the \fBcreate\fR command.
202.
203.RS
204.IP "Caution (ovs-vsctl as exmaple)"
205Records in the Open vSwitch database are significant only when they
206can be reached directly or indirectly from the \fBOpen_vSwitch\fR
207table. Except for records in the \fBQoS\fR or \fBQueue\fR tables,
208records that are not reachable from the \fBOpen_vSwitch\fR table are
209automatically deleted from the database. This deletion happens
210immediately, without waiting for additional \fBovs\-vsctl\fR commands
211or other database activity. Thus, a \fBcreate\fR command must
212generally be accompanied by additional commands \fIwithin the same
213\fBovs\-vsctl\fI invocation\fR to add a chain of references to the
214newly created record from the top-level \fBOpen_vSwitch\fR record.
215The \fBEXAMPLES\fR section gives some examples that show how to do
216this.
217.RE
218.
219.IP "\fR[\fB\-\-if\-exists\fR] \fBdestroy \fItable record\fR..."
220Deletes each specified \fIrecord\fR from \fItable\fR. Unless
221\fB\-\-if\-exists\fR is specified, each \fIrecord\fRs must exist.
222.IP "\fB\-\-all destroy \fItable\fR"
223Deletes all records from the \fItable\fR.
224.
225.RS
226.IP "Caution (ovs-vsctl as exmaple)"
227The \fBdestroy\fR command is only useful for records in the \fBQoS\fR
228or \fBQueue\fR tables. Records in other tables are automatically
229deleted from the database when they become unreachable from the
230\fBOpen_vSwitch\fR table. This means that deleting the last reference
231to a record is sufficient for deleting the record itself. For records
232in these tables, \fBdestroy\fR is silently ignored. See the
233\fBEXAMPLES\fR section below for more information.
234.RE
235.
236.IP "\fBwait\-until \fItable record \fR[\fIcolumn\fR[\fB:\fIkey\fR]\fB=\fIvalue\fR]..."
237Waits until \fItable\fR contains a record named \fIrecord\fR whose
238\fIcolumn\fR equals \fIvalue\fR or, if \fIkey\fR is specified, whose
239\fIcolumn\fR contains a \fIkey\fR with the specified \fIvalue\fR. Any
240of the operators \fB!=\fR, \fB<\fR, \fB>\fR, \fB<=\fR, or \fB>=\fR may
241be substituted for \fB=\fR to test for inequality, less than, greater
242than, less than or equal to, or greater than or equal to,
243respectively. (Don't forget to escape \fB<\fR or \fB>\fR from
244interpretation by the shell.)
245.IP
246If no \fIcolumn\fR[\fB:\fIkey\fR]\fB=\fIvalue\fR arguments are given,
247this command waits only until \fIrecord\fR exists. If more than one
248such argument is given, the command waits until all of them are
249satisfied.
250.
251.RS
252.IP "Caution (ovs-vsctl as exmaple)"
253Usually \fBwait\-until\fR should be placed at the beginning of a set
254of \fBovs\-vsctl\fR commands. For example, \fBwait\-until bridge br0
255\-\- get bridge br0 datapath_id\fR waits until a bridge named
256\fBbr0\fR is created, then prints its \fBdatapath_id\fR column,
257whereas \fBget bridge br0 datapath_id \-\- wait\-until bridge br0\fR
258will abort if no bridge named \fBbr0\fR exists when \fBovs\-vsctl\fR
259initially connects to the database.
260.RE
261.IP
262Consider specifying \fB\-\-timeout=0\fR along with
263\fB\-\-wait\-until\fR, to prevent \fB\*(PN\fR from terminating
264after waiting only at most 5 seconds.
265.IP "\fBcomment \fR[\fIarg\fR]..."
266This command has no effect on behavior, but any database log record
267created by the command will include the command and its arguments.