[PATCHv2 3/3] bhyve: connectCompareCPU support

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

 



Implement support for connectCompareCPU.
---
 src/bhyve/bhyve_driver.c | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c
index 728ab2b..34ca924 100644
--- a/src/bhyve/bhyve_driver.c
+++ b/src/bhyve/bhyve_driver.c
@@ -1011,6 +1011,36 @@ bhyveConnectBaselineCPU(virConnectPtr conn ATTRIBUTE_UNUSED,
     return cpu;
 }
 
+static int
+bhyveConnectCompareCPU(virConnectPtr conn,
+                       const char *xmlDesc,
+                       unsigned int flags)
+{
+    bhyveConnPtr driver = conn->privateData;
+    int ret = VIR_CPU_COMPARE_ERROR;
+    virCapsPtr caps = NULL;
+
+    virCheckFlags(0, VIR_CPU_COMPARE_ERROR);
+
+    if (virConnectCompareCPUEnsureACL(conn) < 0)
+        goto cleanup;
+
+    if (!(caps = bhyveDriverGetCapabilities(driver)))
+        goto cleanup;
+
+    if (!caps->host.cpu ||
+        !caps->host.cpu->model) {
+        VIR_WARN("cannot get host CPU capabilities");
+        ret = VIR_CPU_COMPARE_INCOMPATIBLE;
+    } else {
+        ret = cpuCompareXML(caps->host.cpu, xmlDesc);
+    }
+
+ cleanup:
+    virObjectUnref(caps);
+    return ret;
+}
+
 static virDriver bhyveDriver = {
     .no = VIR_DRV_BHYVE,
     .name = "bhyve",
@@ -1049,6 +1079,7 @@ static virDriver bhyveDriver = {
     .nodeGetMemoryParameters = bhyveNodeGetMemoryParameters, /* 1.2.3 */
     .nodeSetMemoryParameters = bhyveNodeSetMemoryParameters, /* 1.2.3 */
     .connectBaselineCPU = bhyveConnectBaselineCPU, /* 1.2.4 */
+    .connectCompareCPU = bhyveConnectCompareCPU, /* 1.2.4 */
 };
 
 
-- 
1.9.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]