aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--daemon/remote.c54
-rw-r--r--src/remote/remote_driver.c64
-rw-r--r--src/remote/remote_protocol.x13
-rw-r--r--src/remote_protocol-structs12
4 files changed, 142 insertions, 1 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,
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 178343e5e..6983f9526 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -1265,6 +1265,69 @@ done:
return rv;
}
+static int
+remoteConnectListAllDomains(virConnectPtr conn,
+ virDomainPtr **domains,
+ unsigned int flags)
+{
+ int rv = -1;
+ int i;
+ virDomainPtr *doms = NULL;
+ remote_connect_list_all_domains_args args;
+ remote_connect_list_all_domains_ret ret;
+
+ struct private_data *priv = conn->privateData;
+
+ remoteDriverLock(priv);
+
+ args.need_results = !!domains;
+ args.flags = flags;
+
+ memset(&ret, 0, sizeof(ret));
+ if (call(conn,
+ priv,
+ 0,
+ REMOTE_PROC_CONNECT_LIST_ALL_DOMAINS,
+ (xdrproc_t) xdr_remote_connect_list_all_domains_args,
+ (char *) &args,
+ (xdrproc_t) xdr_remote_connect_list_all_domains_ret,
+ (char *) &ret) == -1)
+ goto done;
+
+ if (domains) {
+ if (VIR_ALLOC_N(doms, ret.domains.domains_len + 1) < 0) {
+ virReportOOMError();
+ goto cleanup;
+ }
+
+ for (i = 0; i < ret.domains.domains_len; i++) {
+ doms[i] = get_nonnull_domain(conn, ret.domains.domains_val[i]);
+ if (!doms[i]) {
+ virReportOOMError();
+ goto cleanup;
+ }
+ }
+ *domains = doms;
+ doms = NULL;
+ }
+
+ rv = ret.ret;
+
+cleanup:
+ if (doms) {
+ for (i = 0; i < ret.domains.domains_len; i++)
+ if (doms[i])
+ virDomainFree(doms[i]);
+ VIR_FREE(doms);
+ }
+
+ xdr_free((xdrproc_t) xdr_remote_connect_list_all_domains_ret, (char *) &ret);
+
+done:
+ remoteDriverUnlock(priv);
+ return rv;
+}
+
/* Helper to free typed parameters. */
static void
remoteFreeTypedParameters(remote_typed_param *args_params_val,
@@ -4963,6 +5026,7 @@ static virDriver remote_driver = {
.getCapabilities = remoteGetCapabilities, /* 0.3.0 */
.listDomains = remoteListDomains, /* 0.3.0 */
.numOfDomains = remoteNumOfDomains, /* 0.3.0 */
+ .listAllDomains = remoteConnectListAllDomains, /* 0.9.13 */
.domainCreateXML = remoteDomainCreateXML, /* 0.3.0 */
.domainLookupByID = remoteDomainLookupByID, /* 0.3.0 */
.domainLookupByUUID = remoteDomainLookupByUUID, /* 0.3.0 */
diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x
index 793f29777..865cfe6dd 100644
--- a/src/remote/remote_protocol.x
+++ b/src/remote/remote_protocol.x
@@ -2481,6 +2481,16 @@ struct remote_domain_get_disk_errors_ret {
int nerrors;
};
+struct remote_connect_list_all_domains_args {
+ int need_results;
+ unsigned int flags;
+};
+
+struct remote_connect_list_all_domains_ret {
+ remote_nonnull_domain domains<>;
+ unsigned int ret;
+};
+
/*----- Protocol. -----*/
@@ -2803,7 +2813,8 @@ enum remote_procedure {
REMOTE_PROC_DOMAIN_EVENT_PMSUSPEND = 270, /* autogen autogen */
REMOTE_PROC_DOMAIN_SNAPSHOT_IS_CURRENT = 271, /* autogen autogen */
- REMOTE_PROC_DOMAIN_SNAPSHOT_HAS_METADATA = 272 /* autogen autogen */
+ REMOTE_PROC_DOMAIN_SNAPSHOT_HAS_METADATA = 272, /* autogen autogen */
+ REMOTE_PROC_CONNECT_LIST_ALL_DOMAINS = 273 /* skipgen skipgen priority:high */
/*
* Notice how the entries are grouped in sets of 10 ?
diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs
index 8e00b0ed3..63d70e026 100644
--- a/src/remote_protocol-structs
+++ b/src/remote_protocol-structs
@@ -1935,6 +1935,17 @@ struct remote_domain_get_disk_errors_ret {
} errors;
int nerrors;
};
+struct remote_connect_list_all_domains_args {
+ int need_results;
+ u_int flags;
+};
+struct remote_connect_list_all_domains_ret {
+ struct {
+ u_int domains_len;
+ remote_nonnull_domain * domains_val;
+ } domains;
+ u_int ret;
+};
enum remote_procedure {
REMOTE_PROC_OPEN = 1,
REMOTE_PROC_CLOSE = 2,
@@ -2208,4 +2219,5 @@ enum remote_procedure {
REMOTE_PROC_DOMAIN_EVENT_PMSUSPEND = 270,
REMOTE_PROC_DOMAIN_SNAPSHOT_IS_CURRENT = 271,
REMOTE_PROC_DOMAIN_SNAPSHOT_HAS_METADATA = 272,
+ REMOTE_PROC_CONNECT_LIST_ALL_DOMAINS = 273,
};