Skip to content

Commit 3fbe1d3

Browse files
committed
Make ovs-appctl easier to use and synchronize its interface with ovs-vsctl.
It is inconvenient to type the whole path to the Unix daemon socket when using ovs-appctl. Allow the name of the daemon to be used instead when a pidfile exists in the default location, and contact ovs-vswitchd by default. Also, the various options for manipulating vlog were invented before the general-purpose command mechanism existed. Get rid of all of the action options in favor of just specifying the command to be executed as non-option arguments. Finally, there simply wasn't much value in allowing multiple targets or options to be specified; these variations were never used in practice. So simplify the interface by making it one target, one action per invocation. Also, make ovs-vsctl use the same syntax for its --target option. Based on work by Justin Pettit.
1 parent fde05ad commit 3fbe1d3

12 files changed

Lines changed: 217 additions & 254 deletions

INSTALL.Linux

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -156,14 +156,12 @@ respectively.
156156

157157
At runtime, you may make ovs-vswitchd reload its configuration file
158158
and update its configuration accordingly by sending it a SIGHUP
159-
signal. The ovs-appctl utility can also be used to do this with a
160-
command such as:
159+
signal. The ovs-appctl utility can also be used to do this:
161160

162-
% ovs-appctl -t <pid> -e vswitchd/reload
161+
% ovs-appctl vswitchd/reload
163162

164-
where <pid> is ovs-vswitchd's process ID. In the latter case,
165-
ovs-appctl will not exit until the reload and reconfiguration is
166-
complete.
163+
In the latter case, ovs-appctl will wait for ovs-vswitchd to finish
164+
reloading before it exits.
167165

168166
Bug Reporting
169167
-------------

debian/openvswitch-switch.logrotate

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
missingok
77
rotate 30
88
postrotate
9-
ovs-appctl --target /var/run/ovs-openflowd.pid --reopen
9+
ovs-appctl --target=ovs-openflowd vlog/reopen
1010
endscript
1111
}

lib/unixctl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ unixctl_command_reply(struct unixctl_conn *conn,
168168
* A program that (optionally) daemonizes itself should call this function
169169
* *after* daemonization, so that the socket name contains the pid of the
170170
* daemon instead of the pid of the program that exited. (Otherwise,
171-
* "ovs-appctl --target <program>.pid" will fail.)
171+
* "ovs-appctl --target=<program>" will fail.)
172172
*
173173
* Returns 0 if successful, otherwise a positive errno value. If successful,
174174
* sets '*serverp' to the new unixctl_server, otherwise to NULL. */

