Bug 635857 - libvirt-0.8.4 fails to start VMs after upgrade
Summary: libvirt-0.8.4 fails to start VMs after upgrade
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libvirt
Version: unspecified
Hardware: x86_64
OS: Linux
low
medium
Target Milestone: ---
Assignee: Eric Blake
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: 636347 636349
TreeView+ depends on / blocked
 
Reported: 2010-09-20 22:06 UTC by Thomas
Modified: 2010-09-22 15:10 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 636347 (view as bug list)
Environment:
Last Closed: 2010-09-22 15:10:07 UTC
Embargoed:


Attachments (Terms of Use)

Description Thomas 2010-09-20 22:06:50 UTC
Description of problem:
I just upgraded one of our servers to libvirt-0.8.4 but I can't use virsh or virt-manager anymore. Syslog says the following "error : get_cpu_value:88 : cannot open /sys/devices/system/cpu/cpu1/online: No such file or directory"
I only have /sys/devices/system/cpu/online which states the number of CPUs the server has, e.g. 0-7.

I suspected the kernel option "hotpluggable cpu support", which was not enabled on my host. After enabling it libvirt works again even though I still don't have "/sys/devices/system/cpu/cpu1/online".


Version-Release number of selected component (if applicable):
libvirt-0.8.4

How reproducible:
always

Comment 1 Thomas 2010-09-21 17:25:39 UTC
I can confirm that it's definitively the kernel option.
I only changed it, recompiled the kernel and after that libvirt worked again without the error messages.

CONFIG_HOTPLUG_CPU:
Symbol: HOTPLUG_CPU [=y]
  │ Prompt: Support for hot-pluggable CPUs
  │   Defined at arch/x86/Kconfig:1634
  │   Depends on: SMP [=y] && HOTPLUG [=y]
  │   Location:
  │     -> Processor type and features

Comment 2 Daniel Berrangé 2010-09-21 17:30:50 UTC
This is probably related to this recent change:

commit d413e5d7659f07994a79290a56c904a9b136ee2d
Author: Eric Blake <eblake>
Date:   Tue Aug 10 15:33:37 2010 -0600

    nodeinfo: skip offline CPUs


I can't yet spot the problem though - it attempts to cope with fact that the directory may not exist at all, so disabling hotplug in your kernel ought not to have broken it. Perhaps Eric can spot the problem.

Comment 3 Eric Blake 2010-09-21 17:41:32 UTC
I agree with danpb's analysis that commit d413e5d7 is the culprit.  I only tested that commit on a hot-plug enabled kernel.  So the fact that disabling hot-plugging makes /sys/devices/system/cpu/cpu<n>/ directories disappear makes sense, but was something I never encountered during my testing.

My patch only allowed a missing directory for cpu0 (since x86_64 systems with hot-unplug cpu support still disallow hot-unplugging cpu0).  The fix is to allow a missing directory for all possible cpus:

diff --git i/src/nodeinfo.c w/src/nodeinfo.c
index 65eeb24..3dac9f3 100644
--- i/src/nodeinfo.c
+++ w/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)

Comment 4 Eric Blake 2010-09-22 15:08:30 UTC
The patch in comment 3 is now upstream in commit be026480; libvirt 0.8.5 (or whatever it will be named) will not have the problem.


Note You need to log in before you can comment on or make changes to this bug.