lago
lago copied to clipboard
Enhancement: use static IP, not DHCP
Why are we using DHCP if we are setting the IP anyway? Why not just use static IP? Surely it'll make libvirt's network configuration smaller (and thus faster) and I expect the hosts to boot faster too).
Requires a small change in the mapping from mac:ip to mac:{ip,gw} (assuming the subnet is /24) and accordingly in the jinja template and then some code removal not to configure the libvirt's DHCP service.
(Not sure about IPv6, I assume need to be added somewhere too?)
AFAIK you will still need 'dnsmasq' to provide DNS, so the savings as far as runtime resources go will probably be negligible. And you will create a new problem of having to know how to inject a static IP address reliably for any kind of OS any Lago user may decide to boot up. Libgustfs makes this look easy, and cloud-init may also help, but the potential for issues is far bigger IMO then just supporting DHCP.
- I don't care much about any OS - as we could change EL to use it. The rest could continue to use DHCP - it's in the Jinja template, no? Note that as we are already writing the ifcfg file, it's a matter of writing it with static and not DHCP.
- Perhaps correct about setting the DNS - it may still take 5-6 secs still per network to come up, but I expect hosts to come up faster.
I can try running a simple test and look at 'systemd-analyze' output in the CI to see if that + 'lago start' time is better. If we agree this does improve boot up time - I suggest adding a 'static' network type, which will do what @mykaul suggested(allocate IPs & inject), and if we don't have a good way of injecting it to a specific distro, we can fail early on 'init'. The Jinja'ing part should be simple.