[libvirt] [PATCH] nodeinfo: work when hot-plugging is disabled

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=635857. * src/nodeinfo.c (cpu_online): Allow missing directory for all CPUs, not just cpu0. Signed-off-by: Eric Blake <eblake@redhat.com> --- src/nodeinfo.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/nodeinfo.c b/src/nodeinfo.c index 65eeb24..3dac9f3 100644 --- a/src/nodeinfo.c +++ b/src/nodeinfo.c @@ -65,7 +65,8 @@ int linuxNodeInfoCPUPopulate(FILE *cpuinfo, /* Return the positive decimal contents of the given * CPU_SYS_PATH/cpu%u/FILE, or -1 on error. If MISSING_OK and the * file could not be found, return 1 instead of an error; this is - * because some machines cannot hot-unplug cpu0. */ + * because some machines cannot hot-unplug cpu0, or because + * hot-unplugging is disabled. */ static int get_cpu_value(unsigned int cpu, const char *file, bool missing_ok) { @@ -113,7 +114,7 @@ cleanup: static int cpu_online(unsigned int cpu) { - return get_cpu_value(cpu, "online", cpu == 0); + return get_cpu_value(cpu, "online", true); } static unsigned long count_thread_siblings(unsigned int cpu) -- 1.7.2.3

On Tue, Sep 21, 2010 at 11:44:03AM -0600, Eric Blake wrote:
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=635857.
* src/nodeinfo.c (cpu_online): Allow missing directory for all CPUs, not just cpu0.
Signed-off-by: Eric Blake <eblake@redhat.com> --- src/nodeinfo.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/nodeinfo.c b/src/nodeinfo.c index 65eeb24..3dac9f3 100644 --- a/src/nodeinfo.c +++ b/src/nodeinfo.c @@ -65,7 +65,8 @@ int linuxNodeInfoCPUPopulate(FILE *cpuinfo, /* Return the positive decimal contents of the given * CPU_SYS_PATH/cpu%u/FILE, or -1 on error. If MISSING_OK and the * file could not be found, return 1 instead of an error; this is - * because some machines cannot hot-unplug cpu0. */ + * because some machines cannot hot-unplug cpu0, or because + * hot-unplugging is disabled. */ static int get_cpu_value(unsigned int cpu, const char *file, bool missing_ok) { @@ -113,7 +114,7 @@ cleanup: static int cpu_online(unsigned int cpu) { - return get_cpu_value(cpu, "online", cpu == 0); + return get_cpu_value(cpu, "online", true); }
static unsigned long count_thread_siblings(unsigned int cpu)
ACK Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

On 09/22/2010 03:04 AM, Daniel P. Berrange wrote:
On Tue, Sep 21, 2010 at 11:44:03AM -0600, Eric Blake wrote:
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=635857.
* src/nodeinfo.c (cpu_online): Allow missing directory for all CPUs, not just cpu0.
Signed-off-by: Eric Blake<eblake@redhat.com> ACK
Thanks; pushed. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org
participants (2)
-
Daniel P. Berrange
-
Eric Blake