Add virDomainNumaGetNodeCpumask() and refactor a few places that would
get the cpu mask without the helper.
---
src/conf/numa_conf.c | 12 ++++++++++--
src/conf/numa_conf.h | 2 ++
src/libvirt_private.syms | 1 +
src/qemu/qemu_command.c | 2 +-
4 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c
index 61dfea0..acda415 100644
--- a/src/conf/numa_conf.c
+++ b/src/conf/numa_conf.c
@@ -771,7 +771,7 @@ virDomainNumaDefCPUFormat(virBufferPtr buf,
for (i = 0; i < ncells; i++) {
memAccess = def->cells[i].memAccess;
- if (!(cpustr = virBitmapFormat(def->cells[i].cpumask)))
+ if (!(cpustr = virBitmapFormat(virDomainNumaGetNodeCpumask(def, i))))
return -1;
virBufferAddLit(buf, "<cell");
@@ -799,7 +799,7 @@ virDomainNumaGetCPUCountTotal(virCPUDefPtr numa)
unsigned int ret = 0;
for (i = 0; i < numa->ncells; i++)
- ret += virBitmapCountBits(numa->cells[i].cpumask);
+ ret += virBitmapCountBits(virDomainNumaGetNodeCpumask(numa, i));
return ret;
}
@@ -824,3 +824,11 @@ virDomainNumaGetNodeCount(virCPUDefPtr numa)
return numa->ncells;
}
+
+
+virBitmapPtr
+virDomainNumaGetNodeCpumask(virCPUDefPtr numa,
+ size_t node)
+{
+ return numa->cells[node].cpumask;
+}
diff --git a/src/conf/numa_conf.h b/src/conf/numa_conf.h
index 55a9fbe..ab88ab7 100644
--- a/src/conf/numa_conf.h
+++ b/src/conf/numa_conf.h
@@ -87,6 +87,8 @@ int virDomainNumatuneMaybeGetNodeset(virDomainNumaPtr numatune,
int cellid);
size_t virDomainNumaGetNodeCount(virCPUDefPtr numa);
+virBitmapPtr virDomainNumaGetNodeCpumask(virCPUDefPtr numa,
+ size_t node);
/*
* Formatters
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 4ba5fd0..770803b 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -630,6 +630,7 @@ virNodeDeviceObjUnlock;
virDomainNumaEquals;
virDomainNumaFree;
virDomainNumaGetNodeCount;
+virDomainNumaGetNodeCpumask;
virDomainNumaNew;
virDomainNumatuneFormatNodeset;
virDomainNumatuneFormatXML;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index f009570..d276da3 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -7196,7 +7196,7 @@ qemuBuildNumaArgStr(virQEMUDriverConfigPtr cfg,
for (i = 0; i < ncells; i++) {
VIR_FREE(cpumask);
- if (!(cpumask = virBitmapFormat(def->cpu->cells[i].cpumask)))
+ if (!(cpumask = virBitmapFormat(virDomainNumaGetNodeCpumask(def->cpu, i))))
goto cleanup;
if (strchr(cpumask, ',') &&
--
2.2.2