Re: [RFC] net-dhcp-leases: Query: Reg: Leases API Script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/22/2013 04:15 PM, Daniel P. Berrange wrote:
> On Tue, Oct 22, 2013 at 04:15:37PM +0530, Nehal J Wani wrote:
>> Q1. The --dhcp-script option will require libvirt to provide a script
>> or executable file to be run. Now as the man page says, this file is
>> executed "Whenever a new DHCP  ease is created, or an old one
>> destroyed". Life was easy with the script, as it used the command sed
>> to remove the destroyed lease. eblake had suggested me to use a C
>> program instead. So I wanted to finalize whether to go with C or
>> continue with shell script.
> 
> Libvirt aims to avoid shell code whereever possible, since it is really
> a very bad language from terms of reliability and security. eg quoting
> rules are easy to get wrong, error handling is awful, portability is
> non-trivial.

For examples of writing a helper C program, see how src/util/iohelper.c
is compiled into libvirt_iohelper.

> 
>> Q2. The above executable file will be writing the custom formatted
>> lease parameters to a file "dnsmasq-ip-mac.status" (suggestion open
>> for name). This newly created/updated file will be parsed by the API.
>> We need to decide the format for the file. Do we continue with space
>> separated parameters as before?
> 
> Ideally do not invent any new format - use a format that we already
> have a parser for - eg the src/util/virconf.h or src/util/virkeyfile.h
> APIs for loading configs.

or XML, if the config file format is insufficient.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]