[PATCH 0/2] Include lease time option into DHCP settings

Daniel P. Berrangé berrange at redhat.com
Fri Apr 17 16:00:24 UTC 2020

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="" netmask="">
      <range start="" end="" 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"/>


  <ip address="" netmask="">
      <range start="" end="" 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"/>


  <ip address="" netmask="">
      <range start="" end="">
         <lease expiry="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 expiry="30" units="mins"/>

In all of these we can default to "minutes" if no units are given.

|: 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 :|

More information about the libvir-list mailing list