Add a helper function to do the checking. The check is used when
determining whether the <cputune> element should be formatted.
---
Notes:
v2:
- renamed func
- used different variable to decide (not that it would matter)
src/conf/domain_conf.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index e06ec80..3dc5e00 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -1413,6 +1413,19 @@ virDomainDefGetVcpu(virDomainDefPtr def,
}
+/**
+ * virDomainDefHasVcpuPin:
+ * @def: domain definition
+ *
+ * This helper returns true if any of the domain's vcpus has cpu pinning set
+ */
+static bool
+virDomainDefHasVcpuPin(const virDomainDef *def)
+{
+ return !!def->cputune.vcpupin;
+}
+
+
virDomainDiskDefPtr
virDomainDiskDefNew(virDomainXMLOptionPtr xmlopt)
{
@@ -15319,7 +15332,7 @@ virDomainDefParseXML(xmlDocPtr xml,
goto error;
if (virDomainNumatuneHasPlacementAuto(def->numa) &&
- !def->cpumask && !def->cputune.vcpupin &&
+ !def->cpumask && !virDomainDefHasVcpuPin(def) &&
!def->cputune.emulatorpin &&
!virDomainIOThreadIDArrayHasPin(def))
def->placement_mode = VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO;
--
2.6.2