[libvirt PATCH v3 05/13] ch_driver: domainGetVcpuPinInfo and nodeGetCPUMap

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

 



From: Vineeth Pillai <viremana@xxxxxxxxxxxxxxxxxxx>

Add domainGetVcpuPinInfo and nodeGetCPUMap callbacks to ch driver

Signed-off-by: Vineeth Pillai <viremana@xxxxxxxxxxxxxxxxxxx>
Signed-off-by: Praveen K Paladugu <prapal@xxxxxxxxxxxxxxxxxxx>
---
 src/ch/ch_domain.h | 10 +++++++--
 src/ch/ch_driver.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 59 insertions(+), 2 deletions(-)

diff --git a/src/ch/ch_domain.h b/src/ch/ch_domain.h
index 1ec7643216..c36405808b 100644
--- a/src/ch/ch_domain.h
+++ b/src/ch/ch_domain.h
@@ -23,6 +23,7 @@
 #include "ch_conf.h"
 #include "ch_monitor.h"
 #include "virchrdev.h"
+#include "vircgroup.h"
 
 /* Give up waiting for mutex after 30 seconds */
 #define CH_JOB_WAIT_TIME (1000ull * 30)
@@ -52,9 +53,14 @@ typedef struct _virCHDomainObjPrivate virCHDomainObjPrivate;
 struct _virCHDomainObjPrivate {
     struct virCHDomainJobObj job;
 
+    virChrdevs *chrdevs;
+    virCgroup *cgroup;
+    virCHDriver *driver;
     virCHMonitor *monitor;
-
-     virChrdevs *chrdevs;
+    char *machineName;
+    virBitmap *autoNodeset;
+    virBitmap *autoCpuset;
+    virChrdevs *devs;
 };
 
 #define CH_DOMAIN_PRIVATE(vm) \
diff --git a/src/ch/ch_driver.c b/src/ch/ch_driver.c
index 31e9de7f6a..ad7383e96e 100644
--- a/src/ch/ch_driver.c
+++ b/src/ch/ch_driver.c
@@ -981,6 +981,55 @@ chDomainGetMaxVcpus(virDomainPtr dom)
                                   VIR_DOMAIN_VCPU_MAXIMUM));
 }
 
+static int
+chDomainGetVcpuPinInfo(virDomain *dom,
+                       int ncpumaps,
+                       unsigned char *cpumaps, int maplen, unsigned int flags)
+{
+    virDomainObj *vm = NULL;
+    virDomainDef *def;
+    bool live;
+    int ret = -1;
+
+    g_autoptr(virBitmap) hostcpus = NULL;
+    virBitmap *autoCpuset = NULL;
+
+    virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG, -1);
+
+    if (!(vm = chDomObjFromDomain(dom)))
+        goto cleanup;
+
+    if (virDomainGetVcpuPinInfoEnsureACL(dom->conn, vm->def) < 0)
+        goto cleanup;
+
+    if (!(def = virDomainObjGetOneDefState(vm, flags, &live)))
+        goto cleanup;
+
+    if (!(hostcpus = virHostCPUGetAvailableCPUsBitmap()))
+        goto cleanup;
+
+    if (live)
+        autoCpuset = CH_DOMAIN_PRIVATE(vm)->autoCpuset;
+
+    ret = virDomainDefGetVcpuPinInfoHelper(def, maplen, ncpumaps, cpumaps,
+                                           hostcpus, autoCpuset);
+ cleanup:
+    virDomainObjEndAPI(&vm);
+    return ret;
+}
+
+static int
+chNodeGetCPUMap(virConnectPtr conn,
+                unsigned char **cpumap,
+                unsigned int *online, unsigned int flags)
+{
+    if (virNodeGetCPUMapEnsureACL(conn) < 0)
+        return -1;
+
+    return virHostCPUGetMap(cpumap, online, flags);
+}
+
+
 static int
 chDomainHelperGetVcpus(virDomainObj *vm,
                        virVcpuInfoPtr info,
@@ -1112,6 +1161,8 @@ static virHypervisorDriver chHypervisorDriver = {
     .domainGetVcpus = chDomainGetVcpus,                     /* 8.0.0 */
     .domainGetVcpusFlags = chDomainGetVcpusFlags,           /* 8.0.0 */
     .domainGetMaxVcpus = chDomainGetMaxVcpus,               /* 8.0.0 */
+    .domainGetVcpuPinInfo = chDomainGetVcpuPinInfo,         /* 8.0.0 */
+    .nodeGetCPUMap = chNodeGetCPUMap,                       /* 8.0.0 */
 };
 
 static virConnectDriver chConnectDriver = {
-- 
2.27.0





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

  Powered by Linux