[libvirt-users] Running virConnectGetCapabilities / virsh capabilities without a daemon or KVM

Richard W.M. Jones rjones at redhat.com
Tue Mar 21 14:35:24 UTC 2017

For virt-p2v we want to get the host CPU model, topology etc, and the
best way we found to do that was to pull it from libvirt
capabilities[1].  Since libvirt is already parsing the host CPU
information, and because /proc/cpuinfo is such a stupid format to
parse, this is very convenient.

Unfortunately it doesn't work unless libvirtd _and_ KVM are both

Without libvirtd installed:

  # virsh capabilities
  error: failed to connect to the hypervisor
  error: Failed to connect socket to '/var/run/libvirt/libvirt-sock': No such file or directory

With libvirt-daemon installed, but not QEMU:

  # virsh capabilities
  error: failed to connect to the hypervisor
  error: no connection driver available for <null>

I feel I should be able to fiddle with the connection URI in some way
to make this possible, at least in the second case.  However there's
not a concept of "no hypervisor", and I couldn't find any other way to
make it work.  Using "test:///default" seems tempting, but it
substitutes some imaginary host (i686) so that's no good.

Installing KVM isn't really an option for us since we are trying to
build a minimal bootable ISO.  Just installing qemu-system-x86_64
pulls in half the world.  (Even installing libvirtd is difficult, and
we'd prefer to avoid it).

Any ideas?


[1] https://github.com/libguestfs/libguestfs/commit/963d6c3be7cd91c0373f67cfdd95c4f1dad1452f

Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.

More information about the libvirt-users mailing list