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.
This commit is contained in:
Peter Krempa
2012-05-20 16:26:36 +02:00
parent bd34cc8c45
commit 9c9de4e64d
4 changed files with 142 additions and 1 deletions

View File

@@ -995,6 +995,60 @@ no_memory:
goto cleanup;
}
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,