[ovs-dev] [PATCH] ovs-vsctl: check if the device name is valid

Ben Pfaff blp at nicira.com
Fri Nov 2 14:30:26 UTC 2012


On Fri, Nov 02, 2012 at 03:28:03PM +0800, Cong Wang wrote:
> On Fri, Nov 2, 2012 at 12:44 AM, Ben Pfaff <blp at nicira.com> wrote:
> > Stepping back: I support your basic proposal, that "ovs-vsctl
> > add-port" should report a problem if the port cannot successfully be
> > added.  The issue is that, so far, the approaches I've seen don't fit
> > well with the overall Open vSwitch design.  Here is another approach
> > that fits better: make "ovs-vsctl add-port" check the value that
> > ovs-vswitchd assigns to the "ofport" column in the new Interface
> > record.  When a port is added successfully, this column receives a
> > positive integer value; when adding a port fails, it receives the
> > value -1.  I'd accept a patch to do this.
> 
> Yeah, this looks indeed a better approach.
> 
> So, in add_port() we have to wait for ovs-vswitch to commit this value
> and then check it? But
> 
> ovsrec_interface_get_ofport(ifaces[0], OVSDB_TYPE_INTEGER);
> 
> this returns [] even I added ovsdb_idl_txn_wait(), so I must be missing
> something here...

add_port() runs when the database transaction to add the port is being
composed, before the transaction is sent to ovsdb-server, so at that
point no ofport is assigned.

We need to do this check in do_vsctl() at approximately the "done:"
label, because only at that point has ovs-vswitchd updated its
configuration and updated the ofport columns.

You'll need to arrange for "add-port"'s 'prerequisite' function (see
all_commands[]) to make ofport available with a command like
    ovsdb_idl_add_column(ctx->idl, &ovsrec_interface_col_ofport);



More information about the dev mailing list