hi,
assume i have multiple host systems which spin up virtual machines using
the vagrant/vagrant-libvirt provider. Both host systems have a defined
network (which has the same name on both hosts) which the first network
interface of the virtual machine is assigned to.
During boot of the virtual machine, the first network device is
configured via DHCP and vagrant uses the mac address table or libvirt
dhcp leases table to find out about the IP address that was assigned to
the virtual machine: From that point on, i can reach the virtual machine
locally on the host system.
This works nicely if the network is a libvirt NAT network, as the IP
addresses are unique on both host systems.
Now i want to change the situation and provide routed addresses, thus i
want to make sure that an IP that is assigned for a virtual machine on
host A is not re-used on host B to not have IP address conflicts.
What im searching for is the "libvirt" way to have a central lease file
between multiple hosts for the same network (without having another
layer like OVS/OVN).
What i guess would work is:
1) share /var/lib/libvirt/dnsmasq between both host systems, of course
means the virtual bridge for the network has to have the same
name on both systems.
2) replace /usr/libexec/libvirt_leaseshelper with my own version, that
stores the leases in an central place.
3) a way that exists and i dont know about?
Option 2) sounds the best for me, but i currently dont see a way to
specify the dhcp-script used for a network on libvirt side .. any
opinions on this?
Using libvirt 7.x and alike from the centos 8 advanced virtualization
stream.
thanks,
- michael