[libvirt] RFC: 'old' event for leaseshelper.c when lease renews

Nehal J Wani nehaljw.kkd1 at gmail.com
Tue Jul 1 19:17:34 UTC 2014

> I cleared some more queries regarding leasesfile-ro option. Once can
> read the conversation at
> http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/2014q2/008656.html.
> TL;DR:
> (i) We have to change the leasehelper program to honor the event
> 'init' and print leases info in dnsmasq leases format (so that dnsmasq
> knows about previous leases if it is restarted for some reason).

Bummer. When 'init' is sent to the leases helper program, the
interface name is not known :'( so the helper program doesn't know
which *.status file it has to read and print to stdout.

Simon came up with the following hack:
The most obvious nasty hack to make this work would be to have a set of
 filesystem links to the real lease-change script, each with a different
name, and configure each dnsmasq to call a unique link. The script then
checks argv[0] to find the name it was called by and then transforms
that into the name of the corresponding database file.

So we have something like

scripts/interface1 is a link to /lib/libvirt/lease-change-
scripts/interface2 is a link to /lib/libvirt/lease-change-script

and start dnsmasq with

dnsmasq --interface=interface1 --dhcp-script=scripts/interface1

and the script finds the basename of argv[0[:

scripts/interface1 -> interface1

and prepends the directory where  the lease files are

interface1 ->leasefiles/interface1

That works in the absence on the DNSMASQ_INTERFACE variable.

Is this hack acceptable?

Nehal J Wani

More information about the libvir-list mailing list