[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH v2 8/9] Implement cpuBaseline in remote and qemu drivers



Signed-off-by: Jiri Denemark <jdenemar redhat com>
---
 src/qemu/qemu_driver.c     |   15 ++++++++++++++-
 src/remote/remote_driver.c |   33 ++++++++++++++++++++++++++++++++-
 2 files changed, 46 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index e053be8..2a07a30 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -8499,6 +8499,19 @@ qemuCPUCompare(virConnectPtr conn,
     return ret;
 }
 
+static char *
+qemuCPUBaseline(virConnectPtr conn ATTRIBUTE_UNUSED,
+                const char **xmlCPUs,
+                unsigned int ncpus,
+                unsigned int flags ATTRIBUTE_UNUSED)
+{
+    char *cpu;
+
+    cpu = cpuBaselineXML(xmlCPUs, ncpus, NULL, 0);
+
+    return cpu;
+}
+
 static virDriver qemuDriver = {
     VIR_DRV_QEMU,
     "QEMU",
@@ -8577,7 +8590,7 @@ static virDriver qemuDriver = {
     qemuDomainIsActive,
     qemuDomainIsPersistent,
     qemuCPUCompare, /* cpuCompare */
-    NULL, /* cpuBaseline */
+    qemuCPUBaseline, /* cpuBaseline */
 };
 
 
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 05dea04..5dda414 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -7587,6 +7587,37 @@ done:
     return rv;
 }
 
+
+static char *
+remoteCPUBaseline(virConnectPtr conn,
+                  const char **xmlCPUs,
+                  unsigned int ncpus,
+                  unsigned int flags)
+{
+    struct private_data *priv = conn->privateData;
+    remote_cpu_baseline_args args;
+    remote_cpu_baseline_ret ret;
+    char *cpu = NULL;
+
+    remoteDriverLock(priv);
+
+    args.xmlCPUs.xmlCPUs_len = ncpus;
+    args.xmlCPUs.xmlCPUs_val = (char **) xmlCPUs;
+    args.flags = flags;
+
+    memset(&ret, 0, sizeof (ret));
+    if (call(conn, priv, 0, REMOTE_PROC_CPU_BASELINE,
+             (xdrproc_t) xdr_remote_cpu_baseline_args, (char *) &args,
+             (xdrproc_t) xdr_remote_cpu_baseline_ret, (char *) &ret) == -1)
+        goto done;
+
+    cpu = ret.cpu;
+
+done:
+    remoteDriverUnlock(priv);
+    return cpu;
+}
+
 /*----------------------------------------------------------------------*/
 
 
@@ -8977,7 +9008,7 @@ static virDriver remote_driver = {
     remoteDomainIsActive, /* domainIsActive */
     remoteDomainIsPersistent, /* domainIsPersistent */
     remoteCPUCompare, /* cpuCompare */
-    NULL, /* cpuBaseline */
+    remoteCPUBaseline, /* cpuBaseline */
 };
 
 static virNetworkDriver network_driver = {
-- 
1.6.6.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]