[libvirt] Query: Implementation of virNetworkGetDHCPLeases
Daniel P. Berrange
berrange at redhat.com
Mon Jan 5 17:14:17 UTC 2015
On Mon, Jan 05, 2015 at 10:42:01PM +0530, Nehal J Wani wrote:
> In the method networkGetDHCPLeases inside
> ./src/network/bridge_driver.c , we have:
>
> if (need_results && mac && !leases_ret) {
> virReportError(VIR_ERR_INTERNAL_ERROR,
> _("no lease with matching MAC address: %s"), mac);
> goto error;
> }
>
> Is this really required? In my opinion, since we are already filling
> rv with nleases (which will be 0, in case no lease corresponding to
> given mac is found), user will know that there is no result for his
> query. Why to report error?
>
> This results in:
>
> virsh # net-dhcp-leases --mac 00:50:56:c0:00:01 default
> error: Failed to get leases info for default
> error: internal error: no lease with matching MAC address: 00:50:56:c0:00:01
Yeah, that error raising seems sub-optional to me. The lack of a lease
for a MAC address is not an error - it is an normal expected scenario.
Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
More information about the libvir-list
mailing list