From: Ben Pfaff Date: Fri, 15 May 2009 19:40:05 +0000 (-0700) Subject: Rename vlogconf to ovs-appctl, for consistency and as a better name. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eb8cacd9a964059d47d66c580dab2de479d7d022;p=openvswitch Rename vlogconf to ovs-appctl, for consistency and as a better name. The vlogconf program at one time only affected log levels. Now, it can do more, and probably will be expanded in the future, so appctl is a better name. --- diff --git a/INSTALL b/INSTALL index 888ab016..dbab025f 100644 --- a/INSTALL +++ b/INSTALL @@ -152,10 +152,10 @@ distribution in the ordinary way using "configure" and "make". - Datapath administration utility: utilities/dpctl. - - Runtime logging configuration utility: utilities/vlogconf. - Some less important binaries will be built also: + - Runtime configuration utility: utilities/ovs-appctl. + - Simple OpenFlow controller: utilities/ovs-controller. - Secure channel executable: secchan/secchan. diff --git a/README b/README index 7b5cc9cd..e4a7c714 100644 --- a/README +++ b/README @@ -39,8 +39,8 @@ This distribution includes some additional software as well: - ovs-controller, a simple OpenFlow switch - - vlogconf, a utility that can adjust the logging levels of a - running secchan, ovs-controller, or vswitchd. + - vlog-appctl, a utility that can control OpenVSwitch daemons, + adjusting their logging levels among other uses. - ovs-pki, a utility for creating and managing the public-key infrastructure for OpenFlow switches. diff --git a/debian/openvswitch-common.install b/debian/openvswitch-common.install index 6dd50e37..1967ccc1 100644 --- a/debian/openvswitch-common.install +++ b/debian/openvswitch-common.install @@ -1,3 +1,3 @@ +_debian/utilities/ovs-appctl usr/sbin _debian/utilities/ovs-parse-leaks usr/bin _debian/utilities/ovs-pki usr/sbin -_debian/utilities/vlogconf usr/sbin diff --git a/debian/openvswitch-common.manpages b/debian/openvswitch-common.manpages index 4994a1e3..99c48bd0 100644 --- a/debian/openvswitch-common.manpages +++ b/debian/openvswitch-common.manpages @@ -1,2 +1,2 @@ -_debian/utilities/vlogconf.8 +_debian/utilities/ovs-appctl.8 _debian/utilities/ovs-pki.8 diff --git a/debian/openvswitch-switch.logrotate b/debian/openvswitch-switch.logrotate index 5c253088..41394e86 100644 --- a/debian/openvswitch-switch.logrotate +++ b/debian/openvswitch-switch.logrotate @@ -6,6 +6,6 @@ missingok rotate 30 postrotate - vlogconf --target /var/run/secchan.pid --reopen + ovs-appctl --target /var/run/secchan.pid --reopen endscript } diff --git a/lib/unixctl.c b/lib/unixctl.c index 269d5493..4c7f15dc 100644 --- a/lib/unixctl.c +++ b/lib/unixctl.c @@ -184,8 +184,8 @@ unixctl_command_reply(struct unixctl_conn *conn, * * A program that (optionally) daemonizes itself should call this function * *after* daemonization, so that the socket name contains the pid of the - * daemon instead of the pid of the program that exited. (Otherwise, "vlogconf - * --target .pid" will fail.) + * daemon instead of the pid of the program that exited. (Otherwise, + * "ovs-appctl --target .pid" will fail.) * * Returns 0 if successful, otherwise a positive errno value. If successful, * sets '*serverp' to the new unixctl_server, otherwise to NULL. */ diff --git a/lib/vlog.man b/lib/vlog.man index 0e439f86..0bd8a26e 100644 --- a/lib/vlog.man +++ b/lib/vlog.man @@ -7,7 +7,7 @@ Sets the logging level for \fImodule\fR in \fIfacility\fR to .RS .IP \(bu \fImodule\fR may be any valid module name (as displayed by the -\fB--list\fR action on \fBvlogconf\fR(8)), or the special name +\fB--list\fR action on \fBovs-appctl\fR(8)), or the special name \fBANY\fR to set the logging levels for all modules. .IP \(bu @@ -35,7 +35,7 @@ Sets the maximum logging verbosity level, equivalent to .TP \fB-vPATTERN:\fIfacility\fB:\fIpattern\fR, \fB--verbose=PATTERN:\fIfacility\fB:\fIpattern\fR Sets the log pattern for \fIfacility\fR to \fIpattern\fR. Refer to -\fBvlogconf\fR(8) for a description of the valid syntax for \fIpattern\fR. +\fBovs-appctl\fR(8) for a description of the valid syntax for \fIpattern\fR. .TP \fB--log-file\fR[\fB=\fIfile\fR] diff --git a/secchan/main.c b/secchan/main.c index b9ba4d44..1b5d5cca 100644 --- a/secchan/main.c +++ b/secchan/main.c @@ -146,7 +146,7 @@ main(int argc, char *argv[]) die_if_already_running(); daemonize(); - /* Start listening for vlogconf requests. */ + /* Start listening for ovs-appctl requests. */ error = unixctl_server_create(NULL, &unixctl); if (error) { ovs_fatal(error, "Could not listen for unixctl connections"); diff --git a/secchan/secchan.8.in b/secchan/secchan.8.in index 6bf2c66b..e456c530 100644 --- a/secchan/secchan.8.in +++ b/secchan/secchan.8.in @@ -455,8 +455,8 @@ require the controller to send the CA certificate, but .SH "SEE ALSO" .BR dpctl (8), +.BR ovs\-appctl (8), .BR ovs-discover (8), .BR ovs\-controller (8), .BR ovs-pki (8), -.BR vlogconf (8), .BR vswitchd.conf (5) diff --git a/utilities/.gitignore b/utilities/.gitignore index 5f54285a..7cfc5c49 100644 --- a/utilities/.gitignore +++ b/utilities/.gitignore @@ -3,6 +3,8 @@ /dpctl /dpctl.8 /nlmon +/ovs-appctl +/ovs-appctl.8 /ovs-cfg-mod /ovs-cfg-mod.8 /ovs-controller @@ -15,6 +17,4 @@ /ovs-pki /ovs-pki-cgi /ovs-pki.8 -/vlogconf -/vlogconf.8 /ovs-wdt diff --git a/utilities/automake.mk b/utilities/automake.mk index c23a4f8a..35c303c3 100644 --- a/utilities/automake.mk +++ b/utilities/automake.mk @@ -1,6 +1,6 @@ bin_PROGRAMS += \ - utilities/vlogconf \ utilities/dpctl \ + utilities/ovs-appctl \ utilities/ovs-cfg-mod \ utilities/ovs-controller \ utilities/ovs-discover \ @@ -13,6 +13,7 @@ dist_sbin_SCRIPTS += utilities/ovs-monitor EXTRA_DIST += \ utilities/dpctl.8.in \ + utilities/ovs-appctl.8.in \ utilities/ovs-cfg-mod.8.in \ utilities/ovs-controller.8.in \ utilities/ovs-discover.8.in \ @@ -20,10 +21,10 @@ EXTRA_DIST += \ utilities/ovs-parse-leaks.in \ utilities/ovs-pki-cgi.in \ utilities/ovs-pki.8.in \ - utilities/ovs-pki.in \ - utilities/vlogconf.8.in + utilities/ovs-pki.in DISTCLEANFILES += \ utilities/dpctl.8 \ + utilities/ovs-appctl.8 \ utilities/ovs-cfg-mod.8 \ utilities/ovs-controller.8 \ utilities/ovs-discover.8 \ @@ -31,23 +32,22 @@ DISTCLEANFILES += \ utilities/ovs-parse-leaks \ utilities/ovs-pki \ utilities/ovs-pki.8 \ - utilities/ovs-pki-cgi \ - utilities/vlogconf.8 + utilities/ovs-pki-cgi man_MANS += \ utilities/dpctl.8 \ + utilities/ovs-appctl.8 \ utilities/ovs-cfg-mod.8 \ utilities/ovs-controller.8 \ utilities/ovs-discover.8 \ utilities/ovs-kill.8 \ - utilities/ovs-pki.8 \ - utilities/vlogconf.8 + utilities/ovs-pki.8 utilities_dpctl_SOURCES = utilities/dpctl.c utilities_dpctl_LDADD = lib/libopenvswitch.a $(FAULT_LIBS) $(SSL_LIBS) -utilities_vlogconf_SOURCES = utilities/vlogconf.c -utilities_vlogconf_LDADD = lib/libopenvswitch.a +utilities_ovs_appctl_SOURCES = utilities/ovs-appctl.c +utilities_ovs_appctl_LDADD = lib/libopenvswitch.a utilities_ovs_cfg_mod_SOURCES = utilities/ovs-cfg-mod.c utilities_ovs_cfg_mod_LDADD = lib/libopenvswitch.a diff --git a/utilities/dpctl.8.in b/utilities/dpctl.8.in index a8828317..c88d3d3b 100644 --- a/utilities/dpctl.8.in +++ b/utilities/dpctl.8.in @@ -641,5 +641,5 @@ Prints the flow entries in the switch. .BR vswitchd (8), .BR secchan (8), -.BR ovs\-controller (8), -.BR vlogconf (8) +.BR ovs\-appctl (8), +.BR ovs\-controller (8) diff --git a/utilities/ovs-appctl.8.in b/utilities/ovs-appctl.8.in new file mode 100644 index 00000000..5204a800 --- /dev/null +++ b/utilities/ovs-appctl.8.in @@ -0,0 +1,166 @@ +.\" -*- nroff -*- +.de IQ +. br +. ns +. IP "\\$1" +.. +.TH ovs\-appctl 8 "April 2009" "OpenVSwitch" "OpenVSwitch Manual" +.ds PN ovs\-appctl + +.SH NAME +ovs\-appctl \- utility for configuring running OpenVSwitch daemons + +.SH SYNOPSIS +\fBovs\-appctl\fR [\fB-h\fR | \fB--help\fR] [\fItarget\fR...] [\fIaction\fR...] +.sp 1 +The available \fItarget\fR options are: +.br +[\fB-t\fR \fIpid\fR | \fB--target=\fIpid\fR] +.sp 1 +The available \fIaction\fR options are: +.br +[\fB-l\fR | \fB--list\fR] [\fB-s\fR +\fImodule\fR[\fB:\fIfacility\fR[\fB:\fIlevel\fR]] | +\fB--set=\fImodule\fR[\fB:\fIfacility\fR[\fB:\fIlevel\fR]]] +[\fB-r\fR | \fB--reopen\fR] +[\fB-e\fR | \fB--execute=\fIcommand\fR] + +.SH DESCRIPTION +The \fBovs\-appctl\fR program connects to one or more running +OpenVSwitch daemons (such as \fBvswitchd\fR(8)), as specified by the +user, and sends them commands to query or modify their behavior. +Its primary purpose is currently to adjust daemons' logging levels. + +\fBovs\-appctl\fR applies one or more actions to each of one or more +target processes. Targets may be specified using: + +.IP "\fB-t \fIsocket\fR" +.IQ "\fB--target=\fIsocket\fR" +The specified \fIsocket\fR must be the name of a Unix domain socket +for a \fBovs\-appctl\fR-controllable process. If \fIsocket\fR does not +begin with \fB/\fR, it is treated as relative to \fB@RUNDIR@\fR. + +Each OpenVSwitch daemon by default creates a socket named +\fB@RUNDIR@/\fIprogram\fB.\fIpid\fB.ctl\fR, where \fIprogram\fR is +the program's name (such as \fBvswitchd\fR) and \fIpid\fR is the +daemon's PID. + +.PP +The available actions are: + +.IP "\fB-l\fR" +.IQ "\fB--list\fR" +Print the list of known logging modules and their current levels to +stdout. + +.IP "\fB-s\fR \fImodule\fR[\fB:\fIfacility\fR[\fB:\fIlevel\fR]]" +.IQ "\fB--set=\fImodule\fR[\fB:\fIfacility\fR[\fB:\fIlevel\fR]]" + +Sets the logging level for \fImodule\fR in \fIfacility\fR to +\fIlevel\fR. The \fImodule\fR may be any valid module name (as +displayed by the \fB--list\fR option) or the special name \fBANY\fR to +set the logging levels for all modules. The \fIfacility\fR may be +\fBsyslog\fR or \fBconsole\fR to set the levels for logging to the +system log or to the console, respectively, or \fBANY\fR to set the +logging levels for both facilities. If it is omitted, +\fIfacility\fR defaults to \fBANY\fR. The \fIlevel\fR must be one of +\fBemer\fR, \fBerr\fR, \fBwarn\fR, \fBinfo\fR, or \fBdbg\fR, designating the +minimum severity of a message for it to be logged. If it is omitted, +\fIlevel\fR defaults to \fBdbg\fR. + +.IP "\fB-s PATTERN:\fIfacility\fB:\fIpattern\fR" +.IQ "\fB--set=PATTERN:\fIfacility\fB:\fIpattern\fR" + +Sets the log pattern for \fIfacility\fR to \fIpattern\fR. Each time a +message is logged to \fIfacility\fR, \fIpattern\fR determines the +message's formatting. Most characters in \fIpattern\fR are copied +literally to the log, but special escapes beginning with \fB%\fR are +expanded as follows: + +.RS +.IP \fB%A\fR +The name of the application logging the message, e.g. \fBsecchan\fR. + +.IP \fB%c\fR +The name of the module (as shown by \fBovs\-appctl --list\fR) logging +the message. + +.IP \fB%d\fR +The current date and time in ISO 8601 format (YYYY-MM-DD HH:MM:SS). + +.IP \fB%d{\fIformat\fB}\fR +The current date and time in the specified \fIformat\fR, which takes +the same format as the \fItemplate\fR argument to \fBstrftime\fR(3). + +.IP \fB%m\fR +The message being logged. + +.IP \fB%N\fR +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. + +.IP \fB%n\fR +A new-line. + +.IP \fB%p\fR +The level at which the message is logged, e.g. \fBDBG\fR. + +.IP \fB%P\fR +The program's process ID (pid), as a decimal number. + +.IP \fB%r\fR +The number of milliseconds elapsed from the start of the application +to the time the message was logged. + +.IP \fB%%\fR +A literal \fB%\fR. +.RE + +.IP +A few options may appear between the \fB%\fR and the format specifier +character, in this order: + +.RS +.IP \fB-\fR +Left justify the escape's expansion within its field width. Right +justification is the default. + +.IP \fB0\fR +Pad the field to the field width with \fB0\fRs. Padding with spaces +is the default. + +.IP \fIwidth\fR +A number specifies the minimum field width. If the escape expands to +fewer characters than \fIwidth\fR then it is padded to fill the field +width. (A field wider than \fIwidth\fR is not truncated to fit.) +.RE + +.IP +The default pattern for console output is \fB%d{%b %d +%H:%M:%S}|%05N|%c|%p|%m\fR; for syslog output, \fB%05N|%c|%p|%m\fR. + +.IP \fB-r\fR +.IQ \fB--reopen\fR +Causes the target application to close and reopen its log file. (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 +\fB--log-file\fR option. + +.IP "\fB-e \fIcommand\fR" +.IQ "\fB--execute=\fIcommand\fR" +Passes the specified \fIcommand\fR literally to the target application +and prints its response to stdout, if successful, or to stderr if an +error occurs. Use \fB-e help\fR to print a list of available commands. + +.SH OPTIONS + +.so lib/common.man + +.SH "SEE ALSO" + +.BR dpctl (8), +.BR secchan (8), +.BR ovs\-controller (8) diff --git a/utilities/ovs-appctl.c b/utilities/ovs-appctl.c new file mode 100644 index 00000000..d091dd08 --- /dev/null +++ b/utilities/ovs-appctl.c @@ -0,0 +1,231 @@ +/* Copyright (c) 2008, 2009 The Board of Trustees of The Leland Stanford + * Junior University + * + * We are making the OpenFlow specification and associated documentation + * (Software) available for public use and benefit with the expectation + * that others will use, modify and enhance the Software and contribute + * those enhancements back to the community. However, since we would + * like to make the Software available for broadest use, with as few + * restrictions as possible permission is hereby granted, free of + * charge, to any person obtaining a copy of this Software to deal in + * the Software under the copyrights without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * The name and trademarks of copyright holder(s) may NOT be used in + * advertising or publicity pertaining to the Software or any + * derivatives without specific, written prior permission. + */ +#include +#include "vlog.h" + +#include +#include +#include +#include +#include +#include +#include + +#include "command-line.h" +#include "compiler.h" +#include "timeval.h" +#include "unixctl.h" +#include "util.h" + +static void +usage(char *prog_name, int exit_code) +{ + printf("Usage: %s [TARGET] [ACTION...]\n" + "Targets:\n" + " -t, --target=TARGET Path to Unix domain socket\n" + "Actions:\n" + " -l, --list List current settings\n" + " -s, --set=MODULE[:FACILITY[:LEVEL]]\n" + " Set MODULE and FACILITY log level to LEVEL\n" + " MODULE may be any valid module name or 'ANY'\n" + " FACILITY may be 'syslog', 'console', 'file', or 'ANY' (default)\n" + " LEVEL may be 'emer', 'err', 'warn', 'info', or 'dbg' (default)\n" + " -r, --reopen Make the program reopen its log file\n" + " -e, --execute=COMMAND Execute control COMMAND and print its output\n" + " -h, --help Print this helpful information\n", + prog_name); + exit(exit_code); +} + +static char * +transact(struct unixctl_client *client, const char *request, bool *ok) +{ + int code; + char *reply; + int error = unixctl_client_transact(client, request, &code, &reply); + if (error) { + fprintf(stderr, "%s: transaction error: %s\n", + unixctl_client_target(client), strerror(error)); + *ok = false; + return xstrdup(""); + } else { + if (code / 100 != 2) { + fprintf(stderr, "%s: server returned reply code %03d\n", + unixctl_client_target(client), code); + } + return reply; + } +} + +static void +transact_ack(struct unixctl_client *client, const char *request, bool *ok) +{ + free(transact(client, request, ok)); +} + +static void +execute_command(struct unixctl_client *client, const char *request, bool *ok) +{ + int code; + char *reply; + int error = unixctl_client_transact(client, request, &code, &reply); + if (error) { + fprintf(stderr, "%s: transaction error: %s\n", + unixctl_client_target(client), strerror(error)); + *ok = false; + } else { + if (code / 100 != 2) { + fprintf(stderr, "%s: server returned reply code %03d\n", + unixctl_client_target(client), code); + fputs(reply, stderr); + *ok = false; + } else { + fputs(reply, stdout); + } + } +} + +static void +add_target(struct unixctl_client ***clients, size_t *n_clients, + const char *path, bool *ok) +{ + struct unixctl_client *client; + int error = unixctl_client_create(path, &client); + if (error) { + fprintf(stderr, "Error connecting to \"%s\": %s\n", + path, strerror(error)); + *ok = false; + } else { + *clients = xrealloc(*clients, sizeof *clients * (*n_clients + 1)); + (*clients)[*n_clients] = client; + ++*n_clients; + } +} + +int main(int argc, char *argv[]) +{ + static const struct option long_options[] = { + /* Target options must come first. */ + {"target", required_argument, NULL, 't'}, + {"help", no_argument, NULL, 'h'}, + + /* Action options come afterward. */ + {"list", no_argument, NULL, 'l'}, + {"set", required_argument, NULL, 's'}, + {"reopen", no_argument, NULL, 'r'}, + {"execute", required_argument, NULL, 'e'}, + {0, 0, 0, 0}, + }; + char *short_options; + + /* Determine targets. */ + bool ok = true; + int n_actions = 0; + struct unixctl_client **clients = NULL; + size_t n_clients = 0; + + set_program_name(argv[0]); + time_init(); + + short_options = long_options_to_short_options(long_options); + for (;;) { + int option; + size_t i; + + option = getopt_long(argc, argv, short_options, long_options, NULL); + if (option == -1) { + break; + } + if (!strchr("th", option) && n_clients == 0) { + ovs_fatal(0, "no targets specified (use --help for help)"); + } else { + ++n_actions; + } + switch (option) { + case 't': + add_target(&clients, &n_clients, optarg, &ok); + break; + + case 'l': + for (i = 0; i < n_clients; i++) { + struct unixctl_client *client = clients[i]; + char *reply; + + printf("%s:\n", unixctl_client_target(client)); + reply = transact(client, "vlog/list", &ok); + fputs(reply, stdout); + free(reply); + } + break; + + case 's': + for (i = 0; i < n_clients; i++) { + struct unixctl_client *client = clients[i]; + char *request = xasprintf("vlog/set %s", optarg); + transact_ack(client, request, &ok); + free(request); + } + break; + + case 'r': + for (i = 0; i < n_clients; i++) { + struct unixctl_client *client = clients[i]; + char *request = xstrdup("vlog/reopen"); + transact_ack(client, request, &ok); + free(request); + } + break; + + case 'e': + for (i = 0; i < n_clients; i++) { + execute_command(clients[i], optarg, &ok); + } + break; + + case 'h': + usage(argv[0], EXIT_SUCCESS); + break; + + case '?': + exit(EXIT_FAILURE); + + default: + NOT_REACHED(); + } + } + if (!n_actions) { + fprintf(stderr, + "warning: no actions specified (use --help for help)\n"); + } + exit(ok ? 0 : 1); +} diff --git a/utilities/ovs-controller.8.in b/utilities/ovs-controller.8.in index ca8bff1b..0f8e775f 100644 --- a/utilities/ovs-controller.8.in +++ b/utilities/ovs-controller.8.in @@ -129,4 +129,4 @@ To bind locally to port 6633 (the default) and wait for incoming connections fro .BR dpctl (8), .BR secchan (8), -.BR vlogconf (8) +.BR ovs\-appctl (8) diff --git a/utilities/vlogconf.8.in b/utilities/vlogconf.8.in deleted file mode 100644 index 279e778c..00000000 --- a/utilities/vlogconf.8.in +++ /dev/null @@ -1,157 +0,0 @@ -.\" -*- nroff -*- -.de IQ -. br -. ns -. IP "\\$1" -.. -.TH vlogconf 8 "April 2009" "OpenVSwitch" "OpenVSwitch Manual" -.ds PN vlogconf - -.SH NAME -vlogconf \- configuration utility for OpenVSwitch logging in userspace - -.SH SYNOPSIS -\fBvlogconf\fR [\fB-h\fR | \fB--help\fR] [\fItarget\fR...] [\fIaction\fR...] -.sp 1 -The available \fItarget\fR options are: -.br -[\fB-t\fR \fIpid\fR | \fB--target=\fIpid\fR] -.sp 1 -The available \fIaction\fR options are: -.br -[\fB-l\fR | \fB--list\fR] [\fB-s\fR -\fImodule\fR[\fB:\fIfacility\fR[\fB:\fIlevel\fR]] | -\fB--set=\fImodule\fR[\fB:\fIfacility\fR[\fB:\fIlevel\fR]]] -[\fB-r\fR | \fB--reopen\fR] -[\fB-e\fR | \fB--execute=\fIcommand\fR] - -.SH DESCRIPTION -The \fBvlogconf\fR program configures the logging system used by -OpenVSwitch userspace programs. The logging configuration may be modified -while OpenVSwitch programs are running. - -\fBvlogconf\fR applies one or more actions to each of one or more -target processes. Targets may be specified using: - -.IP "\fB-t \fIsocket\fR" -.IQ "\fB--target=\fIsocket\fR" -The specified \fIsocket\fR must be the name of a Unix domain socket -for a \fBvlogconf\fR-controllable process. If \fIsocket\fR does not -begin with \fB/\fR, it is treated as relative to \fB@RUNDIR@\fR. - -.PP -The available actions are: - -.IP "\fB-l\fR" -.IQ "\fB--list\fR" -Print the list of known modules and their current logging levels to -stdout. - -.IP "\fB-s\fR \fImodule\fR[\fB:\fIfacility\fR[\fB:\fIlevel\fR]]" -.IQ "\fB--set=\fImodule\fR[\fB:\fIfacility\fR[\fB:\fIlevel\fR]]" - -Sets the logging level for \fImodule\fR in \fIfacility\fR to -\fIlevel\fR. The \fImodule\fR may be any valid module name (as -displayed by the \fB--list\fR option) or the special name \fBANY\fR to -set the logging levels for all modules. The \fIfacility\fR may be -\fBsyslog\fR or \fBconsole\fR to set the levels for logging to the -system log or to the console, respectively, or \fBANY\fR to set the -logging levels for both facilities. If it is omitted, -\fIfacility\fR defaults to \fBANY\fR. The \fIlevel\fR must be one of -\fBemer\fR, \fBerr\fR, \fBwarn\fR, \fBinfo\fR, or \fBdbg\fR, designating the -minimum severity of a message for it to be logged. If it is omitted, -\fIlevel\fR defaults to \fBdbg\fR. - -.IP "\fB-s PATTERN:\fIfacility\fB:\fIpattern\fR" -.IQ "\fB--set=PATTERN:\fIfacility\fB:\fIpattern\fR" - -Sets the log pattern for \fIfacility\fR to \fIpattern\fR. Each time a -message is logged to \fIfacility\fR, \fIpattern\fR determines the -message's formatting. Most characters in \fIpattern\fR are copied -literally to the log, but special escapes beginning with \fB%\fR are -expanded as follows: - -.RS -.IP \fB%A\fR -The name of the application logging the message, e.g. \fBsecchan\fR. - -.IP \fB%c\fR -The name of the module (as shown by \fBvlogconf --list\fR) logging -the message. - -.IP \fB%d\fR -The current date and time in ISO 8601 format (YYYY-MM-DD HH:MM:SS). - -.IP \fB%d{\fIformat\fB}\fR -The current date and time in the specified \fIformat\fR, which takes -the same format as the \fItemplate\fR argument to \fBstrftime\fR(3). - -.IP \fB%m\fR -The message being logged. - -.IP \fB%N\fR -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. - -.IP \fB%n\fR -A new-line. - -.IP \fB%p\fR -The level at which the message is logged, e.g. \fBDBG\fR. - -.IP \fB%P\fR -The program's process ID (pid), as a decimal number. - -.IP \fB%r\fR -The number of milliseconds elapsed from the start of the application -to the time the message was logged. - -.IP \fB%%\fR -A literal \fB%\fR. -.RE - -.IP -A few options may appear between the \fB%\fR and the format specifier -character, in this order: - -.RS -.IP \fB-\fR -Left justify the escape's expansion within its field width. Right -justification is the default. - -.IP \fB0\fR -Pad the field to the field width with \fB0\fRs. Padding with spaces -is the default. - -.IP \fIwidth\fR -A number specifies the minimum field width. If the escape expands to -fewer characters than \fIwidth\fR then it is padded to fill the field -width. (A field wider than \fIwidth\fR is not truncated to fit.) -.RE - -.IP -The default pattern for console output is \fB%d{%b %d -%H:%M:%S}|%05N|%c|%p|%m\fR; for syslog output, \fB%05N|%c|%p|%m\fR. - -.IP \fB-r\fR -.IQ \fB--reopen\fR -Causes the target application to close and reopen its log file. (This -is useful after rotating log files, to cause a new log file to be -used.) - -.IP "\fB-e \fIcommand\fR" -.IQ "\fB--execute=\fIcommand\fR" -Passes the specified \fIcommand\fR literally to the target application -and prints its response to stdout, if successful, or to stderr if an -error occurs. Use \fB-e help\fR to print a list of available commands. - -.SH OPTIONS - -.so lib/common.man - -.SH "SEE ALSO" - -.BR dpctl (8), -.BR secchan (8), -.BR ovs\-controller (8) diff --git a/utilities/vlogconf.c b/utilities/vlogconf.c deleted file mode 100644 index d091dd08..00000000 --- a/utilities/vlogconf.c +++ /dev/null @@ -1,231 +0,0 @@ -/* Copyright (c) 2008, 2009 The Board of Trustees of The Leland Stanford - * Junior University - * - * We are making the OpenFlow specification and associated documentation - * (Software) available for public use and benefit with the expectation - * that others will use, modify and enhance the Software and contribute - * those enhancements back to the community. However, since we would - * like to make the Software available for broadest use, with as few - * restrictions as possible permission is hereby granted, free of - * charge, to any person obtaining a copy of this Software to deal in - * the Software under the copyrights without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * The name and trademarks of copyright holder(s) may NOT be used in - * advertising or publicity pertaining to the Software or any - * derivatives without specific, written prior permission. - */ -#include -#include "vlog.h" - -#include -#include -#include -#include -#include -#include -#include - -#include "command-line.h" -#include "compiler.h" -#include "timeval.h" -#include "unixctl.h" -#include "util.h" - -static void -usage(char *prog_name, int exit_code) -{ - printf("Usage: %s [TARGET] [ACTION...]\n" - "Targets:\n" - " -t, --target=TARGET Path to Unix domain socket\n" - "Actions:\n" - " -l, --list List current settings\n" - " -s, --set=MODULE[:FACILITY[:LEVEL]]\n" - " Set MODULE and FACILITY log level to LEVEL\n" - " MODULE may be any valid module name or 'ANY'\n" - " FACILITY may be 'syslog', 'console', 'file', or 'ANY' (default)\n" - " LEVEL may be 'emer', 'err', 'warn', 'info', or 'dbg' (default)\n" - " -r, --reopen Make the program reopen its log file\n" - " -e, --execute=COMMAND Execute control COMMAND and print its output\n" - " -h, --help Print this helpful information\n", - prog_name); - exit(exit_code); -} - -static char * -transact(struct unixctl_client *client, const char *request, bool *ok) -{ - int code; - char *reply; - int error = unixctl_client_transact(client, request, &code, &reply); - if (error) { - fprintf(stderr, "%s: transaction error: %s\n", - unixctl_client_target(client), strerror(error)); - *ok = false; - return xstrdup(""); - } else { - if (code / 100 != 2) { - fprintf(stderr, "%s: server returned reply code %03d\n", - unixctl_client_target(client), code); - } - return reply; - } -} - -static void -transact_ack(struct unixctl_client *client, const char *request, bool *ok) -{ - free(transact(client, request, ok)); -} - -static void -execute_command(struct unixctl_client *client, const char *request, bool *ok) -{ - int code; - char *reply; - int error = unixctl_client_transact(client, request, &code, &reply); - if (error) { - fprintf(stderr, "%s: transaction error: %s\n", - unixctl_client_target(client), strerror(error)); - *ok = false; - } else { - if (code / 100 != 2) { - fprintf(stderr, "%s: server returned reply code %03d\n", - unixctl_client_target(client), code); - fputs(reply, stderr); - *ok = false; - } else { - fputs(reply, stdout); - } - } -} - -static void -add_target(struct unixctl_client ***clients, size_t *n_clients, - const char *path, bool *ok) -{ - struct unixctl_client *client; - int error = unixctl_client_create(path, &client); - if (error) { - fprintf(stderr, "Error connecting to \"%s\": %s\n", - path, strerror(error)); - *ok = false; - } else { - *clients = xrealloc(*clients, sizeof *clients * (*n_clients + 1)); - (*clients)[*n_clients] = client; - ++*n_clients; - } -} - -int main(int argc, char *argv[]) -{ - static const struct option long_options[] = { - /* Target options must come first. */ - {"target", required_argument, NULL, 't'}, - {"help", no_argument, NULL, 'h'}, - - /* Action options come afterward. */ - {"list", no_argument, NULL, 'l'}, - {"set", required_argument, NULL, 's'}, - {"reopen", no_argument, NULL, 'r'}, - {"execute", required_argument, NULL, 'e'}, - {0, 0, 0, 0}, - }; - char *short_options; - - /* Determine targets. */ - bool ok = true; - int n_actions = 0; - struct unixctl_client **clients = NULL; - size_t n_clients = 0; - - set_program_name(argv[0]); - time_init(); - - short_options = long_options_to_short_options(long_options); - for (;;) { - int option; - size_t i; - - option = getopt_long(argc, argv, short_options, long_options, NULL); - if (option == -1) { - break; - } - if (!strchr("th", option) && n_clients == 0) { - ovs_fatal(0, "no targets specified (use --help for help)"); - } else { - ++n_actions; - } - switch (option) { - case 't': - add_target(&clients, &n_clients, optarg, &ok); - break; - - case 'l': - for (i = 0; i < n_clients; i++) { - struct unixctl_client *client = clients[i]; - char *reply; - - printf("%s:\n", unixctl_client_target(client)); - reply = transact(client, "vlog/list", &ok); - fputs(reply, stdout); - free(reply); - } - break; - - case 's': - for (i = 0; i < n_clients; i++) { - struct unixctl_client *client = clients[i]; - char *request = xasprintf("vlog/set %s", optarg); - transact_ack(client, request, &ok); - free(request); - } - break; - - case 'r': - for (i = 0; i < n_clients; i++) { - struct unixctl_client *client = clients[i]; - char *request = xstrdup("vlog/reopen"); - transact_ack(client, request, &ok); - free(request); - } - break; - - case 'e': - for (i = 0; i < n_clients; i++) { - execute_command(clients[i], optarg, &ok); - } - break; - - case 'h': - usage(argv[0], EXIT_SUCCESS); - break; - - case '?': - exit(EXIT_FAILURE); - - default: - NOT_REACHED(); - } - } - if (!n_actions) { - fprintf(stderr, - "warning: no actions specified (use --help for help)\n"); - } - exit(ok ? 0 : 1); -} diff --git a/vswitchd/brcompatd.8.in b/vswitchd/brcompatd.8.in index 7566f6d7..0efac4ef 100644 --- a/vswitchd/brcompatd.8.in +++ b/vswitchd/brcompatd.8.in @@ -44,7 +44,7 @@ Sets the maximum time to wait for \fIconfig\fR to become unlocked to \fBbrcompatd\fR requires the \fBbrcompat_mod.ko\fR kernel module to be loaded. .SH "SEE ALSO" +.BR ovs-appctl (8), .BR vswitchd (8), .BR vswitchd.conf (5), -.BR vlogconf (8), \fBINSTALL\fR in the OpenVSwitch distribution. diff --git a/vswitchd/vswitchd.8.in b/vswitchd/vswitchd.8.in index 2285094c..737ef364 100644 --- a/vswitchd/vswitchd.8.in +++ b/vswitchd/vswitchd.8.in @@ -81,7 +81,7 @@ future, this restriction may be lifted. Only Linux 2.6.\fIx\fR is currently supported. . .SH "SEE ALSO" +.BR ovs-appctl (8), .BR vswitchd.conf (5), .BR brcompatd (8), -.BR vlogconf (8), \fBINSTALL\fR in the OpenVSwitch distribution. diff --git a/xenserver/etc_init.d_vswitch b/xenserver/etc_init.d_vswitch index 19fd2cd2..8be18cb7 100755 --- a/xenserver/etc_init.d_vswitch +++ b/xenserver/etc_init.d_vswitch @@ -63,7 +63,7 @@ BRCOMPATD_VALGRIND_OPT="${BRCOMPATD_VALGRIND_OPT:-}" vswitchd="$VSWITCH_BASE/sbin/vswitchd" brcompatd="$VSWITCH_BASE/sbin/brcompatd" dpctl="$VSWITCH_BASE/bin/dpctl" -vlogconf="$VSWITCH_BASE/bin/vlogconf" +appctl="$VSWITCH_BASE/bin/ovs-appctl" if [ "$ENABLE_FAKE_PROC_NET" == "y" ]; then @@ -164,7 +164,7 @@ function remove_modules { function reload_vswitchd { if [ -f "$VSWITCHD_PIDFILE" ]; then - "$vlogconf" \ + "$appctl" \ --target=vswitchd.$(cat "$VSWITCHD_PIDFILE").ctl \ --execute=vswitchd/reload fi diff --git a/xenserver/vswitch-xen.spec b/xenserver/vswitch-xen.spec index 1b1db623..a768ca37 100644 --- a/xenserver/vswitch-xen.spec +++ b/xenserver/vswitch-xen.spec @@ -252,12 +252,12 @@ fi /root/vswitch/scripts/XSFeatureNiciraVSwitch.pyo /root/vswitch/sbin/brcompatd /root/vswitch/sbin/vswitchd -/root/vswitch/bin/ovs-cfg-mod /root/vswitch/bin/dpctl -/root/vswitch/bin/vlogconf +/root/vswitch/bin/ovs-appctl +/root/vswitch/bin/ovs-cfg-mod /root/vswitch/share/man/man5/vswitchd.conf.5 /root/vswitch/share/man/man8/brcompatd.8 +/root/vswitch/share/man/man8/ovs-appctl.8 /root/vswitch/share/man/man8/ovs-cfg-mod.8 /root/vswitch/share/man/man8/dpctl.8 -/root/vswitch/share/man/man8/vlogconf.8 /root/vswitch/share/man/man8/vswitchd.8