[PATCH v2 09/21] conf: Split out logic to determine whether cpupin was provided

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

 



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

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