On Fri, Nov 16, 2018 at 10:26 AM Ales Musil <[email protected]> wrote:

>
>
> On Thu, Nov 15, 2018 at 10:17 AM <[email protected]> wrote:
>
>> Hello,
>>
>> After having integrated OVS with Ovirt and enabled it as default network
>> provider I am facing the following issues.
>>
>
> We are using OVN as network provider.
>
>
>>
>> I can see with "ovs-vsctl show" that the virtual switch / bridge called
>> "br-int" is created. I can see interfaces being added / removed to it as I
>> start / stop VMs.
>>
>> [root@******* ~]# ovs-vsctl show
>> 78e883f9-f074-4292-afce-bb829ded856b
>>     Bridge br-int
>>         fail_mode: secure
>>         Port "vnet6"
>>             Interface "vnet6"
>>         Port br-int
>>             Interface br-int
>>                 type: internal
>>         Port "vnet4"
>>             Interface "vnet4"
>>     ovs_version: "2.9.0"
>>
>> Now I for example want to create a new interface as shown:
>>
>> ip tuntap add mode tap sniff0
>> ovs-vsctl add-port br-int sniff0 -- --id=@p get port sniff0 -- --id=@m
>> create mirror name=m0 select-all=true output-port=@p -- set bridge br-int
>> mirrors=@m
>> fae36943-2ca7-4914-9679-0b881cd062d8
>>
>> Its created, but how do I assign this sniffing interface to a ovirt VM?
>
>
> If I understand your intentions correctly from now on you just need to add
> OVN network connected to physical 'sniff0'. This can be done via UI in
> Networks -> New network -> Check "Create on physical network" -> Select
> correct provider -> Change to "Custom" and type the 'sniff0' in the
> textbox. From now on you can use vNIC profile of this network and assign it
> to desired VM.
>
>
>
>> also, how can I create sniffing ports listening only on a subset of
>> interfaces if they get dynamically created / removed? vnet6 points to host
>> A now, but after shutting it down starting a few other VMs it will point to
>> host B...
>
>
Matching the interfaces by name is problematic, but I assume you are more
interested about sniffing a specific vm, or a specific interface (with a
known mac)

You could use the vdsm hooks for this.

Every time you plug/unplug an interface, the vdsm host will look for hook
scripts inside:
   /usr/libexec/vdsm/hooks/after_nic_hotplug
   /usr/libexec/vdsm/hooks/after_nic_hotunplug
and execute them after the nic is plugged/unplugged.

Inside the scripts you can retrieve the information about the vm, and the
plugged nic.
A sample script would look as follows:
-------------------------------------
#!/usr/bin/python
import os
vm_id = os.environ['vmId']
nic_xml_file = os.environ['_hook_domxml']
--------------------------------------
with the vm_id being the vm uuid:

and the nic xml file containing something like:
<?xml version="1.0" encoding="utf-8"?><interface type="bridge"><model
type="virtio"/><link state="up"/><source bridge="br-int"/><alias
name="ua-ebf987b0-271f-42c9-83fd-d09630a524a2"/><mac
address="56:6f:7d:07:00:08"/><mtu size="1442"/><bandwidth/><virtualport
type="openvswitch"><parameters
interfaceid="aa8660f1-cf11-4c9c-97d6-7ef852037ca7"/></virtualport></interface>

You could identify you port by mac or interfaceid (id of the ovn logical
port).

You could now use this information to adjust your mirror entries.


>
> Adding @Dominik <[email protected]>
>
>
>> How do I control to what vm the vnetX nic gets assigned?
>> _______________________________________________
>> Users mailing list -- [email protected]
>> To unsubscribe send an email to [email protected]
>> Privacy Statement: https://www.ovirt.org/site/privacy-policy/
>> oVirt Code of Conduct:
>> https://www.ovirt.org/community/about/community-guidelines/
>> List Archives:
>> https://lists.ovirt.org/archives/list/[email protected]/message/FLR67ZYMFONHH3D3AWDIBT6RUYBPTBF4/
>>
>
> Hopefully this helps.
>
> Regards,
> Ales Musil
> --
>
> ALES MUSIL
> Associate Software Engineer - rhv network
>
> Red Hat EMEA <https://www.redhat.com/>
>
>
> [email protected]   IM: amusil
> <https://red.ht/sig>
> _______________________________________________
> Users mailing list -- [email protected]
> To unsubscribe send an email to [email protected]
> Privacy Statement: https://www.ovirt.org/site/privacy-policy/
> oVirt Code of Conduct:
> https://www.ovirt.org/community/about/community-guidelines/
> List Archives:
> https://lists.ovirt.org/archives/list/[email protected]/message/MQRL62MDKSUENAFAYEE2ZSJLJ6BRIWS5/
>
_______________________________________________
Users mailing list -- [email protected]
To unsubscribe send an email to [email protected]
Privacy Statement: https://www.ovirt.org/site/privacy-policy/
oVirt Code of Conduct: 
https://www.ovirt.org/community/about/community-guidelines/
List Archives: 
https://lists.ovirt.org/archives/list/[email protected]/message/MSYBRNHIOEHACC4BKX5TQGZCPUF6QUA7/

Reply via email to