diff options
author | Peter Krempa <pkrempa@redhat.com> | 2012-05-20 16:26:36 +0200 |
---|---|---|
committer | Peter Krempa <pkrempa@redhat.com> | 2012-06-18 21:24:13 +0200 |
commit | 9c9de4e64d2cf1649ee498e3af2101d6e50cac77 (patch) | |
tree | 16f1c03e199ef4344bebdedd1e2a2a0859d8389f /daemon | |
parent | python: add API exports for virConnectListAllDomains() (diff) | |
download | libvirt-9c9de4e64d2cf1649ee498e3af2101d6e50cac77.tar.gz libvirt-9c9de4e64d2cf1649ee498e3af2101d6e50cac77.tar.bz2 libvirt-9c9de4e64d2cf1649ee498e3af2101d6e50cac77.zip |
remote: implement remote protocol for virConnectListAllDomains()
This patch wires up the RPC protocol handlers for
virConnectListAllDomains(). The RPC generator has no support for the way
how virConnectListAllDomains() returns the results so the handler code
had to be done manually.
The new api is handled by REMOTE_PROC_CONNECT_LIST_ALL_DOMAINS, with
number 273 and marked with high priority.
Diffstat (limited to 'daemon')
-rw-r--r-- | daemon/remote.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/daemon/remote.c b/daemon/remote.c index a02c09b29..ac0f06824 100644 --- a/daemon/remote.c +++ b/daemon/remote.c @@ -996,6 +996,60 @@ no_memory: } static int +remoteDispatchConnectListAllDomains(virNetServerPtr server ATTRIBUTE_UNUSED, + virNetServerClientPtr client, + virNetMessagePtr msg ATTRIBUTE_UNUSED, + virNetMessageErrorPtr rerr, + remote_connect_list_all_domains_args *args, + remote_connect_list_all_domains_ret *ret) +{ + virDomainPtr *doms = NULL; + int ndomains = 0; + int i; + int rv = -1; + struct daemonClientPrivate *priv = virNetServerClientGetPrivateData(client); + + if (!priv->conn) { + virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open")); + goto cleanup; + } + + if ((ndomains = virConnectListAllDomains(priv->conn, + args->need_results ? &doms : NULL, + args->flags)) < 0) + goto cleanup; + + if (doms && ndomains) { + if (VIR_ALLOC_N(ret->domains.domains_val, ndomains) < 0) { + virReportOOMError(); + goto cleanup; + } + + ret->domains.domains_len = ndomains; + + for (i = 0; i < ndomains; i++) + make_nonnull_domain(ret->domains.domains_val + i, doms[i]); + } else { + ret->domains.domains_len = 0; + ret->domains.domains_val = NULL; + } + + ret->ret = ndomains; + + rv = 0; + +cleanup: + if (rv < 0) + virNetMessageSaveError(rerr); + if (doms) { + for (i = 0; i < ndomains; i++) + virDomainFree(doms[i]); + VIR_FREE(doms); + } + return rv; +} + +static int remoteDispatchDomainGetSchedulerParametersFlags(virNetServerPtr server ATTRIBUTE_UNUSED, virNetServerClientPtr client ATTRIBUTE_UNUSED, virNetMessagePtr msg ATTRIBUTE_UNUSED, |