in libvirt usina QEMU/KVM?
The thing is that I created a bridge interface on the host and I connect my VMs to this bridge.
When it starts I have a vnet0 interface, when I restart it it becames vnet1 and so on
Simple hack: grep output of ip -o link and take everything that starts with vnet and not yet connected to the bridge.
Create a bridge yourself and point the VMs to that
Ip can format it output as JSON. Tools like jq can then used to extract the values by key.
Thank you!!! Less dirty hacks in my scripts I'll have :)
That's what I did, I have auto br0 iface br0 inet manual bridge_ports eth0 bridge_waitport 0 bridge_fd 0 in my /etc/network/interfaces and my VM points to it with this config generated by virt-install <interface type='bridge'> <mac address='redacted'/> <source bridge='br0'/> <model type='e1000'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </interface>
Обсуждают сегодня