From patchwork Tue Sep 10 07:42:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Numan Siddique X-Patchwork-Id: 1160051 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=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com 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 46SH8B0MRhz9s7T for ; Tue, 10 Sep 2019 17:43:21 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 9AF1CE18; Tue, 10 Sep 2019 07:43:17 +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 8E6FEB62 for ; Tue, 10 Sep 2019 07:43:15 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id DE6F581A for ; Tue, 10 Sep 2019 07:43:13 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3BF672A09A8 for ; Tue, 10 Sep 2019 07:43:13 +0000 (UTC) Received: from nummac.local (ovpn-116-211.sin2.redhat.com [10.67.116.211]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1D71E10018F9; Tue, 10 Sep 2019 07:43:09 +0000 (UTC) From: nusiddiq@redhat.com To: dev@openvswitch.org Date: Tue, 10 Sep 2019 13:12:57 +0530 Message-Id: <20190910074257.23151-1-nusiddiq@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 10 Sep 2019 07:43:13 +0000 (UTC) X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 ovn v2 1/2] Add ovn-appctl utility 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: , Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org From: Numan Siddique Now that OVN has it's own rundir, "ovs-appctl -t ovn-controller/ovn-northd" doesn't work. To fix this, ovn-appctl utility is added which looks for the OVN pid/ctl files in the ovn rundir. The code is taken from ovs-appctl.c and modified to use ovn_rundir() instead of ovs_rundir(). Signed-off-by: Numan Siddique Acked-by: Mark Michelson --- rhel/ovn-fedora.spec.in | 2 + utilities/.gitignore | 2 + utilities/automake.mk | 13 +- utilities/ovn-appctl.8.xml | 352 +++++++++++++++++++++++++++++++++++++ utilities/ovn-appctl.c | 239 +++++++++++++++++++++++++ utilities/ovn-ctl | 18 +- 6 files changed, 615 insertions(+), 11 deletions(-) create mode 100644 utilities/ovn-appctl.8.xml create mode 100644 utilities/ovn-appctl.c diff --git a/rhel/ovn-fedora.spec.in b/rhel/ovn-fedora.spec.in index 14035de9a..9ee807fab 100644 --- a/rhel/ovn-fedora.spec.in +++ b/rhel/ovn-fedora.spec.in @@ -430,6 +430,7 @@ fi %{_bindir}/ovn-sbctl %{_bindir}/ovn-trace %{_bindir}/ovn-detrace +%{_bindir}/ovn-appctl %{_datadir}/ovn/scripts/ovn-ctl %{_datadir}/ovn/scripts/ovn-lib %{_datadir}/ovn/scripts/ovndb-servers.ocf @@ -440,6 +441,7 @@ fi %{_mandir}/man8/ovn-nbctl.8* %{_mandir}/man8/ovn-trace.8* %{_mandir}/man1/ovn-detrace.1* +%{_mandir}/man8/ovn-appctl.8* #%{_mandir}/man7/ovn-architecture.7* - Uncomment this once the manpage is fixed %{_mandir}/man8/ovn-sbctl.8* #%{_mandir}/man5/ovn-nb.5* - Uncomment this once the manpage is fixed diff --git a/utilities/.gitignore b/utilities/.gitignore index 1d01e0b28..b319e8366 100644 --- a/utilities/.gitignore +++ b/utilities/.gitignore @@ -3,6 +3,8 @@ /ovn-nbctl.8 /ovn-sbctl /ovn-sbctl.8 +/ovn-appctl +/ovn-appctl.8 /ovn-trace /ovn-trace.8 /ovn-detrace diff --git a/utilities/automake.mk b/utilities/automake.mk index 21dd8ccdf..ab0f6003a 100644 --- a/utilities/automake.mk +++ b/utilities/automake.mk @@ -8,7 +8,8 @@ man_MANS += \ utilities/ovn-nbctl.8 \ utilities/ovn-sbctl.8 \ utilities/ovn-trace.8 \ - utilities/ovn-detrace.1 + utilities/ovn-detrace.1 \ + utilities/ovn-appctl.8 MAN_ROOTS += \ utilities/ovn-sbctl.8.in \ @@ -27,6 +28,7 @@ EXTRA_DIST += \ utilities/ovn-docker-overlay-driver.in \ utilities/ovn-docker-underlay-driver.in \ utilities/ovn-nbctl.8.xml \ + utilities/ovn-appctl.8.xml \ utilities/ovn-trace.8.xml \ utilities/ovn-detrace.in \ utilities/ovndb-servers.ocf \ @@ -49,7 +51,9 @@ CLEANFILES += \ utilities/ovn-sbctl.8 \ utilities/ovn-trace.8 \ utilities/ovn-detrace.1 \ - utilities/ovn-detrace + utilities/ovn-detrace \ + utilities/ovn-appctl.8 \ + utilities/ovn-appctl utilities/ovn-lib: $(top_builddir)/config.status @@ -68,4 +72,9 @@ bin_PROGRAMS += utilities/ovn-trace utilities_ovn_trace_SOURCES = utilities/ovn-trace.c utilities_ovn_trace_LDADD = lib/libovn.la $(OVSDB_LIBDIR)/libovsdb.la $(OVS_LIBDIR)/libopenvswitch.la +# ovn-nbctl +bin_PROGRAMS += utilities/ovn-appctl +utilities_ovn_appctl_SOURCES = utilities/ovn-appctl.c +utilities_ovn_appctl_LDADD = lib/libovn.la $(OVSDB_LIBDIR)/libovsdb.la $(OVS_LIBDIR)/libopenvswitch.la + include utilities/bugtool/automake.mk diff --git a/utilities/ovn-appctl.8.xml b/utilities/ovn-appctl.8.xml new file mode 100644 index 000000000..32a42a766 --- /dev/null +++ b/utilities/ovn-appctl.8.xml @@ -0,0 +1,352 @@ + + +

