[libvirt] [libvirt-designer 1/2] Fix libvirt caps -> libosinfo platform short id mapping

Daniel P. Berrange berrange at redhat.com
Tue Mar 19 15:24:22 UTC 2013


On Tue, Mar 19, 2013 at 10:46:35AM +0100, Christophe Fergeau wrote:
> The code was building an id starting with kvm- while libosinfo qemu
> description uses qemu-kvm-. Also, starting from qemu 1.2.0, there is
> no separate qemu-kvm tarball.
> guess_platform_from_connect is starting to be a bit magic, it may
> be better to add a <machine> attribute to libosinfo <platform>
> description and to use this to improve the matching between
> libosinfo data and libvirt caps.

I've never been able to think up a satisfactory way to do the
mapping yet, without black magic like this. The trick is we don't
want to tie libosinfo to libvirt concepts directly, since we want
it to be generally useful to anyone doing virt stuff regardless
of whether they use libvirt.

> diff --git a/examples/virtxml.c b/examples/virtxml.c
> index 09f49cf..a68843d 100644
> --- a/examples/virtxml.c
> +++ b/examples/virtxml.c
> @@ -442,13 +442,13 @@ guess_platform_from_connect(GVirConnection *conn)
>      }
>  
>      /* do some mappings:
> -     * QEMU -> kvm
> +     * QEMU -> qemu-kvm
>       * Xen -> xen
>       */
>      type = g_ascii_strdown(hv_type, -1);
> -    if (g_str_equal(type, "qemu")) {
> +    if (g_str_equal(type, "qemu") && ver <= 1002000) {
>          g_free(type);
> -        type = g_strdup("kvm");
> +        type = g_strdup("qemu-kvm");
>      }

ACK

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list