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

[libvirt] [PATCH v3 05/13] Public API implementation



Signed-off-by: Jiri Denemark <jdenemar redhat com>
---
 src/libvirt.c |   41 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 41 insertions(+), 0 deletions(-)

diff --git a/src/libvirt.c b/src/libvirt.c
index 103b331..4d9cb33 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -10706,3 +10706,44 @@ error:
     virSetConnError(conn);
     return -1;
 }
+
+
+/**
+ * virConnectCompareCPU:
+ * @conn: virConnect connection
+ * @xml: XML describing the CPU to compare with host CPU
+ *
+ * Returns comparison result according to enum virCPUCompareResult
+ */
+int
+virConnectCompareCPU(virConnectPtr conn, const char *xmlDesc)
+{
+    VIR_DEBUG("conn=%p, xmlDesc=%s", conn, xmlDesc);
+
+    virResetLastError();
+
+    if (!VIR_IS_CONNECT(conn)) {
+        virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+        return VIR_CPU_COMPARE_ERROR;
+    }
+    if (xmlDesc == NULL) {
+        virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+        goto error;
+    }
+
+    if (conn->driver->cpuCompare) {
+        int ret;
+
+        ret = conn->driver->cpuCompare(conn, xmlDesc);
+        if (ret == VIR_CPU_COMPARE_ERROR)
+            goto error;
+        return ret;
+    }
+
+    virLibConnError(conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+
+error:
+    /* Copy to connection error object for back compatibility */
+    virSetConnError(conn);
+    return VIR_CPU_COMPARE_ERROR;
+}
-- 
1.6.5.6


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