[libvirt] [PATCH] Extract kvm version from qemu-kvm

Cole Robinson crobinso at redhat.com
Thu May 15 17:47:32 UTC 2008


The patch below provides a way to check the kvm version by parsing
the output of qemu-kvm, similar to how the qemu version is parsed.

The qemu-kvm binary help info starts with the line:

"QEMU PC emulator version major.minor.micro (KVM-ver)"

The patch is kind of ugly, with renamed functions and code
movement. The gist of it is:

- Moved the general run-a-command-and-grab-output into its own
    function qemudExtractCommandOutput
- Created qemudExtract{Qemu,KVM}VersionInfo which call the above
    function and scrape the output
- Use qemudExtractVersion to find the default binaries and call
    the *VersionInfo functions

If there is a parsing error, or kvm support isn't found, the new
kvmVersion in the qemud_driver struct is just set to zero. I also
added a call to fill in the qemu and kvm versions on driver init.

The patch also fills in the previously discussed max vcpus piece,
which is dependent on the kvm version.

Any comments appreciated.

Thanks,
Cole
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: libvirt-kvm-version-patch
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20080515/8e0bdee5/attachment-0001.ksh>


More information about the libvir-list mailing list