[ovs-dev] xenserver: use ovs-vsctl for VIF VLAN configuration instead of /var/lib/openvswitch/br-*

Ian Campbell Ian.Campbell at citrix.com
Fri Oct 16 08:43:54 UTC 2009


On Thu, 2009-10-15 at 23:44 +0100, Ben Pfaff wrote:
> Ian Campbell <Ian.Campbell at eu.citrix.com> writes:
> 
> > On Mon, 2009-10-05 at 18:15 +0100, Ben Pfaff wrote:
> >> I think that ovs-vsctl should probably support multiple
> >> operations in one go.  I have two notions about how that might
> >> work.  One, there could be a separator argument between commands,
> >> say "," or "--".  Two, ovs-vsctl could accept commands from
> >> stdin, one per line, if "-" was given as its argument, or perhaps
> >> from a command file with, say, "-f <filename>".  I think I like
> >> the latter better.
> >
> > I'm not sure which is easier to script. I guess it comes down to:
> >         ovs-vsctl CMD1 args1 -- CMD2 args2
> > vs
> >         ovs-vsctl -f - <<EOF
> >         CMD1 args1
> >         CMD2 args2
> >         EOF
> > (I don't think creating a temporary file and using -f on it is terribly
> > useful in this context but I guess little precanned snippets are a
> > possibility)
> >
> > For the later constructing "CMD1 args\nCMD2 args" in shell could involve
> > some tricky quoting (not exactly rocket science, but still). So perhaps
> > it is worth allowing ';' as well as '\n' as a separator. At which point
> > the two forms become almost equivalent in both usage and, I suspect,
> > implementation:
> >         ovs-vsctl "CMD1 args1; CMD2 args2"
> > and
> >         ovs-vsctl -f - <<EOF
> >         CMD1 args1;
> >         CMD2 args2;
> >         EOF
> > so why not support both?
> >
> > It might be worth supporting "--" in its common usage of separating
> > options from the rest of the command line?
> 
> In the end, I decided that -- on the command line for multiple
> operations makes sense.  It's still compatible with the common
> usage, as long as either the first non-option argument also
> terminates the set of options or you put -- before the first
> command.

Sounds good.

To make use of this from the VIF hotplug script I'd need something to
replace the old dump_vif_details usage (now replaced by xenstore reads).
Would a "ovs-vsctl port-cfg key value" command be an appropriate
addition? (cfg-port seems to fit the existing names better but seem
awkward)

The hotplug script would then do something like:
	ovs-vsctl -- del-port $PORT -- add-port $BRIDGE $PORT \
		-- port-cfg $PORT net-uuid ${net_uuid} -- port-cfg vif-mac ${address} -- etc etc

> We can add a -f option too, if you want it, but then we also have
> to think about whether there's any need to support quoting of
> spaces within the command file; the shell nicely takes care of
> that for us for the command line.

I don't see any immediate need for -f in my own use cases.

> I've posted a 3-patch series that implements this in the final
> patch.

Thanks. I skimmed them and they look good to me.





More information about the dev mailing list