mirror of
https://github.com/openvswitch/ovs
synced 2025-08-30 13:58:14 +00:00
db-ctl-base: Allow record UUIDs to be abbreviated.
This makes it easier to type ovs-vsctl, ovn-sbctl, ovn-nbctl, and vtep-ctl commands without cut-and-paste. Signed-off-by: Ben Pfaff <blp@ovn.org> Acked-by: Andy Zhou <azhou@ovn.org>
This commit is contained in:
parent
ad73c1429a
commit
4e3000a09f
4
NEWS
4
NEWS
@ -12,6 +12,8 @@ Post-v2.7.0
|
|||||||
still can be configured via extra arguments for DPDK EAL.
|
still can be configured via extra arguments for DPDK EAL.
|
||||||
- New support for multiple VLANs (802.1ad or "QinQ"), including a new
|
- New support for multiple VLANs (802.1ad or "QinQ"), including a new
|
||||||
"dot1q-tunnel" port VLAN mode.
|
"dot1q-tunnel" port VLAN mode.
|
||||||
|
- In ovn-vsctl and vtep-ctl, record UUIDs in commands may now be
|
||||||
|
abbreviated to 4 hex digits.
|
||||||
- OVN:
|
- OVN:
|
||||||
* IPAM for IPv4 can now exclude user-defined addresses from assignment.
|
* IPAM for IPv4 can now exclude user-defined addresses from assignment.
|
||||||
* IPAM can now assign IPv6 addresses.
|
* IPAM can now assign IPv6 addresses.
|
||||||
@ -20,6 +22,8 @@ Post-v2.7.0
|
|||||||
* Allow ovn-controller SSL configuration to be obtained from vswitchd
|
* Allow ovn-controller SSL configuration to be obtained from vswitchd
|
||||||
database.
|
database.
|
||||||
* ovn-trace now has basic support for tracing distributed firewalls.
|
* ovn-trace now has basic support for tracing distributed firewalls.
|
||||||
|
* In ovn-nbctl and ovn-sbctl, record UUIDs in commands may now be
|
||||||
|
abbreviated to 4 hex digits.
|
||||||
- Add the command 'ovs-appctl stp/show' (see ovs-vswitchd(8)).
|
- Add the command 'ovs-appctl stp/show' (see ovs-vswitchd(8)).
|
||||||
- OpenFlow:
|
- OpenFlow:
|
||||||
* Increased support for OpenFlow 1.6 (draft).
|
* Increased support for OpenFlow 1.6 (draft).
|
||||||
|
@ -300,6 +300,14 @@ get_row_by_id(struct ctl_context *ctx,
|
|||||||
return final;
|
return final;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool
|
||||||
|
is_partial_uuid_match(const struct uuid *uuid, const char *match)
|
||||||
|
{
|
||||||
|
char uuid_s[UUID_LEN + 1];
|
||||||
|
snprintf(uuid_s, sizeof uuid_s, UUID_FMT, UUID_ARGS(uuid));
|
||||||
|
return !strncmp(uuid_s, match, strlen(match));
|
||||||
|
}
|
||||||
|
|
||||||
static const struct ovsdb_idl_row *
|
static const struct ovsdb_idl_row *
|
||||||
get_row(struct ctl_context *ctx,
|
get_row(struct ctl_context *ctx,
|
||||||
const struct ovsdb_idl_table_class *table, const char *record_id,
|
const struct ovsdb_idl_table_class *table, const char *record_id,
|
||||||
@ -330,6 +338,26 @@ get_row(struct ctl_context *ctx,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!row
|
||||||
|
&& record_id[uuid_is_partial_string(record_id)] == '\0'
|
||||||
|
&& strlen(record_id) >= 4) {
|
||||||
|
for (const struct ovsdb_idl_row *r = ovsdb_idl_first_row(ctx->idl,
|
||||||
|
table);
|
||||||
|
r != NULL;
|
||||||
|
r = ovsdb_idl_next_row(r)) {
|
||||||
|
if (is_partial_uuid_match(&r->uuid, record_id)) {
|
||||||
|
if (!row) {
|
||||||
|
row = r;
|
||||||
|
} else {
|
||||||
|
ctl_fatal("%s contains 2 or more rows whose UUIDs begin "
|
||||||
|
"with %s: at least "UUID_FMT" and "UUID_FMT,
|
||||||
|
table->name, record_id,
|
||||||
|
UUID_ARGS(&row->uuid),
|
||||||
|
UUID_ARGS(&r->uuid));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (must_exist && !row) {
|
if (must_exist && !row) {
|
||||||
ctl_fatal("no row \"%s\" in table %s", record_id, table->name);
|
ctl_fatal("no row \"%s\" in table %s", record_id, table->name);
|
||||||
}
|
}
|
||||||
|
@ -674,7 +674,8 @@
|
|||||||
<p>Each of these commands has a <var>table</var> parameter to identify a table
|
<p>Each of these commands has a <var>table</var> parameter to identify a table
|
||||||
within the database. Many of them also take a <var>record</var> parameter
|
within the database. Many of them also take a <var>record</var> parameter
|
||||||
that identifies a particular record within a table. The <var>record</var>
|
that identifies a particular record within a table. The <var>record</var>
|
||||||
parameter may be the UUID for a record, and many tables offer
|
parameter may be the UUID for a record, which may be abbreviated to its
|
||||||
|
first 4 (or more) hex digits, as long as that is unique. Many tables offer
|
||||||
additional ways to identify records. Some commands also take
|
additional ways to identify records. Some commands also take
|
||||||
<var>column</var> parameters that identify a particular field within the
|
<var>column</var> parameters that identify a particular field within the
|
||||||
records in a table.</p>
|
records in a table.</p>
|
||||||
@ -737,6 +738,16 @@
|
|||||||
|
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Record names must be specified in full and with correct capitalization,
|
||||||
|
except that UUIDs may be abbreviated to their first 4 (or more) hex
|
||||||
|
digits, as long as that is unique within the table. Names of tables and
|
||||||
|
columns are not case-sensitive, and <code>-</code> and <code>_</code> are
|
||||||
|
treated interchangeably. Unique abbreviations of table and column names
|
||||||
|
are acceptable, e.g. <code>d</code> or <code>dhcp</code> is sufficient
|
||||||
|
to identify the <code>DHCP_Options</code> table.
|
||||||
|
</p>
|
||||||
|
|
||||||
<xi:include href="lib/db-ctl-base.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>
|
<xi:include href="lib/db-ctl-base.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>
|
||||||
|
|
||||||
<h1>Synchronization Commands</h1>
|
<h1>Synchronization Commands</h1>
|
||||||
|
@ -257,6 +257,32 @@ This option is only useful if the SSL peer sends its CA certificate
|
|||||||
as part of the SSL certificate chain. The SSL protocol does not
|
as part of the SSL certificate chain. The SSL protocol does not
|
||||||
require the controller to send the CA certificate.
|
require the controller to send the CA certificate.
|
||||||
.
|
.
|
||||||
|
.SS "Database Commands"
|
||||||
|
.
|
||||||
|
These commands query and modify the contents of \fBovsdb\fR tables.
|
||||||
|
They are a slight abstraction of the \fBovsdb\fR interface and as such
|
||||||
|
they operate at a lower level than other \fBovs\-sbctl\fR commands.
|
||||||
|
.PP
|
||||||
|
.ST "Identifying Tables, Records, and Columns"
|
||||||
|
.PP
|
||||||
|
Each of these commands has a \fItable\fR parameter to identify a table
|
||||||
|
within the database. Many of them also take a \fIrecord\fR parameter
|
||||||
|
that identifies a particular record within a table. The \fIrecord\fR
|
||||||
|
parameter may be the UUID for a record, and many tables offer
|
||||||
|
additional ways to identify records. Some commands also take
|
||||||
|
\fIcolumn\fR parameters that identify a particular field within the
|
||||||
|
records in a table.
|
||||||
|
.\" It would be kind to list all the tables and their supported identifiers
|
||||||
|
.\" here.
|
||||||
|
.PP
|
||||||
|
Record names must be specified in full and with correct
|
||||||
|
capitalization, except that UUIDs may be abbreviated to their first 4
|
||||||
|
(or more) hex digits, as long as that is unique within the table.
|
||||||
|
Names of tables and columns are not case-sensitive, and \fB\-\fR and
|
||||||
|
\fB_\fR are treated interchangeably. Unique abbreviations of table
|
||||||
|
and column names are acceptable, e.g. \fBaddr\fR or \fBa\fR is
|
||||||
|
sufficient to identify the \fBAddress_Set\fR table.
|
||||||
|
.
|
||||||
.so lib/db-ctl-base.man
|
.so lib/db-ctl-base.man
|
||||||
.SH "EXIT STATUS"
|
.SH "EXIT STATUS"
|
||||||
.IP "0"
|
.IP "0"
|
||||||
|
@ -727,6 +727,9 @@ is_partial_uuid_match(const struct uuid *uuid, const char *match)
|
|||||||
char uuid_s[UUID_LEN + 1];
|
char uuid_s[UUID_LEN + 1];
|
||||||
snprintf(uuid_s, sizeof uuid_s, UUID_FMT, UUID_ARGS(uuid));
|
snprintf(uuid_s, sizeof uuid_s, UUID_FMT, UUID_ARGS(uuid));
|
||||||
|
|
||||||
|
/* We strip leading zeros because we want to accept cookie values derived
|
||||||
|
* from UUIDs, and cookie values are printed without leading zeros because
|
||||||
|
* they're just numbers. */
|
||||||
const char *s1 = strip_leading_zero(uuid_s);
|
const char *s1 = strip_leading_zero(uuid_s);
|
||||||
const char *s2 = strip_leading_zero(match);
|
const char *s2 = strip_leading_zero(match);
|
||||||
|
|
||||||
|
@ -560,10 +560,12 @@ packets on a per-flow basis using OpenFlow \fBsample\fR actions.
|
|||||||
Configuration for Auto Attach within a bridge.
|
Configuration for Auto Attach within a bridge.
|
||||||
.PP
|
.PP
|
||||||
Record names must be specified in full and with correct
|
Record names must be specified in full and with correct
|
||||||
capitalization. Names of tables and columns are not case-sensitive,
|
capitalization, except that UUIDs may be abbreviated to their first 4
|
||||||
and \fB\-\-\fR and \fB_\fR are treated interchangeably. Unique
|
(or more) hex digits, as long as that is unique within the table.
|
||||||
abbreviations are acceptable, e.g. \fBnet\fR or \fBn\fR is sufficient
|
Names of tables and columns are not case-sensitive, and \fB\-\fR and
|
||||||
to identify the \fBNetFlow\fR table.
|
\fB_\fR are treated interchangeably. Unique abbreviations of table
|
||||||
|
and column names are acceptable, e.g. \fBnet\fR or \fBn\fR is
|
||||||
|
sufficient to identify the \fBNetFlow\fR table.
|
||||||
.
|
.
|
||||||
.so lib/db-ctl-base.man
|
.so lib/db-ctl-base.man
|
||||||
.SH "EXAMPLES"
|
.SH "EXAMPLES"
|
||||||
|
@ -394,10 +394,12 @@ encapsulated and forwarded. Records may be identified by physical
|
|||||||
locator name.
|
locator name.
|
||||||
.PP
|
.PP
|
||||||
Record names must be specified in full and with correct
|
Record names must be specified in full and with correct
|
||||||
capitalization. Names of tables and columns are not case-sensitive,
|
capitalization, except that UUIDs may be abbreviated to their first 4
|
||||||
and \fB\-\-\fR and \fB_\fR are treated interchangeably. Unique
|
(or more) hex digits, as long as that is unique within the table.
|
||||||
abbreviations are acceptable, e.g. \fBman\fR or \fBm\fR is sufficient
|
Names of tables and columns are not case-sensitive, and \fB\-\fR and
|
||||||
to identify the \fBManager\fR table.
|
\fB_\fR are treated interchangeably. Unique abbreviations of table
|
||||||
|
and column names are acceptable, e.g. \fBman\fR or \fBm\fR is
|
||||||
|
sufficient to identify the \fBManager\fR table.
|
||||||
.
|
.
|
||||||
.so lib/db-ctl-base.man
|
.so lib/db-ctl-base.man
|
||||||
.PP
|
.PP
|
||||||
|
Loading…
x
Reference in New Issue
Block a user