render / rpms / libvirt

Forked from rpms/libvirt 4 months ago
Clone
7a3408
From bad19eb327daa3ad90674f09587113a2ef6d3620 Mon Sep 17 00:00:00 2001
7a3408
Message-Id: <bad19eb327daa3ad90674f09587113a2ef6d3620@dist-git>
7a3408
From: Andrea Bolognani <abologna@redhat.com>
7a3408
Date: Wed, 5 Aug 2015 18:18:23 +0200
7a3408
Subject: [PATCH] nodeinfo: Introduce linuxGetCPUOnlinePath()
7a3408
7a3408
(cherry picked from commit 6fecc4017d953d2c4c73b29b0ac6209644585137)
7a3408
7a3408
Bug: https://bugzilla.redhat.com/show_bug.cgi?id=1213713
7a3408
7a3408
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
7a3408
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
7a3408
---
7a3408
 src/nodeinfo.c | 8 +++++++-
7a3408
 1 file changed, 7 insertions(+), 1 deletion(-)
7a3408
7a3408
diff --git a/src/nodeinfo.c b/src/nodeinfo.c
7a3408
index b09a4fd..5459cc6 100644
7a3408
--- a/src/nodeinfo.c
7a3408
+++ b/src/nodeinfo.c
7a3408
@@ -976,6 +976,12 @@ linuxGetCPUPresentPath(const char *sysfs_prefix)
7a3408
     return linuxGetCPUGlobalPath(sysfs_prefix, "present");
7a3408
 }
7a3408
 
7a3408
+static char *
7a3408
+linuxGetCPUOnlinePath(const char *sysfs_prefix)
7a3408
+{
7a3408
+    return linuxGetCPUGlobalPath(sysfs_prefix, "online");
7a3408
+}
7a3408
+
7a3408
 /* Determine the maximum cpu id from a Linux sysfs cpu/present file. */
7a3408
 static int
7a3408
 linuxParseCPUmax(const char *path)
7a3408
@@ -1316,7 +1322,7 @@ nodeGetCPUBitmap(const char *sysfs_prefix ATTRIBUTE_UNUSED,
7a3408
     if (present < 0)
7a3408
         return NULL;
7a3408
 
7a3408
-    if (virAsprintf(&online_path, "%s/cpu/online", prefix) < 0)
7a3408
+    if (!(online_path = linuxGetCPUOnlinePath(sysfs_prefix)))
7a3408
         return NULL;
7a3408
     if (virFileExists(online_path)) {
7a3408
         cpumap = linuxParseCPUmap(present, online_path);
7a3408
-- 
7a3408
2.5.0
7a3408