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