[libvirt] [PATCH v3] leaseshelper: improvements to support all events

Roman Bogorodskiy bogorodskiy at gmail.com
Wed Aug 20 10:53:05 UTC 2014


  Nehal J Wani wrote:

> This patch enables the helper program to detect event(s) triggered when there
> is a change in lease length or expiry and client-id. This transfers complete
> control of leases database to libvirt and obsoletes use of the lease database
> file (<network-name>.leases). That file will not be created, read, or written.
> This is achieved by adding the option --leasefile-ro to dnsmasq and passing a
> custom env var to leaseshelper, which helps us map events related to leases
> with their corresponding network bridges, no matter what the event be.
> 
> Also, this requires the addition of a new non-lease entry in our custom lease
> database: "server-duid". It is required to identify a DHCPv6 server.
> 
> Now that dnsmasq doesn't maintain its own leases database, it relies on our
> helper program to tell it about previous leases and server duid. Thus, this
> patch makes our leases program honor an extra action: "init", in which it sends
> the known info in a particular format to dnsmasq by printing it to stdout.
> 
> ---
>  
>  This is compatible with libvirt 1.2.6 as only additions have been
>  introduced, and the old leases file (*.status) will still be supported.
>  
>  v3: * Add server-duid as an entry in the lease object for every ipv6 lease.
>      * Remove unnecessary variables and double copies.
>      * Take value from DNSMASQ_OLD_HOSTNAME if hostname is not known.
> 
>  v2: http://www.redhat.com/archives/libvir-list/2014-July/msg01109.html
> 
>  v1: https://www.redhat.com/archives/libvir-list/2014-July/msg00568.html
>

JFI: I did a basic testing and it's working fine for me so far.

> diff --git a/src/network/leaseshelper.c b/src/network/leaseshelper.c
> index c8543a2..e984cbb 100644
> --- a/src/network/leaseshelper.c
> +++ b/src/network/leaseshelper.c


> @@ -176,6 +188,10 @@ main(int argc, char **argv)
>      if (argc == 5)
>          hostname = argv[4];
>  
> +    /* In case hostname is still unkown, use the last known one */

s/unkown/unknown/

> +    if (!hostname)
> +        hostname = virGetEnvAllowSUID("DNSMASQ_OLD_HOSTNAME");
> +

Roman Bogorodskiy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140820/1eca5457/attachment-0001.sig>


More information about the libvir-list mailing list