[libvirt] [PATCH v4] Add helper program to create custom leases

Nehal J Wani nehaljw.kkd1 at gmail.com
Fri Mar 21 06:12:20 UTC 2014


>> @@ -1120,6 +1135,10 @@ networkBuildDhcpDaemonCommandLine(virNetworkObjPtr network,
>>
>>      cmd = virCommandNew(dnsmasqCapsGetBinaryPath(caps));
>>      virCommandAddArgFormat(cmd, "--conf-file=%s", configfile);
>> +
>> +    /* This helper is used to create custom leases file for libvirt */
>> +    virCommandAddArgFormat(cmd, "--dhcp-script=%s", LIBEXECDIR "/libvirt_leaseshelper");
>
> This is a bit hard-coded, and won't play nicely with ./run.  Ideally, we
> should be constructing the name so that if argv[0] is an uninstalled
> in-tree binary, then we convert to a name relative to the build tree
> instead of LIBEXECDIR; that way, when using ./run, we test the
> just-built libvirt_leaseshelper instead of a pre-installed version.

I'm not very clear about how to go about this. I understand that we
want some magic to be set by ./run so that it understands where to
pick the binary from, (I always have to build libvirt with
--libexecdir=$PWD/src, since I never run make install) but what exact
changes do I have to make here? Could you please give an example?

>
>> +
>> +ATTRIBUTE_NORETURN static void
>> +usage(int status)
>> +{
>> +    if (status) {
>> +        fprintf(stderr, _("%s: try --help for more details\n"), program_name);
>> +    } else {
>> +        printf(_("Usage: %s ACTION MAC|CLIENTID IP HOSTNAME\n"
>> +                 "   or: %s ACTION MAC|CLIENTID IP\n"),
>
> Could be compressed to one line as "%s ACTION MAC|CLIENTID IP
> [HOSTNAME]".  Maybe worth listing the set of valid ACTION verbs.

Should I change this to:
printf(_("Usage: %s ACTION MAC|CLIENTID IP [HOSTNAME]\n")
and then display the meaning of 'ACTION' or simply do:
printf(_("Usage: %s add|old|del mac|clientid ip [hostname]\n")


-- 
Nehal J Wani




More information about the libvir-list mailing list