[PATCH 2/5] numa: Introduce virDomainNumaNodeDistanceSpecified

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

 



The function returns true/false depending on distance
configuration being present in the domain XML.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/conf/numa_conf.c     | 13 +++++++++++++
 src/conf/numa_conf.h     |  4 ++++
 src/libvirt_private.syms |  1 +
 3 files changed, 18 insertions(+)

diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c
index 5f0b3f9ed..6a42777e2 100644
--- a/src/conf/numa_conf.c
+++ b/src/conf/numa_conf.c
@@ -1137,6 +1137,19 @@ virDomainNumaSetNodeCount(virDomainNumaPtr numa, size_t nmem_nodes)
     return numa->nmem_nodes;
 }
 
+bool
+virDomainNumaNodeDistanceSpecified(virDomainNumaPtr numa,
+                                   size_t node,
+                                   size_t sibling)
+{
+    return node < numa->nmem_nodes &&
+        sibling < numa->nmem_nodes &&
+        numa->mem_nodes[node].distances &&
+        numa->mem_nodes[node].distances[sibling].value != LOCAL_DISTANCE &&
+        numa->mem_nodes[node].distances[sibling].value != REMOTE_DISTANCE;
+}
+
+
 size_t
 virDomainNumaGetNodeDistance(virDomainNumaPtr numa,
                              size_t node,
diff --git a/src/conf/numa_conf.h b/src/conf/numa_conf.h
index 4655de3aa..1d2e605b6 100644
--- a/src/conf/numa_conf.h
+++ b/src/conf/numa_conf.h
@@ -87,6 +87,10 @@ int virDomainNumatuneMaybeGetNodeset(virDomainNumaPtr numatune,
 
 size_t virDomainNumaGetNodeCount(virDomainNumaPtr numa);
 
+bool virDomainNumaNodeDistanceSpecified(virDomainNumaPtr numa,
+                                        size_t node,
+                                        size_t sibling)
+    ATTRIBUTE_NONNULL(1);
 size_t virDomainNumaGetNodeDistance(virDomainNumaPtr numa,
                                     size_t node,
                                     size_t sibling)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 5a4d50471..779bab7a3 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -725,6 +725,7 @@ virDomainNumaGetNodeDistance;
 virDomainNumaGetNodeMemoryAccessMode;
 virDomainNumaGetNodeMemorySize;
 virDomainNumaNew;
+virDomainNumaNodeDistanceSpecified;
 virDomainNumaSetNodeCount;
 virDomainNumaSetNodeCpumask;
 virDomainNumaSetNodeDistance;
-- 
2.13.6

--
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]
  Powered by Linux