lib/vlog-unixctl.man

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Sets the logging level for \fImodule\fR in \fIfacility\fR to
77
.RS
88
.IP \(bu
99
\fImodule\fR may be any valid module name (as displayed by the
10-
\fB--list\fR action on \fBovs-appctl\fR(8)), or the special name
10+
\fB--list\fR action on \fBovs\-appctl\fR(8)), or the special name
1111
\fBANY\fR to set the logging levels for all modules.
1212
.
1313
.IP \(bu
@@ -26,7 +26,7 @@ logged. If it is omitted, \fIlevel\fR defaults to \fBdbg\fR.
2626
.RE
2727
.IP "\fBvlog/set PATTERN:\fIfacility\fB:\fIpattern\fR"
2828
Sets the log pattern for \fIfacility\fR to \fIpattern\fR. Refer to
29-
\fBovs-appctl\fR(8) for a description of the valid syntax for \fIpattern\fR.
29+
\fBovs\-appctl\fR(8) for a description of the valid syntax for \fIpattern\fR.
3030
.
3131
.IP "\fBvlog/list\fR"
3232
Lists the supported logging modules and their current levels.

lib/vlog.man

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Sets the logging level for \fImodule\fR in \fIfacility\fR to
77
.RS
88
.IP \(bu
99
\fImodule\fR may be any valid module name (as displayed by the
10-
\fB--list\fR action on \fBovs-appctl\fR(8)), or the special name
10+
\fB--list\fR action on \fBovs\-appctl\fR(8)), or the special name
1111
\fBANY\fR to set the logging levels for all modules.
1212

1313
.IP \(bu
@@ -35,7 +35,7 @@ Sets the maximum logging verbosity level, equivalent to
3535
.TP
3636
\fB-vPATTERN:\fIfacility\fB:\fIpattern\fR, \fB--verbose=PATTERN:\fIfacility\fB:\fIpattern\fR
3737
Sets the log pattern for \fIfacility\fR to \fIpattern\fR. Refer to
38-
\fBovs-appctl\fR(8) for a description of the valid syntax for \fIpattern\fR.
38+
\fBovs\-appctl\fR(8) for a description of the valid syntax for \fIpattern\fR.
3939

4040
.TP
4141
\fB--log-file\fR[\fB=\fIfile\fR]

utilities/ovs-appctl.8.in

Lines changed: 65 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -4,58 +4,65 @@
44
. ns
55
. IP "\\$1"
66
..
7-
.TH ovs\-appctl 8 "April 2009" "Open vSwitch" "Open vSwitch Manual"
7+
.TH ovs\-appctl 8 "November 2009" "Open vSwitch" "Open vSwitch Manual"
88
.ds PN ovs\-appctl
99

1010
.SH NAME
1111
ovs\-appctl \- utility for configuring running Open vSwitch daemons
1212

1313
.SH SYNOPSIS
14-
\fBovs\-appctl\fR [\fB-h\fR | \fB--help\fR] [\fItarget\fR...] [\fIaction\fR...]
15-
.sp 1
16-
The available \fItarget\fR options are:
14+
\fBovs\-appctl\fR [\fB--target=\fItarget\fR | \fB-t\fR \fItarget\fR]
15+
\fIcommand \fR[\fIarg\fR...]
1716
.br
18-
[\fB-t\fR \fIsocket\fR | \fB--target=\fIsocket\fR]
19-
.sp 1
20-
The available \fIaction\fR options are:
17+
\fBovs\-appctl\fR --help
2118
.br
22-
[\fB-l\fR | \fB--list\fR] [\fB-s\fR
23-
\fImodule\fR[\fB:\fIfacility\fR[\fB:\fIlevel\fR]] |
24-
\fB--set=\fImodule\fR[\fB:\fIfacility\fR[\fB:\fIlevel\fR]]]
25-
[\fB-r\fR | \fB--reopen\fR]
26-
[\fB-e\fR | \fB--execute=\fIcommand\fR]
27-
19+
\fBovs\-appctl\fR --version
2820
.SH DESCRIPTION
29-
The \fBovs\-appctl\fR program connects to one or more running
30-
Open vSwitch daemons (such as \fBovs\-vswitchd\fR(8)), as specified by the
31-
user, and sends them commands to query or modify their behavior.
32-
Its primary purpose is currently to adjust daemons' logging levels.
33-
34-
\fBovs\-appctl\fR applies one or more actions to each of one or more
35-
target processes. Targets may be specified using:
36-
37-
.IP "\fB-t \fIsocket\fR"
38-
.IQ "\fB--target=\fIsocket\fR"
39-
The specified \fIsocket\fR must be the name of a Unix domain socket
40-
for a \fBovs\-appctl\fR-controllable process. If \fIsocket\fR does not
41-
begin with \fB/\fR, it is treated as relative to \fB@RUNDIR@\fR.
42-
43-
Each Open vSwitch daemon by default creates a socket named
44-
\fB@RUNDIR@/\fIprogram\fB.\fIpid\fB.ctl\fR, where \fIprogram\fR is
45-
the program's name (such as \fBovs\-vswitchd\fR) and \fIpid\fR is the
46-
daemon's PID.
47-
48-
.PP
49-
The available actions are:
50-
51-
.IP "\fB-l\fR"
52-
.IQ "\fB--list\fR"
53-
Print the list of known logging modules and their current levels to
54-
stdout.
55-
56-
.IP "\fB-s\fR \fImodule\fR[\fB:\fIfacility\fR[\fB:\fIlevel\fR]]"
57-
.IQ "\fB--set=\fImodule\fR[\fB:\fIfacility\fR[\fB:\fIlevel\fR]]"
58-
21+
Open vSwitch daemons accept certain commands at runtime to control
22+
their behavior and query their settings. Every daemon accepts the
23+
commands for querying and adjusting its logging settings documented
24+
under \fBLOGGING COMMANDS\fR below, and \fBovs\-vswitchd\fR in
25+
particular accepts a number of additional commands documented in
26+
\fBovs\-vswitchd\fR(8).
27+
28+
The \fBovs\-appctl\fR program provides a simple way to invoke these
29+
commands. The command to be sent is specified on \fBovs\-appctl\fR's
30+
command line as non-option arguments. \fBovs\-appctl\fR sends the
31+
command and prints the daemon's response on standard output.
32+
33+
In normal use only a single option is accepted:
34+
35+
.IP "\fB\-t \fItarget\fR"
36+
.IQ "\fB\-\-target=\fItarget\fR"
37+
Tells \fBovs\-appctl\fR which daemon to contact.
38+
.IP
39+
If \fItarget\fR begins with \fB/\fR it must name a Unix domain socket
40+
on which an Open vSwitch daemon is listening for control channel
41+
connections. By default, each daemon listens on a Unix domain socket
42+
named \fB@RUNDIR@/\fIprogram\fB.\fIpid\fB.ctl\fR, where \fIprogram\fR
43+
is the program's name and \fIpid\fR is its process ID. For example,
44+
if \fBovs-vswitchd\fR has PID 123, it would listen on
45+
\fB@RUNDIR@/ovs-vswitchd.123.ctl\fR.
46+
.IP
47+
Otherwise, \fBovs\-appctl\fR looks for a pidfile, that is, a file
48+
whose contents are the process ID of a running process as a decimal
49+
number, named \fB@RUNDIR@/\fItarget\fB.pid\fR. (The \fB\-\-pidfile\fR
50+
option makes an Open vSwitch daemon create a pidfile.)
51+
\fBovs\-appctl\fR reads the pidfile, then looks for a Unix socket
52+
named \fB@RUNDIR@/\fItarget\fB.\fIpid\fB.ctl\fR, where \fIpid\fR is
53+
replaced by the process ID read from the pidfile, and uses that file
54+
as if it had been specified directly as the target.
55+
.IP
56+
The default target is \fBovs\-vswitchd\fR.
57+
.
58+
.SH LOGGING COMMANDS
59+
Every Open vSwitch daemon supports the following commands for
60+
examining and adjusting log levels.
61+
.
62+
.IP "\fBvlog/list\fR"
63+
Lists the known logging modules and their current levels.
64+
.
65+
.IP "\fBvlog/set\fR \fImodule\fR[\fB:\fIfacility\fR[\fB:\fIlevel\fR]]"
5966
Sets the logging level for \fImodule\fR in \fIfacility\fR to
6067
\fIlevel\fR. The \fImodule\fR may be any valid module name (as
6168
displayed by the \fB--list\fR option) or the special name \fBANY\fR to
@@ -67,10 +74,8 @@ logging levels for both facilities. If it is omitted,
6774
\fBemer\fR, \fBerr\fR, \fBwarn\fR, \fBinfo\fR, or \fBdbg\fR, designating the
6875
minimum severity of a message for it to be logged. If it is omitted,
6976
\fIlevel\fR defaults to \fBdbg\fR.
70-
71-
.IP "\fB-s PATTERN:\fIfacility\fB:\fIpattern\fR"
72-
.IQ "\fB--set=PATTERN:\fIfacility\fB:\fIpattern\fR"
73-
77+
.
78+
.IP "\fBvlog/set PATTERN:\fIfacility\fB:\fIpattern\fR"
7479
Sets the log pattern for \fIfacility\fR to \fIpattern\fR. Each time a
7580
message is logged to \fIfacility\fR, \fIpattern\fR determines the
7681
message's formatting. Most characters in \fIpattern\fR are copied
@@ -140,27 +145,29 @@ width. (A field wider than \fIwidth\fR is not truncated to fit.)
140145
The default pattern for console output is \fB%d{%b %d
141146
%H:%M:%S}|%05N|%c|%p|%m\fR; for syslog output, \fB%05N|%c|%p|%m\fR.
142147

143-
.IP \fB-r\fR
144-
.IQ \fB--reopen\fR
145-
Causes the target application to close and reopen its log file. (This
148+
.IP "\fBvlog/reopen\fR"
149+
Causes the daemon to close and reopen its log file. (This
146150
is useful after rotating log files, to cause a new log file to be
147151
used.)
148152

149153
This has no effect if the target application was not invoked with the
150154
\fB--log-file\fR option.
151155

152-
.IP "\fB-e \fIcommand\fR"
153-
.IQ "\fB--execute=\fIcommand\fR"
154-
Passes the specified \fIcommand\fR literally to the target application
155-
and prints its response to stdout, if successful, or to stderr if an
156-
error occurs. Use \fB-e help\fR to print a list of available commands.
157-
158156
.SH OPTIONS
159157

160158
.so lib/common.man
161159

160+
.SH BUGS
161+
162+
The protocol used to speak to Open vSwitch daemons does not contain a
163+
quoting mechanism, so command arguments should not generally contain
164+
white space.
165+
162166
.SH "SEE ALSO"
163167

168+
\fBovs\-appctl\fR can control the following daemons:
169+
.BR ovs\-vswitchd (8),
170+
.BR ovs\-openflowd (8),
164171
.BR ovs\-controller (8),
165-
.BR ovs\-dpctl (8),
166-
.BR ovs\-openflowd (8)
172+
.BR ovs\-brcompatd (8),
173+
.BR ovs\-discover (8).

0 commit comments

Comments
 (0)