]> git.karo-electronics.de Git - karo-tx-linux.git/commit
kvm tools: Emit a more informative error message when /dev/kvm does not open
authorIngo Molnar <mingo@elte.hu>
Fri, 8 Apr 2011 14:55:33 +0000 (16:55 +0200)
committerPekka Enberg <penberg@kernel.org>
Fri, 8 Apr 2011 15:18:00 +0000 (18:18 +0300)
commitb95f0c7835c8524b0ab84fbe5ca9f7b8e79b82bf
tree40aec60a54f9dca1226bb876b967fdb5dc36dc7b
parentd2ae8f98ac43b19ed1c684f5bec384ab10f5382f
kvm tools: Emit a more informative error message when /dev/kvm does not open

When for some reason virtualization is not available on a box, the user
gets this cryptic error message:

  open: No such device

The user has no idea what happened - what is being opened and why is
there no such device?

This happens on one of my boxes, where there's VMX support indicated
in the CPU feature flags but where modules do not load because the
BIOS has virtualization disabled. The KVM kernel subsystem emits a
warning into the syslog:

  kvm: disabled by bios

But unfortunatey tools cannot really recover that error reason in any sane,
programmatic way when accessing /dev/kvm.

So do the best we can, we suggest to the user to look into the syslog for
the reason of the error:

  Fatal: '/dev/kvm' KVM driver not available.
  # (If the KVM module is loaded then 'dmesg' may offer further clues about the failure.)

Also improve the fallback error message from 'open: No such device' to:

  Fatal, could not open /dev/kvm: No such device

... should there be any future error returns that are neither -ENOENT,
nor -ENODEV.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
tools/kvm/kvm.c