Re: Use libvirt to create an NIC on the guest machine and connect to an existing TAP interface

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

 



On 08/29/2016 03:37 AM, Marina Danial wrote:
Hello,

I am facing the following issue. 

I have several TAP interfaces that are created by the following method on OpenVSwitch: 


ovs-vsctl add-br br1

sudo /usr/sbin/tunctl -t tap01 -p -u root

sudo /sbin/ip link set tap01 up

# Disable multicast
sudo /sbin/ifconfig tap01 -multicast

ovs-vsctl add-port br1 tap01


Aside from the part about disabling multicast, this is all handled (including creation of the tap device, and destroying it when the guest is terminated) by libvirt's <interface type='bridge'> with a <virtualport type='openvswitch'> subelement. This page has more details and an example:

  http://www.libvirt.org/formatdomain.html#elementsNICSBridge

As far as turning off multicast, this is the first time I've seen anyone request that. Unfortunately the network hooks (https://www.libvirt.org/hooks.html ) that are run for each interface happen prior to the creation of the tap devices, so you can't just add a network hook script to do it. If you *really* need multicast disabled, with current libvirt you would need to add a *qemu* hook script that looked for the tap device name in the guest's xml and set -multicast, or you would need to use "<interface type='ethernet'> (which just creates a tap device, then calls a script to "connect it to the network") with a "<script path='some script that sets -multicast *and* adds the tap to the ovs bridge'/>". type='ethernet' and its script are also described a bit further down in the same link I posted above.








I need to launch a qemu VMs and have its NIC card that is created using libvirt  to be connected to tap01 or other taps that are created with the above method. 

I need a way that libvirt only creates the new NIC on either eth0 or eht1 on the guest machine and connect it to tap01.

Please help me in the best way to do so whether using the C++ APIs that libvirt provides or use the domain and/or network XMLs to achieve this.


Thanks a lot
Marina





_______________________________________________
libvirt-users mailing list
libvirt-users@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvirt-users


_______________________________________________
libvirt-users mailing list
libvirt-users@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvirt-users

[Index of Archives]     [Virt Tools]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]

  Powered by Linux