xcat-core
xcat-core copied to clipboard
Create macvtap VM nics
Normally, only bridge devices can be created with xCAT, but libvirt allows macvtap devices to be created out-of-the-box. Compared to a normal bridge, the network configuration of a macvtap device is much more streamlined and performant.
The modification includes
This PR add the possibility to add a |direct suffix to the vm.nics attribute.
This will create the following XML (2nd interface). First interface virbr0 is just for reference.
[root@obi-xcat ~]# lsdef login5 -i vmnics
Object name: login5
vmnics=virbr0,eno1|direct
[root@obi-xcat ~]# mkvm login5
[root@obi-xcat ~]# virsh dumpxml login5 | grep -m 1 -A 11 interface
<interface type='bridge'>
<mac address='42:a2:c0:a8:64:05'/>
<source bridge='virbr0'/>
<model type='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
<interface type='direct'>
<mac address='42:5e:c0:a8:64:05'/>
<source dev='eno1' mode='bridge'/>
<model type='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</interface>
Once started a macvtap device is created automatically.
36: macvtap0@eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 500
link/ether 42:5e:c0:a8:64:05 brd ff:ff:ff:ff:ff:ff
inet6 fe80::405e:c0ff:fea8:6405/64 scope link
valid_lft forever preferred_lft forever
Notes
- I could not fully test the VM cloning feature. Please verify it's still working as expected.
References
- libvirt documentation https://libvirt.org/formatdomain.html#elementsNICSDirect
- macvtap host communication https://wiki.libvirt.org/page/TroubleshootMacvtapHostFail