Signed-off-by: Tang Chen <tangchen(a)cn.fujitsu.com>
---
daemon/remote.c | 103 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 103 insertions(+), 0 deletions(-)
diff --git a/daemon/remote.c b/daemon/remote.c
index 16a8a05..524c4bf 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -1454,6 +1454,109 @@ no_memory:
}
static int
+remoteDispatchDomainPinHypervisorFlags(virNetServerPtr server ATTRIBUTE_UNUSED,
+ virNetServerClientPtr client,
+ virNetMessagePtr msg ATTRIBUTE_UNUSED,
+ virNetMessageErrorPtr rerr,
+ remote_domain_pin_hypervisor_flags_args *args)
+{
+ int rv = -1;
+ virDomainPtr dom = NULL;
+ struct daemonClientPrivate *priv =
+ virNetServerClientGetPrivateData(client);
+
+ if (!priv->conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
+
+ if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
+ goto cleanup;
+
+ if (virDomainPinHypervisorFlags(dom,
+ (unsigned char *) args->cpumap.cpumap_val,
+ args->cpumap.cpumap_len,
+ args->flags) < 0)
+ goto cleanup;
+
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ virNetMessageSaveError(rerr);
+ if (dom)
+ virDomainFree(dom);
+ return rv;
+}
+
+
+static int
+remoteDispatchDomainGetHypervisorPinInfo(virNetServerPtr server ATTRIBUTE_UNUSED,
+ virNetServerClientPtr client ATTRIBUTE_UNUSED,
+ virNetMessagePtr msg ATTRIBUTE_UNUSED,
+ virNetMessageErrorPtr rerr,
+ remote_domain_get_hypervisor_pin_info_args
*args,
+ remote_domain_get_hypervisor_pin_info_ret *ret)
+{
+ virDomainPtr dom = NULL;
+ unsigned char *cpumaps = NULL;
+ int num;
+ int rv = -1;
+ struct daemonClientPrivate *priv =
+ virNetServerClientGetPrivateData(client);
+
+ if (!priv->conn) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not
open"));
+ goto cleanup;
+ }
+
+ if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
+ goto cleanup;
+
+ /* There is only one cpumap struct for all hypervisor threads */
+ if (args->ncpumaps != 1) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("ncpumaps !=
1"));
+ goto cleanup;
+ }
+
+ if (INT_MULTIPLY_OVERFLOW(args->ncpumaps, args->maplen) ||
+ args->ncpumaps * args->maplen > REMOTE_CPUMAPS_MAX) {
+ virNetError(VIR_ERR_INTERNAL_ERROR, "%s", _("maxinfo * maplen >
REMOTE_CPUMAPS_MAX"));
+ goto cleanup;
+ }
+
+ /* Allocate buffers to take the results */
+ if (args->maplen > 0 &&
+ VIR_ALLOC_N(cpumaps, args->maplen) < 0)
+ goto no_memory;
+
+ if ((num = virDomainGetHypervisorPinInfo(dom,
+ cpumaps,
+ args->maplen,
+ args->flags)) < 0)
+ goto cleanup;
+
+ ret->num = num;
+ ret->cpumaps.cpumaps_len = args->maplen;
+ ret->cpumaps.cpumaps_val = (char *) cpumaps;
+ cpumaps = NULL;
+
+ rv = 0;
+
+cleanup:
+ if (rv < 0)
+ virNetMessageSaveError(rerr);
+ VIR_FREE(cpumaps);
+ if (dom)
+ virDomainFree(dom);
+ return rv;
+
+no_memory:
+ virReportOOMError();
+ goto cleanup;
+}
+
+static int
remoteDispatchDomainGetVcpus(virNetServerPtr server ATTRIBUTE_UNUSED,
virNetServerClientPtr client ATTRIBUTE_UNUSED,
virNetMessagePtr msg ATTRIBUTE_UNUSED,
--
1.7.3.1