Name

+

ovn-appctl -- utility for configuring running OVN daemons

+ +

Synopsis

+

+ ovn-appctl [--target=target | -t target] + [-T secs | --timeout=secs] command [arg...] +

+

ovn-appctl --help

+

ovn-appctl --version

+ +

Description

+

+ OVN daemons accept certain commands at runtime to control their behavior + and query their settings. Every daemon accepts a common set of commands + documented under COMMON COMMANDS below. Some daemons support additional + commands documented in their own manpages. +

+ +

+ The ovn-appctl program provides a simple way to invoke + these commands. The command to be sent is specified on + ovn-appctl's command line as non-option arguments. + ovn-appctl sends the command and prints the daemon's + response on standard output. +

+ +

+ ovn-ctl is exactly similar to Open vSwitch + ovs-appctl utility. +

+ +

Command Commands

+

+ Every OVN daemon supports a common set of commands, which are documented + in this section. +

+ +

General Commands

+

+ These commands display daemon-specific commands and the running version. + Note that these commands are different from the --help and --version + options that return information about the ovn-appctl + utility itself. +

+ +
+
list-commands
+
+ Lists the commands supported by the target. +
+ +
version
+
+ Displays the version and compilation date of the target. +
+
+ +

Logging Commands

+

+ OVN has several log levels. The highest-severity log level is: +

+ +
+
off
+
+ No message is ever logged at this level, so setting a logging + destination's log level to off disables logging to that + destination. +
+
+ +

+ The following log levels, in order of descending severity, are + available: +

+ +
+
emer
+
+ A major failure forced a process to abort. +
+ +
err
+
+ A high-level operation or a subsystem failed. Attention is warranted. +
+ +
warn
+
+ A low-level operation failed, but higher-level subsystems may be able + to recover. +
+ +
info
+
+ Information that may be useful in retrospect when investigating a + problem. +
+ +
dbg
+
+ Information useful only to someone with intricate knowledge of the + system, or that would commonly cause too-voluminous log output. + Log messages at this level are not logged by default. +
+
+ +

+ Every OVN daemon supports the following commands for examining and + adjusting log levels. +

