[ovs-dev] ovs-vsctl for sFlow config

Neil McKee neil.mckee at inmon.com
Thu May 6 23:57:40 UTC 2010


I followed these steps to compile the openvswitch rpm on xenserver 5.5 update2 DDK,  and run it on xenserver 5.5 update2:

http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=blob_plain;f=INSTALL.XenServer;hb=HEAD

It mostly worked as advertised, except that missing from these instructions is a step where you have to install the kernel-src rpm from the DDK sources download,  copy in the xen .config file that comes with it,  compile the kernel with "make" and ensure that /lib/modules/<kernel>/build points to that source directory.   In the process I also had to add more disk space to the DDK VM.

The sFlow configuration worked.  Here is a (corrected) version of the script to set it up:

#!/bin/bash
COLLECTOR=10.0.0.9:6347
AGENT_IP=xenbr0
HEADER_BYTES=128
SAMPLING_N=256
POLLING_SECS=30
SFLOWUUID=`ovs-vsctl create sFlow  \
           agent=\"${AGENT_IP}\"   \
           target=\"${COLLECTOR}\" \
           header=${HEADER_BYTES}  \
           sampling=${SAMPLING_N}  \
           polling=${POLLING_SECS}`
for BRIDGE in `ovs-vsctl list br | awk -- '/^name/ { print $3; }'` ; do
    BRIDGE=`echo $BRIDGE | tr -d "\""`
    echo "configuring sFlow for $BRIDGE"
    ovs-vsctl set bridge $BRIDGE sflow=$SFLOWUUID ;
done

There was one glitch:   when I set the "agent" to "eth0" instead of "xenbr0" the log file showed (correctly) that it could not get an IP address because there was no IP address associated with interface eth0.  However,  when I set it back to "xenbr0" again,  the sFlow agent was created but somehow no samplers or pollers were added to it.  Looking at ofproto-sflow.c the relevant code is:

    /* Add samplers and pollers for the currently known ports. */
    PORT_ARRAY_FOR_EACH (osp, &os->ports, odp_port) {
        ofproto_sflow_add_poller(os, osp, odp_port);
        ofproto_sflow_add_sampler(os, osp);
    }

Trouble is,  the prior configuration error resulted in call to ofproto_sflow_clear(),  so list of "currently known" ports here is now empty.  The parent module ofproto.c will only call ofproto_sflow_add_port() when a port is added to the bridge,  or when it is initializing the sflow module  in ofproto_set_sflow(),  so this list will stay empty unless the sflow config is backed out completely and then resubmitted.

So I think the solution might be to separate the function ofproto_set_sflow() in ofproto.c into two functions.  One to create the ofproto_sflow,  and a new one "ofproto_set_sflow_ports()"  to tell it about all the ports. Then we could allow ofproto_sflow to call that second function again itself (in place of the code above).

OK in principle?  If so,  I'll send a patch.

Regards,
Neil



On May 5, 2010, at 3:24 PM, Neil McKee wrote:

> Works now.  Good.   And I was able to add additional collector targets like this:
> 
> ovs-vsctl add sFlow br0 targets \"10.0.0.72:6343\"
> 
> Below is a bash script to turn on sFlow on all bridges with the same settings.  Does this look right?   Is there a better way to get the list of bridge names?
> 
> #!/bin/bash
> COLLECTOR_IP="10.0.0.72:6343"
> AGENT_IP=eth0
> HEADER_BYTES=128
> SAMPLING_N=256
> POLLING_SECS=30
> SFLOWUUID=`ovs-vsctl create sFlow agent=\"${AGENT_IP}\" target=\"${COLLECTOR_IP}\" header=${HEADER_BYTES} sampling=${SAMPLING_N} polling=${POLLING_SECS}`
> for BRIDGE in `ovs-vsctl list br | awk -- '/^name/ { print $3; }'` ; do
>    echo "configuring sFlow for $BRIDGE"
>    ovs-vsctl set bridge br0 sflow=$SFLOWUUID ;
> done
> 
> 
> 
> 
> On May 5, 2010, at 1:30 PM, Ben Pfaff wrote:
> 
>> On Wed, May 05, 2010 at 12:55:15PM -0700, Neil McKee wrote:
>>> 2.  It seems that the patch I sent on Jan 21st did not make it into
>>> the trunk, so sFlow is not working properly.  It looks like the same
>>> patch can be used again since the only other changes to
>>> ofproto-sflow.c that have happened since then are cosmetic.  I attach
>>> it below, and here were the comments that went with it at the time:
>> 
>> It's embarrassing that I dropped the ball like that.  Sorry.  I pushed
>> your fixes to "master".
>> 
>> I tried looking back through my inbox for other patches that I might
>> have missed.  I didn't see any obvious ones.  Please do let me know if
>> you notice anything else that's "gone missing".
> 
> 
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev_openvswitch.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openvswitch.org/pipermail/ovs-dev/attachments/20100506/0ced6c83/attachment-0003.html>


More information about the dev mailing list