From patchwork Thu Feb 15 22:49:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Michelson X-Patchwork-Id: 874204 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zjBLM1yWJz9sRW for ; Fri, 16 Feb 2018 09:50:03 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id AEA851103; Thu, 15 Feb 2018 22:50:00 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 62A8C1102 for ; Thu, 15 Feb 2018 22:49:59 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 6CC0E418 for ; Thu, 15 Feb 2018 22:49:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8D72D407246C for ; Thu, 15 Feb 2018 22:49:57 +0000 (UTC) Received: from monae.redhat.com (ovpn-122-131.rdu2.redhat.com [10.10.122.131]) by smtp.corp.redhat.com (Postfix) with ESMTP id 610E22141200 for ; Thu, 15 Feb 2018 22:49:57 +0000 (UTC) From: Mark Michelson To: dev@openvswitch.org Date: Thu, 15 Feb 2018 16:49:57 -0600 Message-Id: <20180215224957.2128-1-mmichels@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Thu, 15 Feb 2018 22:49:57 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Thu, 15 Feb 2018 22:49:57 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'mmichels@redhat.com' RCPT:'' X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, T_RP_MATCHES_RCVD autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH v2] Refer to database manpages in *ctl manpages X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org The ovn-nbctl, ovn-sbctl, and ovs-vsctl manpages are inconsistent in their "Database Commands" section when it comes to referring to what database tables exist. This commit amends this by making each *ctl manpage reference the corresponding database manpage instead. To aid in having a more handy list, the --help text of ovn-nbctl, ovn-sbctl, and ovs-vsctl have been modified to list the available tables. This is also referenced in the manpages for those applications. Signed-off-by: Mark Michelson Signed-off-by: Mark Michelson Signed-off-by: Ben Pfaff Signed-off-by: Mark Michelson Signed-off-by: Ben Pfaff --- lib/db-ctl-base.c | 14 ++++++++++ lib/db-ctl-base.h | 3 +++ ovn/lib/ovn-util.h | 5 ++++ ovn/utilities/ovn-nbctl.8.xml | 61 +++---------------------------------------- ovn/utilities/ovn-nbctl.c | 10 +++++++ ovn/utilities/ovn-sbctl.8.in | 5 ++-- ovn/utilities/ovn-sbctl.c | 10 +++++++ utilities/ovs-vsctl.8.in | 51 ++---------------------------------- utilities/ovs-vsctl.c | 12 ++++++++- 9 files changed, 62 insertions(+), 109 deletions(-) diff --git a/lib/db-ctl-base.c b/lib/db-ctl-base.c index 9fec6fa0d..4a9ae3286 100644 --- a/lib/db-ctl-base.c +++ b/lib/db-ctl-base.c @@ -2170,6 +2170,20 @@ ctl_get_db_cmd_usage(void) Potentially unsafe database commands require --force option.\n"; } +const char * +ctl_list_db_tables_usage(struct ds *tables, const struct ovsdb_idl_table_class *class, + int n_tables) +{ + if (!tables->length) { + ds_put_cstr(tables, "Valid tables for this database are:\n"); + for (int i = 0; i < n_tables; i++) { + ds_put_format(tables, " %s\n", class[i].name); + } + } + + return ds_cstr(tables); +} + /* Initializes 'ctx' from 'command'. */ void ctl_context_init_command(struct ctl_context *ctx, diff --git a/lib/db-ctl-base.h b/lib/db-ctl-base.h index 81f0d0b27..71fb123c5 100644 --- a/lib/db-ctl-base.h +++ b/lib/db-ctl-base.h @@ -159,6 +159,9 @@ struct ctl_command { bool ctl_might_write_to_db(char **argv); const char *ctl_get_db_cmd_usage(void); + +const char *ctl_list_db_tables_usage(struct ds *tables, + const struct ovsdb_idl_table_class *class, int n_tables); void ctl_print_commands(void); void ctl_print_options(const struct option *); void ctl_add_cmd_options(struct option **, size_t *n_options_p, diff --git a/ovn/lib/ovn-util.h b/ovn/lib/ovn-util.h index 9b456426d..e7e84b98e 100644 --- a/ovn/lib/ovn-util.h +++ b/ovn/lib/ovn-util.h @@ -67,6 +67,11 @@ char *alloc_nat_zone_key(const struct uuid *key, const char *type); const char *default_nb_db(void); const char *default_sb_db(void); +struct ovsdb_idl_table_class; +const char *db_table_usage(struct ds *tables, + const struct ovsdb_idl_table_class *class, + int n_tables); + bool ovn_is_known_nb_lsp_type(const char *type); #endif diff --git a/ovn/utilities/ovn-nbctl.8.xml b/ovn/utilities/ovn-nbctl.8.xml index 4d0aea963..7f4b3aba8 100644 --- a/ovn/utilities/ovn-nbctl.8.xml +++ b/ovn/utilities/ovn-nbctl.8.xml @@ -820,64 +820,11 @@ additional ways to identify records. Some commands also take column parameters that identify a particular field within the records in a table.

