On Wed, Dec 11, 2013 at 10:16:37AM +0100, Michal Privoznik wrote:
This function barely wraps ncf_if_status() and error handling code.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/interface/interface_backend_netcf.c | 57 +++++++++++++++++++--------------
1 file changed, 33 insertions(+), 24 deletions(-)
diff --git a/src/interface/interface_backend_netcf.c
b/src/interface/interface_backend_netcf.c
index c4e18c4..2e681ec 100644
--- a/src/interface/interface_backend_netcf.c
+++ b/src/interface/interface_backend_netcf.c
@@ -238,6 +238,32 @@ static struct netcf_if *interfaceDriverGetNetcfIF(struct netcf *ncf,
virInterfac
return iface;
}
+static int
+netcfInterfaceObjIsActive(struct netcf_if *iface,
+ bool *active)
+{
+ int ret = -1;
+ unsigned int flags = 0;
+
+ virObjectRef(driverState);
What's the ref / unref of driverState for ? The code you're
replacing doesn't do that, and AFAICT this shouldn't be
required since we're always calling this from public API
context
+ if (ncf_if_status(iface, &flags) < 0) {
+ const char *errmsg, *details;
+ int errcode = ncf_error(driverState->netcf, &errmsg, &details);
+ virReportError(netcf_to_vir_err(errcode),
+ _("failed to get status of interface %s: %s%s%s"),
+ ncf_if_name(iface), errmsg, details ? " - " :
"",
+ details ? details : "");
+ goto cleanup;
+ }
+
+ *active = flags & NETCF_IFACE_ACTIVE;
+ ret = 0;
+
+cleanup:
+ virObjectUnref(driverState);
+ return ret;
+}
+
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 :|