Re: [libvirt PATCH 06/13] ch_driver: domainGetVcpuPinInfo and nodeGetCPUMap

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

 





On 10/21/21 16:31, Vineeth Pillai wrote:
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 | 12 +++++++++--
  src/ch/ch_driver.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++
  2 files changed, 64 insertions(+), 2 deletions(-)

diff --git a/src/ch/ch_domain.h b/src/ch/ch_domain.h
index d9c9d34a19..e35777a9ec 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,16 @@ typedef struct _virCHDomainObjPrivate virCHDomainObjPrivate;
  struct _virCHDomainObjPrivate {
      struct virCHDomainJobObj job;
- virCHMonitor *monitor;
+    virChrdevs *chrdevs;
+
+    virCgroup *cgroup;
- virChrdevs *chrdevs;
+    virCHDriver *driver;
+    virCHMonitor *monitor;
+    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 8ea5ce393d..62ca6c1994 100644
--- a/src/ch/ch_driver.c
+++ b/src/ch/ch_driver.c
@@ -990,6 +990,58 @@ chDomainGetMaxVcpus(virDomainPtr dom)
      return chDomainGetVcpusFlags(dom, (VIR_DOMAIN_AFFECT_LIVE | 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:

Wrong label indentation. LGTM otherwise.


Daniel

+        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,
@@ -1126,6 +1178,8 @@ static virHypervisorDriver chHypervisorDriver = {
      .domainGetVcpus = chDomainGetVcpus,                     /* 7.9.0 */
      .domainGetVcpusFlags = chDomainGetVcpusFlags,           /* 7.9.0 */
      .domainGetMaxVcpus = chDomainGetMaxVcpus,               /* 7.9.0 */
+    .domainGetVcpuPinInfo = chDomainGetVcpuPinInfo,         /* 7.9.0 */
+    .nodeGetCPUMap = chNodeGetCPUMap,                       /* 7.9.0 */
  };
static virConnectDriver chConnectDriver = {





[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