[ovs-dev] [PATCH] ovs-vsctl: Print error when add-port fails.
Daniele Di Proietto
diproiettod at vmware.com
Wed Dec 21 02:49:24 UTC 2016
When the add-port command fails, vsctl reports the failure and just
suggests to check the logs for more details.
ovs-vswitchd fills the error column in the Interface table with a
description of the error, so it might be helpful to print that.
This is useful especially for dpdk devices, because the port naming
change could use a better error reporting.
I'm planning another patch to make sure that ovs-vswitch writes
appropriates information in the error column, after the dpdk port naming
changes are merged.
CC: Ben Pfaff <blp at ovn.org>
Signed-off-by: Daniele Di Proietto <diproiettod at vmware.com>
---
utilities/ovs-vsctl.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/utilities/ovs-vsctl.c b/utilities/ovs-vsctl.c
index a050840..14113b9 100644
--- a/utilities/ovs-vsctl.c
+++ b/utilities/ovs-vsctl.c
@@ -721,6 +721,7 @@ pre_get_info(struct ctl_context *ctx)
ovsdb_idl_add_column(ctx->idl, &ovsrec_interface_col_name);
ovsdb_idl_add_column(ctx->idl, &ovsrec_interface_col_ofport);
+ ovsdb_idl_add_column(ctx->idl, &ovsrec_interface_col_error);
}
static void
@@ -2376,7 +2377,6 @@ post_db_reload_expect_iface(const struct ovsrec_interface *iface)
static void
post_db_reload_do_checks(const struct vsctl_context *vsctl_ctx)
{
- struct ds dead_ifaces = DS_EMPTY_INITIALIZER;
size_t i;
for (i = 0; i < n_neoteric_ifaces; i++) {
@@ -2389,18 +2389,18 @@ post_db_reload_do_checks(const struct vsctl_context *vsctl_ctx)
iface = ovsrec_interface_get_for_uuid(vsctl_ctx->base.idl, uuid);
if (iface && (!iface->ofport || *iface->ofport == -1)) {
- ds_put_format(&dead_ifaces, "'%s', ", iface->name);
+ if (iface->error && *iface->error) {
+ ovs_error(0, "Error detected while setting up '%s': %s. "
+ "See ovs-vswitchd log for details.",
+ iface->name, iface->error);
+ } else {
+ ovs_error(0, "Error detected while setting up '%s'. "
+ "See ovs-vswitchd log for details.",
+ iface->name);
+ }
}
}
}
-
- if (dead_ifaces.length) {
- dead_ifaces.length -= 2; /* Strip off trailing comma and space. */
- ovs_error(0, "Error detected while setting up %s. See ovs-vswitchd "
- "log for details.", ds_cstr(&dead_ifaces));
- }
-
- ds_destroy(&dead_ifaces);
}
--
2.10.2
More information about the dev
mailing list