Re: [PATCHv3 1/4] net-dhcp-leases: Implement the public APIs

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

 



On Mon, Sep 16, 2013 at 3:22 PM, Daniel P. Berrange <berrange@xxxxxxxxxx> wrote:
>
> On Mon, Sep 16, 2013 at 11:19:13AM +0530, Nehal J Wani wrote:
> > +int
> > +virNetworkGetDHCPLeasesForMAC(virNetworkPtr network,
> > +                              const char *mac,
> > +                              virNetworkDHCPLeasesPtr **leases,
> > +                              unsigned int flags)
> > +{
> > +    virConnectPtr conn;
> > +    virMacAddr addr;
> > +
> > +    VIR_DEBUG("network=%p, mac=%s, leases=%p, flags=%x",
> > +               network, mac, leases, flags);
> > +
> > +    virResetLastError();
> > +
> > +    virCheckNonNullArgGoto(network, error);
> > +    virCheckNonNullArgGoto(mac, error);
> > +
> > +    if (leases)
> > +        *leases = NULL;
> > +
> > +    if (!VIR_IS_CONNECTED_NETWORK(network)) {
> > +        virLibNetworkError(VIR_ERR_INVALID_NETWORK, __FUNCTION__);
> > +        virDispatchError(NULL);
> > +        return -1;
> > +    }
> > +
> > +    /* Validate the MAC address */
> > +    if (mac && virMacAddrParse(mac, &addr) < 0) {
> > +        virReportInvalidArg(mac,
> > +                            _("Given MAC Address doesn't comply "
> > +                              "with the standard (IEEE 802) format in %s"),
> > +                            __FUNCTION__);
>
> Don't pass __FUNCTION__ in this error message - that is already done automatically
>
> > +        goto error;
> > +    }
>
> 'mac' should be a mandatory parameter here.

Attached diff should fix it.

But there are still calls to virReportInvalidArg() with __FUNCTION__
as one of its arguments in src/libvirt.c

>
> > +
> > +    conn = network->conn;
> > +
> > +    if (conn->networkDriver &&
> > +        conn->networkDriver->networkGetDHCPLeasesForMAC) {
> > +        int ret;
> > +        ret = conn->networkDriver->networkGetDHCPLeasesForMAC(network, mac,
> > +                                                              leases, flags);
> > +        if (ret < 0)
> > +            goto error;
> > +        return ret;
> > +    }
> > +
> > +    virLibConnError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
> > +
> > +error:
> > +    virDispatchError(network->conn);
> > +    return -1;
> > +}
>
> 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 :|




-- 
Nehal J Wani
UG3, BTech CS+MS(CL)
IIIT-Hyderabad
http://commandlinewani.blogspot.com

--
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]