diff options
| author | Ben Pfaff <blp@nicira.com> | 2011-05-12 12:05:42 -0700 |
|---|---|---|
| committer | Ben Pfaff <blp@nicira.com> | 2011-05-12 12:05:42 -0700 |
| commit | 007948177581f3b3dad188221593d0e4bdca6ba0 (patch) | |
| tree | f1acdac6058c28a0905f717612e3cb3c84fcea06 /utilities | |
| parent | fc08b7a2397ef0cf55014c1ee159599fb420b73e (diff) | |
| parent | 2db65bf72c008cf7ee658d0b44744b39495ead14 (diff) | |
| download | openvswitch-007948177581f3b3dad188221593d0e4bdca6ba0.tar.gz | |
Merge 'master' into 'next'.
Diffstat (limited to 'utilities')
| -rw-r--r-- | utilities/ovs-controller.c | 6 | ||||
| -rw-r--r-- | utilities/ovs-dpctl.8.in | 9 | ||||
| -rw-r--r-- | utilities/ovs-dpctl.c | 62 | ||||
| -rw-r--r-- | utilities/ovs-ofctl.8.in | 5 | ||||
| -rw-r--r-- | utilities/ovs-ofctl.c | 11 | ||||
| -rw-r--r-- | utilities/ovs-openflowd.c | 6 | ||||
| -rw-r--r-- | utilities/ovs-tcpundump.1.in | 4 | ||||
| -rw-r--r-- | utilities/ovs-vsctl.8.in | 5 | ||||
| -rw-r--r-- | utilities/ovs-vsctl.c | 17 |
9 files changed, 95 insertions, 30 deletions
diff --git a/utilities/ovs-controller.c b/utilities/ovs-controller.c index f131917d4..89e6a56cf 100644 --- a/utilities/ovs-controller.c +++ b/utilities/ovs-controller.c @@ -328,10 +328,8 @@ parse_options(int argc, char *argv[]) {"version", no_argument, 0, 'V'}, DAEMON_LONG_OPTIONS, VLOG_LONG_OPTIONS, -#ifdef HAVE_OPENSSL - STREAM_SSL_LONG_OPTIONS + STREAM_SSL_LONG_OPTIONS, {"peer-ca-cert", required_argument, 0, OPT_PEER_CA_CERT}, -#endif {0, 0, 0, 0}, }; char *short_options = long_options_to_short_options(long_options); @@ -404,13 +402,11 @@ parse_options(int argc, char *argv[]) VLOG_OPTION_HANDLERS DAEMON_OPTION_HANDLERS -#ifdef HAVE_OPENSSL STREAM_SSL_OPTION_HANDLERS case OPT_PEER_CA_CERT: stream_ssl_set_peer_ca_cert_file(optarg); break; -#endif case '?': exit(EXIT_FAILURE); diff --git a/utilities/ovs-dpctl.8.in b/utilities/ovs-dpctl.8.in index 58b3ea0ea..5b5941bed 100644 --- a/utilities/ovs-dpctl.8.in +++ b/utilities/ovs-dpctl.8.in @@ -78,10 +78,12 @@ Removes each \fInetdev\fR from the list of network devices datapath Prints the name of each configured datapath on a separate line. . .TP -\fBshow \fR[\fIdp\fR...] +[\fB\-s\fR | \fB\-\-statistics\fR] \fBshow \fR[\fIdp\fR...] Prints a summary of configured datapaths, including their datapath numbers and a list of ports connected to each datapath. (The local -port is identified as port 0.) +port is identified as port 0.) If \fB\-s\fR or \fB\-\-statistics\fR +is specified, then packet and byte counters are also printed for each +port. .IP If one or more datapaths are specified, information on only those datapaths are displayed. Otherwise, \fBovs\-dpctl\fR displays information @@ -104,6 +106,9 @@ not OpenFlow flow entries. By deleting them, the process that set them up may be confused about their disappearance. . .SH OPTIONS +.IP "\fB\-s\fR, \fB\-\-statistics\fR" +Causes the \fBshow\fR command to print packet and byte counters for +each port within the datapaths that it shows. .TP \fB\-t\fR, \fB\-\-timeout=\fIsecs\fR Limits \fBovs\-dpctl\fR runtime to approximately \fIsecs\fR seconds. If diff --git a/utilities/ovs-dpctl.c b/utilities/ovs-dpctl.c index 9d6bf9852..40048b445 100644 --- a/utilities/ovs-dpctl.c +++ b/utilities/ovs-dpctl.c @@ -45,6 +45,9 @@ VLOG_DEFINE_THIS_MODULE(dpctl); +/* -s, --statistics: Print port statistics? */ +bool print_statistics; + static const struct command all_commands[]; static void usage(void) NO_RETURN; @@ -68,6 +71,7 @@ parse_options(int argc, char *argv[]) VLOG_OPTION_ENUMS }; static struct option long_options[] = { + {"statistics", no_argument, 0, 's'}, {"timeout", required_argument, 0, 't'}, {"help", no_argument, 0, 'h'}, {"version", no_argument, 0, 'V'}, @@ -86,6 +90,10 @@ parse_options(int argc, char *argv[]) } switch (c) { + case 's': + print_statistics = true; + break; + case 't': timeout = strtoul(optarg, NULL, 10); if (timeout <= 0) { @@ -321,6 +329,33 @@ do_del_if(int argc OVS_UNUSED, char *argv[]) } static void +print_stat(const char *leader, uint64_t value) +{ + fputs(leader, stdout); + if (value != UINT64_MAX) { + printf("%"PRIu64, value); + } else { + putchar('?'); + } +} + +static void +print_human_size(uint64_t value) +{ + if (value == UINT64_MAX) { + /* Nothing to do. */ + } else if (value >= 1024ULL * 1024 * 1024 * 1024) { + printf(" (%.1f TiB)", value / (1024.0 * 1024 * 1024 * 1024)); + } else if (value >= 1024ULL * 1024 * 1024) { + printf(" (%.1f GiB)", value / (1024.0 * 1024 * 1024)); + } else if (value >= 1024ULL * 1024) { + printf(" (%.1f MiB)", value / (1024.0 * 1024)); + } else if (value >= 1024) { + printf(" (%.1f KiB)", value / 1024.0); + } +} + +static void show_dpif(struct dpif *dpif) { struct dpif_port_dump dump; @@ -371,6 +406,33 @@ show_dpif(struct dpif *dpif) putchar(')'); } putchar('\n'); + + if (print_statistics) { + const struct netdev_stats *s = &dpif_port.stats; + + print_stat("\t\tRX packets:", s->rx_packets); + print_stat(" errors:", s->rx_errors); + print_stat(" dropped:", s->rx_dropped); + print_stat(" overruns:", s->rx_over_errors); + print_stat(" frame:", s->rx_frame_errors); + printf("\n"); + + print_stat("\t\tTX packets:", s->tx_packets); + print_stat(" errors:", s->tx_errors); + print_stat(" dropped:", s->tx_dropped); + print_stat(" aborted:", s->tx_aborted_errors); + print_stat(" carrier:", s->tx_carrier_errors); + printf("\n"); + + print_stat("\t\tcollisions:", s->collisions); + printf("\n"); + + print_stat("\t\tRX bytes:", s->rx_bytes); + print_human_size(s->rx_bytes); + print_stat(" TX bytes:", s->tx_bytes); + print_human_size(s->tx_bytes); + printf("\n"); + } } dpif_close(dpif); } diff --git a/utilities/ovs-ofctl.8.in b/utilities/ovs-ofctl.8.in index 7452e70ec..06d61deea 100644 --- a/utilities/ovs-ofctl.8.in +++ b/utilities/ovs-ofctl.8.in @@ -775,11 +775,6 @@ increasing capability: This is the standard OpenFlow 1.0 flow format. It should be supported by all OpenFlow switches. . -.IP "\fBtun_id_from_cookie\fR" -This Nicira extension to OpenFlow adds minimal and limited support for -\fBtun_id\fR, but it does not support any other Nicira flow -extensions. (This flow format is deprecated.) -. .IP "\fBnxm\fR (Nicira Extended Match)" This Nicira extension to OpenFlow is flexible and extensible. It supports all of the Nicira flow extensions, such as \fBtun_id\fR and diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c index 11fcc3e70..5fa11dba4 100644 --- a/utilities/ovs-ofctl.c +++ b/utilities/ovs-ofctl.c @@ -92,7 +92,7 @@ parse_options(int argc, char *argv[]) {"help", no_argument, 0, 'h'}, {"version", no_argument, 0, 'V'}, VLOG_LONG_OPTIONS, - STREAM_SSL_LONG_OPTIONS + STREAM_SSL_LONG_OPTIONS, {0, 0, 0, 0}, }; char *short_options = long_options_to_short_options(long_options); @@ -502,8 +502,6 @@ negotiate_highest_flow_format(struct vconn *vconn, if (try_set_flow_format(vconn, NXFF_NXM)) { flow_format = NXFF_NXM; - } else if (try_set_flow_format(vconn, NXFF_TUN_ID_FROM_COOKIE)) { - flow_format = NXFF_TUN_ID_FROM_COOKIE; } else { flow_format = NXFF_OPENFLOW10; } @@ -531,7 +529,7 @@ do_dump_flows__(int argc, char *argv[], bool aggregate) parse_ofp_flow_stats_request_str(&fsr, aggregate, argc > 2 ? argv[2] : ""); open_vconn(argv[1], &vconn); - min_flow_format = ofputil_min_flow_format(&fsr.match, false, 0); + min_flow_format = ofputil_min_flow_format(&fsr.match); flow_format = negotiate_highest_flow_format(vconn, min_flow_format); request = ofputil_encode_flow_stats_request(&fsr, flow_format); dump_stats_transaction(argv[1], request); @@ -1047,7 +1045,7 @@ read_flows_from_file(const char *filename, struct classifier *cls, int index) version->n_actions = actions.size / sizeof *version->actions; version->actions = ofpbuf_steal_data(&actions); - min_ff = ofputil_min_flow_format(&fm.cr, true, fm.cookie); + min_ff = ofputil_min_flow_format(&fm.cr); min_flow_format = MAX(min_flow_format, min_ff); check_final_format_for_flow_mod(min_flow_format); @@ -1113,8 +1111,7 @@ read_flows_from_switch(struct vconn *vconn, enum nx_flow_format flow_format, struct ofputil_flow_stats fs; int retval; - retval = ofputil_decode_flow_stats_reply(&fs, reply, - flow_format); + retval = ofputil_decode_flow_stats_reply(&fs, reply); if (retval) { if (retval != EOF) { ovs_fatal(0, "parse error in reply"); diff --git a/utilities/ovs-openflowd.c b/utilities/ovs-openflowd.c index 2d2446e13..9a9dffe16 100644 --- a/utilities/ovs-openflowd.c +++ b/utilities/ovs-openflowd.c @@ -269,10 +269,8 @@ parse_options(int argc, char *argv[], struct ofsettings *s) DAEMON_LONG_OPTIONS, VLOG_LONG_OPTIONS, LEAK_CHECKER_LONG_OPTIONS, -#ifdef HAVE_OPENSSL - STREAM_SSL_LONG_OPTIONS + STREAM_SSL_LONG_OPTIONS, {"bootstrap-ca-cert", required_argument, 0, OPT_BOOTSTRAP_CA_CERT}, -#endif {0, 0, 0, 0}, }; char *short_options = long_options_to_short_options(long_options); @@ -440,13 +438,11 @@ parse_options(int argc, char *argv[], struct ofsettings *s) LEAK_CHECKER_OPTION_HANDLERS -#ifdef HAVE_OPENSSL STREAM_SSL_OPTION_HANDLERS case OPT_BOOTSTRAP_CA_CERT: stream_ssl_set_ca_cert_file(optarg, true); break; -#endif case '?': exit(EXIT_FAILURE); diff --git a/utilities/ovs-tcpundump.1.in b/utilities/ovs-tcpundump.1.in index e59f6dba7..0837dc330 100644 --- a/utilities/ovs-tcpundump.1.in +++ b/utilities/ovs-tcpundump.1.in @@ -12,7 +12,8 @@ The \fBovs\-tcpundump\fR program reads \fBtcpdump \-xx\fR output on stdin, looking for hexadecimal packet data, and dumps each Ethernet as a single hexadecimal string on stdout. This format is suitable for use with the \fBofproto/trace\fR command supported by -\fBovs\-vswitchd\fR(8) and \fBovs-openflowd\fR(8). +\fBovs\-vswitchd\fR(8) and \fBovs-openflowd\fR(8) +via \fBovs\-appctl\fR(8). .PP At least two \fB\-x\fR or \fB\-X\fR options must be given, otherwise the output will omit the Ethernet header, which prevents the output @@ -23,6 +24,7 @@ from being using with \fBofproto/trace\fR. . .SH "SEE ALSO" . +.BR ovs\-appctl (8), .BR ovs\-vswitchd (8), .BR ovs\-openflowd (8), .BR ovs\-pcap (1), diff --git a/utilities/ovs-vsctl.8.in b/utilities/ovs-vsctl.8.in index 0b3e164ef..fcfec0246 100644 --- a/utilities/ovs-vsctl.8.in +++ b/utilities/ovs-vsctl.8.in @@ -596,6 +596,11 @@ For a map column, without \fB\-\-if\-exists\fR it is an error if If \fB@\fIname\fR is specified, then the UUID for \fIrecord\fR may be referred to by that name later in the same \fBovs\-vsctl\fR invocation in contexts where a UUID is expected. +.IP +Both \fB\-\-id\fR and the \fIcolumn\fR arguments are optional, but +usually at least one or the other should be specified. If both are +omitted, then \fBget\fR has no effect except to verify that +\fIrecord\fR exists in \fItable\fR. . .IP "\fBset \fItable record column\fR[\fB:\fIkey\fR]\fB=\fIvalue\fR..." Sets the value of each specified \fIcolumn\fR in the given diff --git a/utilities/ovs-vsctl.c b/utilities/ovs-vsctl.c index 2c1ba6df2..851696650 100644 --- a/utilities/ovs-vsctl.c +++ b/utilities/ovs-vsctl.c @@ -26,6 +26,7 @@ #include <stdarg.h> #include <stdlib.h> #include <string.h> +#include <unistd.h> #include "command-line.h" #include "compiler.h" @@ -216,10 +217,8 @@ parse_options(int argc, char *argv[]) {"version", no_argument, 0, 'V'}, VLOG_LONG_OPTIONS, TABLE_LONG_OPTIONS, -#ifdef HAVE_OPENSSL - STREAM_SSL_LONG_OPTIONS + STREAM_SSL_LONG_OPTIONS, {"peer-ca-cert", required_argument, 0, OPT_PEER_CA_CERT}, -#endif {0, 0, 0, 0}, }; char *tmp, *short_options; @@ -277,13 +276,11 @@ parse_options(int argc, char *argv[]) VLOG_OPTION_HANDLERS TABLE_OPTION_HANDLERS(&table_style) -#ifdef HAVE_OPENSSL STREAM_SSL_OPTION_HANDLERS case OPT_PEER_CA_CERT: stream_ssl_set_peer_ca_cert_file(optarg); break; -#endif case '?': exit(EXIT_FAILURE); @@ -2547,10 +2544,20 @@ pre_parse_column_key_value(struct vsctl_context *ctx, static void pre_cmd_get(struct vsctl_context *ctx) { + const char *id = shash_find_data(&ctx->options, "--id"); const char *table_name = ctx->argv[1]; const struct vsctl_table_class *table; int i; + /* Using "get" without --id or a column name could possibly make sense. + * Maybe, for example, a ovs-vsctl run wants to assert that a row exists. + * But it is unlikely that an interactive user would want to do that, so + * issue a warning if we're running on a terminal. */ + if (!id && ctx->argc <= 3 && isatty(STDOUT_FILENO)) { + VLOG_WARN("\"get\" command without row arguments or \"--id\" is " + "possibly erroneous"); + } + table = pre_get_table(ctx, table_name); for (i = 3; i < ctx->argc; i++) { if (!strcasecmp(ctx->argv[i], "_uuid") |
