aboutsummaryrefslogtreecommitdiff
path: root/daemon
diff options
context:
space:
mode:
authorTang Chen <tangchen@cn.fujitsu.com>2012-08-21 17:18:38 +0800
committerDaniel Veillard <veillard@redhat.com>2012-08-22 16:32:26 +0800
commitca5c99aecbecc832ed1a5bc630c7a3b8e13f4344 (patch)
treeffcd7948d85c7c58ccede50f3a1f3ada2c424926 /daemon
parentqemu: support emulator pinning (diff)
downloadlibvirt-ca5c99aecbecc832ed1a5bc630c7a3b8e13f4344.tar.gz
libvirt-ca5c99aecbecc832ed1a5bc630c7a3b8e13f4344.tar.bz2
libvirt-ca5c99aecbecc832ed1a5bc630c7a3b8e13f4344.zip
remote: introduce emulator pinning RPCs
Introduce 2 APIs to support emulator threads in remote driver. 1) remoteDomainPinEmulator: call driver api, such as qemudDomainPinEmulator. 2) remoteDomainGetEmulatorPinInfo: call driver api, such as qemudDomainGetEmulatorPinInfo. They are similar to remoteDomainPinVcpuFlags and remoteDomainGetVcpuPinInfo. Signed-off-by: Tang Chen <tangchen@cn.fujitsu.com> Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Diffstat (limited to 'daemon')
-rw-r--r--daemon/remote.c91
1 files changed, 91 insertions, 0 deletions
diff --git a/daemon/remote.c b/daemon/remote.c
index f82af86bf..24928f49a 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -1593,6 +1593,97 @@ no_memory:
}
static int
+remoteDispatchDomainPinEmulator(virNetServerPtr server ATTRIBUTE_UNUSED,
+ virNetServerClientPtr client,
+ virNetMessagePtr msg ATTRIBUTE_UNUSED,
+ virNetMessageErrorPtr rerr,
+ remote_domain_pin_emulator_args *args)
+{
+ int rv = -1;
+ virDomainPtr dom = NULL;
+ struct daemonClientPrivate *priv =
+ virNetServerClientGetPrivateData(client);
+
+ if (!priv->conn) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ goto cleanup;
+ }
+
+ if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
+ goto cleanup;
+
+ if (virDomainPinEmulator(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
+remoteDispatchDomainGetEmulatorPinInfo(virNetServerPtr server ATTRIBUTE_UNUSED,
+ virNetServerClientPtr client ATTRIBUTE_UNUSED,
+ virNetMessagePtr msg ATTRIBUTE_UNUSED,
+ virNetMessageErrorPtr rerr,
+ remote_domain_get_emulator_pin_info_args *args,
+ remote_domain_get_emulator_pin_info_ret *ret)
+{
+ virDomainPtr dom = NULL;
+ unsigned char *cpumaps = NULL;
+ int r;
+ int rv = -1;
+ struct daemonClientPrivate *priv =
+ virNetServerClientGetPrivateData(client);
+
+ if (!priv->conn) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not open"));
+ goto cleanup;
+ }
+
+ if (!(dom = get_nonnull_domain(priv->conn, args->dom)))
+ goto cleanup;
+
+ /* Allocate buffers to take the results */
+ if (args->maplen > 0 &&
+ VIR_ALLOC_N(cpumaps, args->maplen) < 0)
+ goto no_memory;
+
+ if ((r = virDomainGetEmulatorPinInfo(dom,
+ cpumaps,
+ args->maplen,
+ args->flags)) < 0)
+ goto cleanup;
+
+ ret->ret = r;
+ 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,