+ +
+
vlog/list
+
+ Lists the known logging modules and their current levels. +
+ +
vlog/list-pattern
+
+ Lists logging pattern used for each destination. +
+ +
vlog/set [spec]
+
+ Sets logging levels. Without any spec, sets the log level for every + module and destination to dbg. Otherwise, spec is a list of words + separated by spaces or commas or colons, up to one from each + category below: +
    +
  • + A valid module name, as displayed by the vlog/list command on + ovn-appctl(8), limits the log level change to the specified module. +
  • + +
  • +

    + syslog, console, or file, + to limit the log level change to only to the system log, to the + console, or to a file, respectively. +

    + +

    + On Windows platform, syslog is accepted as a word + and is only useful if the target was started with the + --syslog-target option (the word has no effect + otherwise). +

    +
  • + +
  • + off, emer, err, + warn, info, or dbg, to + control the log level. Messages of the given severity or higher + will be logged, and messages of lower severity will be filtered + out. off filters out all messages. +
  • +
+ +

+ Case is not significant within spec. +

+
+ +
+ vlog/set PATTERN:destination: + pattern +
+
+ Sets the log pattern for destination to pattern. + Each time a message is logged to destination, pattern determines the + message's formatting. Most characters in pattern are copied literally + to the log, but special escapes beginning with % are + expanded as follows: + +
    +
  • + %A : The name of the application logging the + message, e.g. ovn-controller. +
  • + +
  • + %B : The RFC5424 syslog PRI of the message. +
  • + +
  • + %c : The name of the module + (as shown by ovn-appctl --list) logging the message. +
  • + +
  • + %d : The current date and time in ISO 8601 format + (YYYY-MM-DD HH:MM:SS). +
  • + +
  • + %d{format} : The current date and time in + the specified format, which takes the same format as the template + argument to strftime(3). As an extension, any # characters in + format will be replaced by fractional seconds, e.g. use + %H:%M:%S.### for the time to the nearest millisecond. + Sub-second times are only approximate and currently decimal places + after the third will always be reported as zero. +
  • + +
  • + %D : The current UTC date and time in ISO 8601 format + (YYYY-MM-DD HH:MM:SS). +
  • + +
  • + %D{format} : The current UTC date and time + in the specified format, which takes the same format as the + template argument to strftime(3). Supports the same extension for + sub-second resolution as %d{...}. +
  • + +
  • + %E : The hostname of the node running the application. +
  • + +
  • + %m : The message being logged. +
  • + +
  • + %N : A serial number for this message within this run + of the program, as a decimal number. The first message a program + logs has serial number 1, the second one has serial number 2, + and so on. +
  • + +
  • + %n : A new-line. +
  • + +
  • + %p : The level at which the message is logged, e.g. + DBG. +
  • + +
  • + %P : The program's process ID (pid), as a decimal + number. +
  • + +
  • + %r : The number of milliseconds elapsed from the start + of the application to the time the message was logged. +
  • + +
  • + %t : The subprogram name, that is, an identifying name + for the process or thread that emitted the log message, such as + monitor for the process used for --monitor or main for the primary + process or thread in a program. +
  • + +
  • + %T : The subprogram name enclosed in parentheses, e.g. + (monitor), or the empty string for the primary process or thread in + a program. +
  • + +
  • + %% : A literal %. +
  • +
+ +

+ A few options may appear between the % and the format specifier + character, in this order: +

+ +
    +
  • + - : Left justify the escape's expansion within its field + width. Right justification is the default. +
  • + +
  • + - : Pad the field to the field width with 0s. Padding + with spaces is the default. +
  • +
+ +

+ width A number specifies the minimum field width. If the + escape expands to fewer characters than width then it is padded to + fill the field width. (A field wider than width is not truncated to + fit.) +

+ +

+ The default pattern for console and file output is + %D{%Y-%m-%dT %H:%M:%SZ}|%05N|%c|%p|%m; for syslog + output, %05N|%c|%p|%m. +

