Re: [PATCH v3 1/4] Gathering vhostuser interface stats with ovs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 08.12.2016 15:35, Mehdi Abaakouk wrote:
>>> -    if (ret == 0)
>>> -        ret = virNetInterfaceStats(path, stats);
>>> -    else
>>> +    if (net) {
>>> +        if (net->type == VIR_DOMAIN_NET_TYPE_VHOSTUSER) {
>>> +            ret = virNetDevOpenvswitchInterfaceStats(path, stats);
>>> +        } else {
>>> +            ret = virNetInterfaceStats(path, stats);
>>> +        }
>>> +    } else {
>>>          virReportError(VIR_ERR_INVALID_ARG,
>>>                         _("invalid path, '%s' is not a known
>>> interface"), path);
>>> +    }
>>>
>>
>> Oh my. Not your fault but this looks ugly. It has even before you've
>> touched it.
>>
>> BTW: maybe I am misreading something but my understanding of vhost-user
>> is that it can be plugged into any type of bridge (e.g. snabb). How does
>> this work then if we run ovs-vsctl then? 
> 
> I don't think you misreading, vhostuser can be created by anything it's
> just a unix-socket in this end. And libvirt only known the location of
> this socket and not how it have been created.
> 
> libvirt was already guessing at getting the statistics, by 'trying' with
> /proc/net/dev even that doesn't make any sense for vhostuser interface.
> Now I
> just 'try' with ovs-vsctl but perhaps that doesn't make sense too if the
> unix-socket have not been created by openvswitch.
> 
> Since libvirt have no real control of how a (host) network interface is
> created. It can only guess the statistics location. My change just adds
> a new
> way/tool to guess that.

Fair enough.

> 
>> Do you perhaps have a set of
>> steps how can I test this feature? Because so far I've used
>> vhost-user-bridge helper from qemu repo but this will not work with it.
> 
> About testing, my setup looks like:
> 
> I install the dpdk variant of openvswitch and dpdk tools
> 
> I enable dpdk support in ovs with:
> (This can be a bit different depending on OS and openvswitch version)
> 
> $ ovs-vsctl set Open_vSwitch . "other_config:dpdk-init=true"
> $ ovs-vsctl set Open_vSwitch . "other_config:dpdk-alloc-mem=2048"
> $ ovs-vsctl set Open_vSwitch . "other_config:dpdk-extra=--vhost-owner
> libvirt-qemu:kvm --vhost-perm 0666"
> $ systemctl restart openvswitch-switch
> 
> I unbind a network card (virtio network card work well with recent dpdk)
> on my
> host with command like:
> $ dpdk-devbind -u 0000:00:04.0
> (previously called dpdk_nic_bind, too)
> 
> I create a bridge with two interfaces. dpdk0 is the first unbind
> interface. dpdkvhostuser0 is
> a vhostuser unix-socket located /var/run/openvswitch/dpdkvhostuser0
> 
> $ ovs-vsctl add-br br0 -- set bridge br0 datapath_type=netdev
> $ ovs-vsctl add-port br0 dpdk0 -- set Interface dpdk0 type=dpdk
> $ ovs-vsctl add-port br0 dpdkvhostuser0 -- set Interface dpdkvhostuser0
> type=dpdkvhostuser
> 
> And I allow packets to pass from/to each interfaces
> 
> $ ovs-ofctl del-flows br0
> $ ovs-ofctl add-flow br0 in_port=1,action=output:2
> $ ovs-ofctl add-flow br0 in_port=2,action=output:1
> 
> Then I create a VM with a network interface that looks like:
> 
> <interface type='vhostuser'>
>    <target dev='dpdkvhostuser0'/>
>    <mac address='52:54:00:3b:83:1b'/>
>    <source type='unix' path='/var/run/openvswitch/dpdkvhostuser0'
> mode='client'/>
>    <model type='virtio'/>
>    <driver queues='2'>
>        <host mrg_rxbuf='off'/>
>    </driver>
> </interface>
> 
> 
> I do some ping command to make statistics filled
> 
> Test with:
> 
> $ ovs-vsctl get Interface dpdkvhostuser0 statistics
> $ virsh domifstat <vmname> dpdkvhostuser0
> 
> Cheers,

Awesome. This is working for me.

Therefore I went ahead, fixed all the small nits raised during review
and pushed patches 1-3. As discussed in patch 4, we probably want
different approach anyway so I have not pushed that one.

Congratulations on your first libvirt contribution!

Michal

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux