[PATCH] Cope with missing /sys/devices/system/cpu/cpu0/topology files

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

 



From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>

Not all kernel builds have any entries under the location
/sys/devices/system/cpu/cpu0/topology. We already cope with
that being missing in some cases, but not all. Update the
code which looks for thread_siblings to cope with the missing
file

Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
---
 src/nodeinfo.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/nodeinfo.c b/src/nodeinfo.c
index 415c2e5..72ab394 100644
--- a/src/nodeinfo.c
+++ b/src/nodeinfo.c
@@ -168,6 +168,12 @@ virNodeCountThreadSiblings(const char *dir, unsigned int cpu)
 
     pathfp = fopen(path, "r");
     if (pathfp == NULL) {
+        /* If file doesn't exist, then pretend our only
+         * sibling is ourself */
+        if (errno == ENOENT) {
+            VIR_FREE(path);
+            return 1;
+        }
         virReportSystemError(errno, _("cannot open %s"), path);
         VIR_FREE(path);
         return 0;
-- 
1.8.1.4

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