+
+ +
vlog/set FACILITY:facility
+
+ Sets the RFC5424 facility of the log message. facility can be one of + kern, user, mail, + daemon, auth, syslog, + lpr, news, uucp, + clock, ftp, ntp, + audit, alert, clock2, + local0, local1, local2, + local3, local4, local5, + local6 or local7. +
+ +
vlog/close
+
+ Causes the daemon to close its log file, if it is open. + (Use vlog/reopen to reopen it later.) +
+ +
vlog/reopen
+
+

+ Causes the daemon to close its log file, if it is open, and then + reopen it. (This is useful after rotating log files, to cause a + new log file to be used.) +

+ +

+ This has no effect if the target application was not invoked + with the --log-file option. +

+
+
+ +

Options

+
+
-h
+
--help
+
+ Prints a brief help message to the console. +
+ +
-V
+
--version
+
+ Prints version information to the console. +
+
+
\ No newline at end of file diff --git a/utilities/ovn-appctl.c b/utilities/ovn-appctl.c new file mode 100644 index 000000000..ffd30b452 --- /dev/null +++ b/utilities/ovn-appctl.c @@ -0,0 +1,239 @@ +/* + * Copyright (c) 2019 Nicira, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +#include +#include +#include +#include +#include + +#include "command-line.h" +#include "daemon.h" +#include "lib/ovn-dirs.h" +#include "openvswitch/dynamic-string.h" +#include "jsonrpc.h" +#include "process.h" +#include "timeval.h" +#include "unixctl.h" +#include "util.h" +#include "openvswitch/vlog.h" + +static void usage(void); +static const char *parse_command_line(int argc, char *argv[]); +static struct jsonrpc *connect_to_target(const char *target); + +int +main(int argc, char *argv[]) +{ + char *cmd_result, *cmd_error; + struct jsonrpc *client; + char *cmd, **cmd_argv; + const char *target; + int cmd_argc; + int error; + + set_program_name(argv[0]); + + /* Parse command line and connect to target. */ + target = parse_command_line(argc, argv); + client = connect_to_target(target); + + /* Transact request and process reply. */ + cmd = argv[optind++]; + cmd_argc = argc - optind; + cmd_argv = cmd_argc ? argv + optind : NULL; + error = unixctl_client_transact(client, cmd, cmd_argc, cmd_argv, + &cmd_result, &cmd_error); + if (error) { + ovs_fatal(error, "%s: transaction error", target); + } + + if (cmd_error) { + jsonrpc_close(client); + fputs(cmd_error, stderr); + ovs_error(0, "%s: server returned an error", target); + exit(2); + } else if (cmd_result) { + fputs(cmd_result, stdout); + } else { + OVS_NOT_REACHED(); + } + + jsonrpc_close(client); + free(cmd_result); + free(cmd_error); + return 0; +} + +static void +usage(void) +{ + printf("\ +%s, for querying and controlling OVN daemon\n\ +usage: %s [TARGET] COMMAND [ARG...]\n\ +Targets:\n\ + -t, --target=TARGET pidfile or socket to contact\n\ +Common commands:\n\ + list-commands List commands supported by the target\n\ + version Print version of the target\n\ + vlog/list List current logging levels\n\ + vlog/list-pattern List logging patterns for each destination.\n\ + vlog/set [SPEC]\n\ + Set log levels as detailed in SPEC, which may include:\n\ + A valid module name (all modules, by default)\n\ + 'syslog', 'console', 'file' (all destinations, by default))\n\ + 'off', 'emer', 'err', 'warn', 'info', or 'dbg' ('dbg', bydefault)\n\ + vlog/reopen Make the program reopen its log file\n\ +Other options:\n\ + --timeout=SECS wait at most SECS seconds for a response\n\ + -h, --help Print this helpful information\n\ + -V, --version Display ovn-appctl version information\n", + program_name, program_name); + exit(EXIT_SUCCESS); +} + +static const char * +parse_command_line(int argc, char *argv[]) +{ + enum { + OPT_START = UCHAR_MAX + 1, + VLOG_OPTION_ENUMS + }; + static const struct option long_options[] = { + {"target", required_argument, NULL, 't'}, + {"execute", no_argument, NULL, 'e'}, + {"help", no_argument, NULL, 'h'}, + {"option", no_argument, NULL, 'o'}, + {"version", no_argument, NULL, 'V'}, + {"timeout", required_argument, NULL, 'T'}, + VLOG_LONG_OPTIONS, + {NULL, 0, NULL, 0}, + }; + char *short_options_ = + ovs_cmdl_long_options_to_short_options(long_options); + char *short_options = xasprintf("+%s", short_options_); + const char *target; + int e_options; + unsigned int timeout = 0; + + target = NULL; + e_options = 0; + for (;;) { + int option; + + option = getopt_long(argc, argv, short_options, long_options, NULL); + if (option == -1) { + break; + } + switch (option) { + case 't': + if (target) { + ovs_fatal(0, "-t or --target may be specified only once"); + } + target = optarg; + break; + + case 'e': + /* We ignore -e for compatibility. Older versions specified the + * command as the argument to -e. Since the current version takes + * the command as non-option arguments and we say that -e has no + * arguments, this just works in the common case. */ + if (e_options++) { + ovs_fatal(0, "-e or --execute may be speciifed only once"); + } + break; + + case 'h': + usage(); + break; + + case 'o': + ovs_cmdl_print_options(long_options); + exit(EXIT_SUCCESS); + + case 'T': + if (!str_to_uint(optarg, 10, &timeout) || !timeout) { + ovs_fatal(0, "value %s on -T or --timeout is invalid", optarg); + } + break; + + case 'V': + ovs_print_version(0, 0); + exit(EXIT_SUCCESS); + + VLOG_OPTION_HANDLERS + + case '?': + exit(EXIT_FAILURE); + + default: + OVS_NOT_REACHED(); + } + } + free(short_options_); + free(short_options); + + ctl_timeout_setup(timeout); + + if (optind >= argc) { + ovs_fatal(0, "at least one non-option argument is required " + "(use --help for help)"); + } + + return target ? target : "ovn-controller"; +} + +static struct jsonrpc * +connect_to_target(const char *target) +{ + struct jsonrpc *client; + char *socket_name; + int error; + +#ifndef _WIN32 + if (target[0] != '/') { + char *pidfile_name; + pid_t pid; + + pidfile_name = xasprintf("%s/%s.pid", ovn_rundir(), target); + pid = read_pidfile(pidfile_name); + if (pid < 0) { + ovs_fatal(-pid, "cannot read pidfile \"%s\"", pidfile_name); + } + free(pidfile_name); + socket_name = xasprintf("%s/%s.%ld.ctl", + ovn_rundir(), target, (long int) pid); +#else + /* On windows, if the 'target' contains ':', we make an assumption that + * it is an absolute path. */ + if (!strchr(target, ':')) { + socket_name = xasprintf("%s/%s.ctl", ovn_rundir(), target); +#endif + } else { + socket_name = xstrdup(target); + } + + error = unixctl_client_create(socket_name, &client); + if (error) { + ovs_fatal(error, "cannot connect to \"%s\"", socket_name); + } + free(socket_name); + + return client; +} + diff --git a/utilities/ovn-ctl b/utilities/ovn-ctl index c955aa177..4242cd2c8 100755 --- a/utilities/ovn-ctl +++ b/utilities/ovn-ctl @@ -44,13 +44,13 @@ pidfile_is_running () { stop_nb_ovsdb() { if pidfile_is_running $DB_NB_PID; then - ovs-appctl -t $OVN_RUNDIR/ovnnb_db.ctl exit + ovn-appctl -t $OVN_RUNDIR/ovnnb_db.ctl exit fi } stop_sb_ovsdb() { if pidfile_is_running $DB_SB_PID; then - ovs-appctl -t $OVN_RUNDIR/ovnsb_db.ctl exit + ovn-appctl -t $OVN_RUNDIR/ovnsb_db.ctl exit fi } @@ -65,8 +65,8 @@ demote_ovnnb() { fi if test -e $ovnnb_active_conf_file; then - ovs-appctl -t $OVN_RUNDIR/ovnnb_db.ctl ovsdb-server/set-active-ovsdb-server `cat $ovnnb_active_conf_file` - ovs-appctl -t $OVN_RUNDIR/ovnnb_db.ctl ovsdb-server/connect-active-ovsdb-server + ovn-appctl -t $OVN_RUNDIR/ovnnb_db.ctl ovsdb-server/set-active-ovsdb-server `cat $ovnnb_active_conf_file` + ovn-appctl -t $OVN_RUNDIR/ovnnb_db.ctl ovsdb-server/connect-active-ovsdb-server else echo >&2 "$0: active server details not set" exit 1 @@ -79,8 +79,8 @@ demote_ovnsb() { fi if test -e $ovnsb_active_conf_file; then - ovs-appctl -t $OVN_RUNDIR/ovnsb_db.ctl ovsdb-server/set-active-ovsdb-server `cat $ovnsb_active_conf_file` - ovs-appctl -t $OVN_RUNDIR/ovnsb_db.ctl ovsdb-server/connect-active-ovsdb-server + ovn-appctl -t $OVN_RUNDIR/ovnsb_db.ctl ovsdb-server/set-active-ovsdb-server `cat $ovnsb_active_conf_file` + ovn-appctl -t $OVN_RUNDIR/ovnsb_db.ctl ovsdb-server/connect-active-ovsdb-server else echo >&2 "$0: active server details not set" exit 1 @@ -89,12 +89,12 @@ demote_ovnsb() { promote_ovnnb() { rm -f $ovnnb_active_conf_file - ovs-appctl -t $OVN_RUNDIR/ovnnb_db.ctl ovsdb-server/disconnect-active-ovsdb-server + ovn-appctl -t $OVN_RUNDIR/ovnnb_db.ctl ovsdb-server/disconnect-active-ovsdb-server } promote_ovnsb() { rm -f $ovnsb_active_conf_file - ovs-appctl -t $OVN_RUNDIR/ovnsb_db.ctl ovsdb-server/disconnect-active-ovsdb-server + ovn-appctl -t $OVN_RUNDIR/ovnsb_db.ctl ovsdb-server/disconnect-active-ovsdb-server } start_ovsdb__() { @@ -274,7 +274,7 @@ start_ovsdb () { } sync_status() { - ovs-appctl -t $OVN_RUNDIR/ovn${1}_db.ctl ovsdb-server/sync-status | awk '{if(NR==1) print $2}' + ovn-appctl -t $OVN_RUNDIR/ovn${1}_db.ctl ovsdb-server/sync-status | awk '{if(NR==1) print $2}' } status_ovnnb() { From patchwork Tue Sep 10 07:43:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Numan Siddique X-Patchwork-Id: 1160052 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=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com 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 46SH915nY4z9s7T for ; Tue, 10 Sep 2019 17:44:05 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 8CE6BE31; Tue, 10 Sep 2019 07:43:44 +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 D7DF0E2A for ; Tue, 10 Sep 2019 07:43:42 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 9D7E48A8 for ; Tue, 10 Sep 2019 07:43:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3133418CCF05 for ; Tue, 10 Sep 2019 07:43:41 +0000 (UTC) Received: from nummac.local (ovpn-116-211.sin2.redhat.com [10.67.116.211]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4E95D413B; Tue, 10 Sep 2019 07:43:38 +0000 (UTC) From: nusiddiq@redhat.com To: dev@openvswitch.org Date: Tue, 10 Sep 2019 13:13:23 +0530 Message-Id: <20190910074323.23271-1-nusiddiq@redhat.com> In-Reply-To: <20190910074257.23151-1-nusiddiq@redhat.com> References: <20190910074257.23151-1-nusiddiq@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.63]); Tue, 10 Sep 2019 07:43:41 +0000 (UTC) X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 ovn v2 2/2] Generate documentation and manpages for ovn-archicture and ovn-nb/ovn-sb 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: , Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org From: Numan Siddique This was missing when OVN was split from OVS. Signed-off-by: Numan Siddique --- Makefile.am | 17 +-------- TODO_SPLIT.rst | 6 --- automake.mk | 84 +++++++++++++++++++++++++++++++++++++++++ ovn-nb.xml | 2 +- rhel/ovn-fedora.spec.in | 6 +-- 5 files changed, 89 insertions(+), 26 deletions(-) create mode 100644 automake.mk diff --git a/Makefile.am b/Makefile.am index f3df733a1..97dc309e3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -488,22 +488,7 @@ dist-docs: .PHONY: dist-docs -# Version checking for ovn-nb.ovsschema. -ALL_LOCAL += ovn-nb.ovsschema.stamp -ovn-nb.ovsschema.stamp: ovn-nb.ovsschema - $(srcdir)/build-aux/cksum-schema-check $? $@ -CLEANFILES += ovn-nb.ovsschema.stamp - -# Version checking for ovn-sb.ovsschema. -ALL_LOCAL += ovn-sb.ovsschema.stamp -ovn-sb.ovsschema.stamp: ovn-sb.ovsschema - $(srcdir)/build-aux/cksum-schema-check $? $@ - -pkgdata_DATA += ovn-nb.ovsschema -pkgdata_DATA += ovn-sb.ovsschema - -CLEANFILES += ovn-sb.ovsschema.stamp - +include automake.mk include Documentation/automake.mk include m4/automake.mk include lib/automake.mk diff --git a/TODO_SPLIT.rst b/TODO_SPLIT.rst index bb8657eb1..933534084 100644 --- a/TODO_SPLIT.rst +++ b/TODO_SPLIT.rst @@ -35,12 +35,6 @@ Immediate tasks * Someone with a decent ability to write should give the README.rst file some polish (or even just rewrite it. I won't be offended). -* After the split, the below things are missing during compilation - - OVN northbound/southbound E-R diagram - - OVN northbound/southbound schema documentation - - ovn-architecture manpage generation. - This needs to be fixed. - * Cleanup the acinclude.m4 and m4 folder Immediate to Short-term tasks diff --git a/automake.mk b/automake.mk new file mode 100644 index 000000000..ad801f1e5 --- /dev/null +++ b/automake.mk @@ -0,0 +1,84 @@ +man_MANS += ovn-architecture.7 +EXTRA_DIST += ovn-architecture.7.xml +CLEANFILES += ovn-architecture.7 + +# OVN northbound E-R diagram +# +# If "python" or "dot" is not available, then we do not add graphical diagram +# to the documentation. +if HAVE_PYTHON +if HAVE_DOT +OVSDB_DOT = $(run_python) ${OVSDIR}/ovsdb/ovsdb-dot.in +ovn-nb.gv: ${OVSDIR}/ovsdb/ovsdb-dot.in $(srcdir)/ovn-nb.ovsschema + $(AM_V_GEN)$(OVSDB_DOT) --no-arrows $(srcdir)/ovn-nb.ovsschema > $@ +ovn-nb.pic: ovn-nb.gv ${OVSDIR}/ovsdb/dot2pic + $(AM_V_GEN)(dot -T plain < ovn-nb.gv | $(PYTHON) ${OVSDIR}/ovsdb/dot2pic -f 3) > $@.tmp && \ + mv $@.tmp $@ +OVN_NB_PIC = ovn-nb.pic +OVN_NB_DOT_DIAGRAM_ARG = --er-diagram=$(OVN_NB_PIC) +CLEANFILES += ovn-nb.gv ovn-nb.pic +endif +endif + +# OVN northbound schema documentation +EXTRA_DIST += ovn-nb.xml +CLEANFILES += ovn-nb.5 +man_MANS += ovn-nb.5 + +OVSDB_DOC = $(run_python) ${OVSDIR}/ovsdb/ovsdb-doc +ovn-nb.5: \ + ${OVSDIR}/ovsdb/ovsdb-doc $(srcdir)/ovn-nb.xml $(srcdir)/ovn-nb.ovsschema $(OVN_NB_PIC) + $(AM_V_GEN)$(OVSDB_DOC) \ + $(OVN_NB_DOT_DIAGRAM_ARG) \ + --version=$(VERSION) \ + $(srcdir)/ovn-nb.ovsschema \ + $(srcdir)/ovn-nb.xml > $@.tmp && \ + mv $@.tmp $@ + +# OVN southbound E-R diagram +# +# If "python" or "dot" is not available, then we do not add graphical diagram +# to the documentation. +if HAVE_PYTHON +if HAVE_DOT +ovn-sb.gv: ${OVSDIR}/ovsdb/ovsdb-dot.in $(srcdir)/ovn-sb.ovsschema + $(AM_V_GEN)$(OVSDB_DOT) --no-arrows $(srcdir)/ovn-sb.ovsschema > $@ +ovn-sb.pic: ovn-sb.gv ${OVSDIR}/ovsdb/dot2pic + $(AM_V_GEN)(dot -T plain < ovn-sb.gv | $(PYTHON) ${OVSDIR}/ovsdb/dot2pic -f 3) > $@.tmp && \ + mv $@.tmp $@ +OVN_SB_PIC = ovn-sb.pic +OVN_SB_DOT_DIAGRAM_ARG = --er-diagram=$(OVN_SB_PIC) +CLEANFILES += ovn-sb.gv ovn-sb.pic +endif +endif + +# OVN southbound schema documentation +EXTRA_DIST += ovn-sb.xml +CLEANFILES += ovn-sb.5 +man_MANS += ovn-sb.5 + +ovn-sb.5: \ + ${OVSDIR}/ovsdb/ovsdb-doc $(srcdir)/ovn-sb.xml $(srcdir)/ovn-sb.ovsschema $(OVN_SB_PIC) + $(AM_V_GEN)$(OVSDB_DOC) \ + $(OVN_SB_DOT_DIAGRAM_ARG) \ + --version=$(VERSION) \ + $(srcdir)/ovn-sb.ovsschema \ + $(srcdir)/ovn-sb.xml > $@.tmp && \ + mv $@.tmp $@ + + +# Version checking for ovn-nb.ovsschema. +ALL_LOCAL += ovn-nb.ovsschema.stamp +ovn-nb.ovsschema.stamp: ovn-nb.ovsschema + $(srcdir)/build-aux/cksum-schema-check $? $@ +CLEANFILES += ovn-nb.ovsschema.stamp + +# Version checking for ovn-sb.ovsschema. +ALL_LOCAL += ovn-sb.ovsschema.stamp +ovn-sb.ovsschema.stamp: ovn-sb.ovsschema + $(srcdir)/build-aux/cksum-schema-check $? $@ + +pkgdata_DATA += ovn-nb.ovsschema +pkgdata_DATA += ovn-sb.ovsschema + +CLEANFILES += ovn-sb.ovsschema.stamp diff --git a/ovn-nb.xml b/ovn-nb.xml index 442e5cb60..b41b57906 100644 --- a/ovn-nb.xml +++ b/ovn-nb.xml @@ -1535,7 +1535,7 @@ address.

- +

Enables/disables IP multicast relay between logical switches connected to the logical router. Default: False. diff --git a/rhel/ovn-fedora.spec.in b/rhel/ovn-fedora.spec.in index 9ee807fab..447b4fe6e 100644 --- a/rhel/ovn-fedora.spec.in +++ b/rhel/ovn-fedora.spec.in @@ -442,10 +442,10 @@ fi %{_mandir}/man8/ovn-trace.8* %{_mandir}/man1/ovn-detrace.1* %{_mandir}/man8/ovn-appctl.8* -#%{_mandir}/man7/ovn-architecture.7* - Uncomment this once the manpage is fixed +%{_mandir}/man7/ovn-architecture.7* %{_mandir}/man8/ovn-sbctl.8* -#%{_mandir}/man5/ovn-nb.5* - Uncomment this once the manpage is fixed -#%{_mandir}/man5/ovn-sb.5* - Uncomment this once the manpage is fixed +%{_mandir}/man5/ovn-nb.5* +%{_mandir}/man5/ovn-sb.5* %{_prefix}/lib/ocf/resource.d/ovn/ovndb-servers %config(noreplace) %{_sysconfdir}/logrotate.d/ovn