[libvirt] [PATCH] leaseshelper: add enhancements to support all events
Peter Krempa
pkrempa at redhat.com
Thu Jul 17 15:18:26 UTC 2014
On 07/16/14 17:31, Nehal J Wani wrote:
>>> cmd = virCommandNew(dnsmasqCapsGetBinaryPath(caps));
>>> virCommandAddArgFormat(cmd, "--conf-file=%s", configfile);
>>> - virCommandAddArgFormat(cmd, "--dhcp-script=%s", leaseshelper_path);
>>> + virCommandAddArgFormat(cmd, "--dhcp-script=%s", pseudo_leaseshelper_path);
>>> + virCommandAddArgFormat(cmd, "--leasefile-ro");
>>
>> Does dnsmasq pass through the rest of the environment we pass to it at
>> this point? The leaseshelper extracts quite a lot of stuff from the
>> environment variables that are passed by dnsmasq. In case it does we
>> could use an env variable to pass the interface name instead of linking
>> the helper and using different names.
>
> If I use the following line of code in the function
> networkBuildDhcpDaemonCommandLine ...
> setenv("VIR_BRIDGE_NAME", network->def->bridge, 1);
> .. then yes, the helper program invoked by dnsmasq does get to see
> this variable. (It does so in Fedora20). (Looks like I acted in haste,
> should've waited for more replies on RFC, sigh)
I wanted to reply to that but I was a bit busy and didn't manage to do
it soon enough.
We have wrappers for running a separate command with a env variable
virCommandAddEnv*... you can use easily for this.
>
> So, in the next version that I will send, should I first make a
> wrapper by the name virSetEnvBlockSUID for setenv, just like we have
> virGetEnvBlockSUID for getenv?
No, please use the API mentioned above
>
>> A second issue that comes into my mind is compatibility with already
>> existing files. Does this work when you already have a lease file? (I
>> didn't try it, I'm just asking).
>
> If we use the --leasefile-ro option, then although this method will
> work, but no, the lease file will *not* be read/written at all. So
> even if an old one exists, its of no use.
> But then again, the use of --leasefile-ro is mandatory, so that all
> events are captured by our helper program. For example, renew of a
> lease.
My concerns are whether this will work in the case you already used the
leases helper as the patch is adding a few fields to the stored format.
>
>
> Regards,
> Nehal J Wani
>
Peter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 884 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140717/e1d33065/attachment-0001.sig>
More information about the libvir-list
mailing list