[PATCH v1 4/4] libxl: implement virConnectBaselineCPU

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

 



Akin to previous commit but for "virsh cpu-baseline" which
computes a baseline CPU for a set of host cpu elements.

Signed-off-by: Joao Martins <joao.m.martins@xxxxxxxxxx>
---
 src/libxl/libxl_driver.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 977e9b5..9f5d26c 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -60,6 +60,7 @@
 #include "network/bridge_driver.h"
 #include "locking/domain_lock.h"
 #include "virstats.h"
+#include "cpu/cpu.h"
 
 #define VIR_FROM_THIS VIR_FROM_LIBXL
 
@@ -5807,6 +5808,26 @@ libxlConnectCompareCPU(virConnectPtr conn,
     return ret;
 }
 
+static char *
+libxlConnectBaselineCPU(virConnectPtr conn,
+                        const char **xmlCPUs,
+                        unsigned int ncpus,
+                        unsigned int flags)
+{
+    char *cpu = NULL;
+
+    virCheckFlags(VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES |
+                  VIR_CONNECT_BASELINE_CPU_MIGRATABLE, NULL);
+
+    if (virConnectBaselineCPUEnsureACL(conn) < 0)
+        goto cleanup;
+
+    cpu = cpuBaselineXML(xmlCPUs, ncpus, NULL, 0, flags);
+
+ cleanup:
+    return cpu;
+}
+
 static virHypervisorDriver libxlHypervisorDriver = {
     .name = LIBXL_DRIVER_NAME,
     .connectOpen = libxlConnectOpen, /* 0.9.0 */
@@ -5910,6 +5931,7 @@ static virHypervisorDriver libxlHypervisorDriver = {
     .domainInterfaceAddresses = libxlDomainInterfaceAddresses, /* 1.3.5 */
     .connectGetDomainCapabilities = libxlConnectGetDomainCapabilities, /* 2.0.0 */
     .connectCompareCPU = libxlConnectCompareCPU, /* 2.1.0 */
+    .connectBaselineCPU = libxlConnectBaselineCPU, /* 2.1.0 */
 };
 
 static virConnectDriver libxlConnectDriver = {
-- 
2.1.4

--
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]