On Wed, Apr 15, 2020 at 01:25:37PM -0300, Julio Faracco wrote:
I resubmitted this series because our team needs to hack dnsmasq
settings to change lease time. This feature would be so important to
us to avoid workarounds.
It is based on Alberto's patch from 2017. But personally I don't like
this approach.
IMHO, it would be nice to have specific attributes to configure lease time.
For example:
<range ... leasetime="10m"/>
<host ... leasetime="20m"/>
It is generally considered bad practice to have an XML attribute
value which then has to be parsed again to extract information.
For this reason, libvirt will use two attrbutes, one of the
value and one for the units (with some sensible default
units if not specified), even though this is admittedly
more verbose.
I agree it would be useful to have lease time per-host, as well
as globally though, and IIRC one of the original versions of
this patch did support that.
We could do one of
<ip address="192.168.122.1" netmask="255.255.255.0">
<dhcp>
<range start="192.168.122.2" end="192.168.122.254"
lease="12" units="hours"/>
<host id="0:1:0:1:18:aa:62:fe:0:16:3e:44:55:66"
ip="2001:db8:ca2:2:3::2" lease="30" units="mins"/>
</dhcp>
</ip>
or
<ip address="192.168.122.1" netmask="255.255.255.0">
<dhcp>
<range start="192.168.122.2" end="192.168.122.254"
leasetime="12" leaseunits="hours"/>
<host id="0:1:0:1:18:aa:62:fe:0:16:3e:44:55:66"
ip="2001:db8:ca2:2:3::2" leasetime="30"
leaseunits="mins"/>
</dhcp>
</ip>
or
<ip address="192.168.122.1" netmask="255.255.255.0">
<dhcp>
<range start="192.168.122.2" end="192.168.122.254">
<lease expiry="12" units="hours"/>
</range>
<host id="0:1:0:1:18:aa:62:fe:0:16:3e:44:55:66"
ip="2001:db8:ca2:2:3::2">
<lease expiry="30" units="mins"/>
</host>
</dhcp>
</ip>
In all of these we can default to "minutes" if no units are given.
Regards,
Daniel
--
|:
https://berrange.com -o-
https://www.flickr.com/photos/dberrange :|
|:
https://libvirt.org -o-
https://fstop138.berrange.com :|
|:
https://entangle-photo.org -o-
https://www.instagram.com/dberrange :|