ovs-vsctl: Improve error reporting
authorAndy Zhou <azhou@nicira.com>
Thu, 27 Mar 2014 16:10:31 +0000 (17:10 +0100)
committerBen Pfaff <blp@nicira.com>
Fri, 28 Mar 2014 15:08:17 +0000 (08:08 -0700)
commitc3ccfe984933ca8df56d551cb3ae7e0bf3d119b8
treeb869c4fdfdfdbb4866ed38fa9d90c0c71ab41bed
parent8c6cf7b8a6f159a284f78db8dbac1fd0a0f197a4
ovs-vsctl: Improve error reporting

ovs-vsctl is a command-line interface to the Open vSwitch database,
and as such it just modifies the desired Open vSwitch configuration in
the database.  ovs-vswitchd, on the other hand, monitors the database
and implements the actual configuration specified in the database.
This can lead to surprises when the user makes a change to the
database, with ovs-vsctl, that ovs-vswitchd cannot actually
implement. In such a case, the ovs-vsctl command silently succeeds
(because the database was successfully updated) but its desired
effects don't actually take place. One good example of such a change
is attempting to add a port with a misspelled name (e.g. ``ovs-vsctl
add-port br0 fth0'', where fth0 should be eth0); another is creating
a bridge or a port whose name is longer than supported
(e.g. ``ovs-vsctl add-br'' with a 16-character bridge name on
Linux). It can take users a long time to realize the error, because it
requires looking through the ovs-vswitchd log.

The patch improves the situation by checking whether operations that
ovs executes succeed and report an error when
they do not.  This patch only report add-br and add-port
operation errors by examining the `ofport' value that
ovs-vswitchd stores into the database record for the newly created
interface.  Until ovs-vswitchd finishes implementing the new
configuration, this column is empty, and after it finishes it is
either -1 (on failure) or a positive number (on success).

Signed-off-by: Andy Zhou <azhou@nicira.com>
Co-authored-by: Thomas Graf <tgraf@redhat.com>
Signed-off-by: Thomas Graf <tgraf@redhat.com>
Co-authored-by: Ben Pfaff <blp@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
NEWS
tests/ovs-vsctl.at
utilities/ovs-vsctl.c