Re: [libvirt] [PATCH] Implement forgotten backend of virInterfaceIsActive()

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

 



On Tue, Apr 13, 2010 at 01:26:00PM -0400, Laine Stump wrote:
> Somehow the backend of this function was never implemented in
> libvirt's netcf driver, and nobody noticed until now. (The required
> netcf function was already in place, so nothing needs to change
> there.)
> ---
>  src/interface/netcf_driver.c |   31 ++++++++++++++++++++++++++++++-
>  1 files changed, 30 insertions(+), 1 deletions(-)
> 
> diff --git a/src/interface/netcf_driver.c b/src/interface/netcf_driver.c
> index 708f1f8..7163066 100644
> --- a/src/interface/netcf_driver.c
> +++ b/src/interface/netcf_driver.c
> @@ -511,6 +511,35 @@ cleanup:
>      return ret;
>  }
>  
> +static int interfaceIsActive(virInterfacePtr ifinfo)
> +{
> +    struct interface_driver *driver = ifinfo->conn->interfacePrivateData;
> +    struct netcf_if *iface = NULL;
> +    unsigned int flags = 0;
> +
> +    interfaceDriverLock(driver);
> +
> +    iface = interfaceDriverGetNetcfIF(driver->netcf, ifinfo);
> +    if (!iface) {
> +        /* helper already reported error */
> +        goto cleanup;
> +    }
> +
> +    if (ncf_if_status(iface, &flags) < 0) {
> +        const char *errmsg, *details;
> +        int errcode = ncf_error(driver->netcf, &errmsg, &details);
> +        interfaceReportError(netcf_to_vir_err(errcode),
> +                             "failed to get status of interface %s (netcf: %s - %s)",
> +                             ifinfo->name, errmsg, details ? details : "");
> +        goto cleanup;
> +    }
> +
> +cleanup:
> +    ncf_if_free(iface);
> +    interfaceDriverUnlock(driver);
> +    return flags & NETCF_IFACE_ACTIVE ? 1 : 0;
> +}
> +
>  static virInterfaceDriver interfaceDriver = {
>      "Interface",
>      interfaceOpenInterface,          /* open */
> @@ -526,7 +555,7 @@ static virInterfaceDriver interfaceDriver = {
>      interfaceUndefine,               /* interfaceUndefine */
>      interfaceCreate,                 /* interfaceCreate */
>      interfaceDestroy,                /* interfaceDestroy */
> -    NULL,                            /* interfaceIsActive */
> +    interfaceIsActive,               /* interfaceIsActive */
>  };
>  
>  int interfaceRegister(void) {

  Oops :-)

Looks fine, ACK

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel@xxxxxxxxxxxx  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

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