-

The following tables are currently defined:

-
-
Logical_Switch
-
- An L2 logical switch. Records may be identified by name. -
- -
Logical_Switch_Port
-
- A port within an L2 logical switch. Records may be identified by name. -
- -
ACL
-
- An ACL rule for a logical switch that points to it through its acls column. -
- -
Logical_Router
-
- An L3 logical router. Records may be identified by name. -
- -
Logical_Router_Port
-
- A port within an L3 logical router. Records may be identified by name. -
- -
Logical_Router_Static_Route
-
- A static route belonging to an L3 logical router. -
-
Address_Set
-
- An address set that can be used in ACLs. -
- -
Load_Balancer
-
- A load balancer for a logical switch that points to it through its load_balancer column. -
- -
NAT
-
- A NAT rule for a Gateway router. -
- -
DHCP_Options
-
- DHCP options. -
- -
NB_Global
-
- North bound global configurations. -
- -
+

+ For a list of tables and their columns, see ovn-nb(5) or + see the table listing from the --help option. +

Record names must be specified in full and with correct capitalization, diff --git a/ovn/utilities/ovn-nbctl.c b/ovn/utilities/ovn-nbctl.c index b3f60bdb7..1152ee075 100644 --- a/ovn/utilities/ovn-nbctl.c +++ b/ovn/utilities/ovn-nbctl.c @@ -314,6 +314,14 @@ parse_options(int argc, char *argv[], struct shash *local_options) free(options); } +static const char *db_table_list(void) +{ + static struct ds tables = DS_EMPTY_INITIALIZER; + + return ctl_list_db_tables_usage(&tables, nbrec_table_classes, + NBREC_N_TABLES); +} + static void usage(void) { @@ -455,6 +463,7 @@ SSL commands:\n\ set the SSL configuration\n\ \n\ %s\ +%s\ \n\ Synchronization command (use with --wait=sb|hv):\n\ sync wait even for earlier changes to take effect\n\ @@ -469,6 +478,7 @@ Options:\n\ --dry-run do not commit changes to database\n\ --oneline print exactly one line of output per command\n", program_name, program_name, ctl_get_db_cmd_usage(), + db_table_list(), default_nb_db()); table_usage(); vlog_usage(); diff --git a/ovn/utilities/ovn-sbctl.8.in b/ovn/utilities/ovn-sbctl.8.in index cd43cf3be..c59a9f542 100644 --- a/ovn/utilities/ovn-sbctl.8.in +++ b/ovn/utilities/ovn-sbctl.8.in @@ -278,8 +278,9 @@ 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 +For a list of tables and their columns, see \fBovn\-sb\fR(5) or +see the table listing from the \fB--help\fR option. .PP Record names must be specified in full and with correct capitalization, except that UUIDs may be abbreviated to their first 4 diff --git a/ovn/utilities/ovn-sbctl.c b/ovn/utilities/ovn-sbctl.c index 5764ee336..0d1d36235 100644 --- a/ovn/utilities/ovn-sbctl.c +++ b/ovn/utilities/ovn-sbctl.c @@ -288,6 +288,14 @@ parse_options(int argc, char *argv[], struct shash *local_options) free(options); } +static const char *db_table_list(void) +{ + static struct ds tables = DS_EMPTY_INITIALIZER; + + return ctl_list_db_tables_usage(&tables, sbrec_table_classes, + SBREC_N_TABLES); +} + static void usage(void) { @@ -326,6 +334,7 @@ SSL commands:\n\ set the SSL configuration\n\ \n\ %s\ +%s\ \n\ Options:\n\ --db=DATABASE connect to DATABASE\n\ @@ -334,6 +343,7 @@ Options:\n\ --dry-run do not commit changes to database\n\ --oneline print exactly one line of output per command\n", program_name, program_name, ctl_get_db_cmd_usage(), + db_table_list(), default_sb_db()); table_usage(); vlog_usage(); diff --git a/utilities/ovs-vsctl.8.in b/utilities/ovs-vsctl.8.in index 34f41e4e8..b18782c31 100644 --- a/utilities/ovs-vsctl.8.in +++ b/utilities/ovs-vsctl.8.in @@ -530,55 +530,8 @@ additional ways to identify records. Some commands also take \fIcolumn\fR parameters that identify a particular field within the records in a table. .PP -The following tables are currently defined: -.IP "\fBOpen_vSwitch\fR" -Global configuration for an \fBovs\-vswitchd\fR. This table contains -exactly one record, identified by specifying \fB.\fR as the record -name. -.IP "\fBBridge\fR" -Configuration for a bridge within an Open vSwitch. Records may be -identified by bridge name. -.IP "\fBPort\fR" -A bridge port. Records may be identified by port name. -.IP "\fBInterface\fR" -A network device attached to a port. Records may be identified by -name. -.IP "\fBFlow_Table\fR" -Configuration for a particular OpenFlow flow table. Records may be -identified by name. -.IP "\fBQoS\fR" -Quality-of-service configuration for a \fBPort\fR. Records may be -identified by port name. -.IP "\fBQueue\fR" -Configuration for one queue within a \fBQoS\fR configuration. Records -may only be identified by UUID. -.IP "\fBMirror\fR" -A port mirroring configuration attached to a bridge. Records may be -identified by mirror name. -.IP "\fBController\fR" -Configuration for an OpenFlow controller. A controller attached to a -particular bridge may be identified by the bridge's name. -.IP "\fBManager\fR" -Configuration for an OVSDB connection. Records may be identified -by target (e.g. \fBtcp:1.2.3.4\fR). -.IP "\fBNetFlow\fR" -A NetFlow configuration attached to a bridge. Records may be -identified by bridge name. -.IP "\fBSSL\fR" -The global SSL configuration for \fBovs\-vswitchd\fR. The record -attached to the \fBOpen_vSwitch\fR table may be identified by -specifying \fB.\fR as the record name. -.IP "\fBsFlow\fR" -An sFlow exporter configuration attached to a bridge. Records may be -identified by bridge name. -.IP "\fBIPFIX\fR" -An IPFIX exporter configuration attached to a bridge. Records may be -identified by bridge name. -.IP "\fBFlow_Sample_Collector_Set\fR" -An IPFIX exporter configuration attached to a bridge for sampling -packets on a per-flow basis using OpenFlow \fBsample\fR actions. -.IP "\fBAutoAttach\fR" -Configuration for Auto Attach within a bridge. +For a list of tables and their columns, see \fBovs-vswitchd.conf.db\fR(5) or +see the table listing from the \fB--help\fR option. .PP Record names must be specified in full and with correct capitalization, except that UUIDs may be abbreviated to their first 4 diff --git a/utilities/ovs-vsctl.c b/utilities/ovs-vsctl.c index e22baeb28..38c202365 100644 --- a/utilities/ovs-vsctl.c +++ b/utilities/ovs-vsctl.c @@ -353,6 +353,14 @@ parse_options(int argc, char *argv[], struct shash *local_options) free(options); } +static const char *db_table_list(void) +{ + static struct ds tables = DS_EMPTY_INITIALIZER; + + return ctl_list_db_tables_usage(&tables, ovsrec_table_classes, + OVSREC_N_TABLES); +} + static void usage(void) { @@ -416,6 +424,7 @@ Switch commands:\n\ emer-reset reset switch to known good state\n\ \n\ %s\ +%s\ \n\ Options:\n\ --db=DATABASE connect to DATABASE\n\ @@ -425,7 +434,8 @@ Options:\n\ -t, --timeout=SECS wait at most SECS seconds for ovs-vswitchd\n\ --dry-run do not commit changes to database\n\ --oneline print exactly one line of output per command\n", - program_name, program_name, ctl_get_db_cmd_usage(), ctl_default_db()); + program_name, program_name, ctl_get_db_cmd_usage(), db_table_list(), + ctl_default_db()); table_usage(); vlog_usage(); printf("\