[libvirt] [PATCH] qemu: Detect VGA_QXL capability correctly

Since 4c993d8a we failed to set this important capability, which allows starting a domain with QXL video card. We set DEVICE_QXL capability bit instead, which is not necessary wrong. Anyway, if qemu supports the new '-device qxl' it supports older '-vga qxl' as well. The latter is used for the primary (the first) qxl video card, the former for other video cards. --- Other approach is to set QEMU_CAPS_VGA_QXL unconditionally as supported by all qemu-1.2+ in qemuCapsInitQMPBasic(). But I think this one is slightly nicer. src/qemu/qemu_capabilities.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index f49a31c..e16bc70 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -2018,6 +2018,9 @@ qemuCapsProbeQMPObjects(qemuCapsPtr caps, /* Prefer -chardev spicevmc (detected earlier) over -device spicevmc */ if (qemuCapsGet(caps, QEMU_CAPS_CHARDEV_SPICEVMC)) qemuCapsClear(caps, QEMU_CAPS_DEVICE_SPICEVMC); + /* If qemu supports newer -device qxl it supports -vga qxl as well */ + if (qemuCapsGet(caps, QEMU_CAPS_DEVICE_QXL)) + qemuCapsSet(caps, QEMU_CAPS_VGA_QXL); return 0; } -- 1.8.0.2

On Fri, Jan 04, 2013 at 10:00:34AM +0100, Michal Privoznik wrote:
Since 4c993d8a we failed to set this important capability, which allows starting a domain with QXL video card. We set DEVICE_QXL capability bit instead, which is not necessary wrong. Anyway, if qemu supports the new '-device qxl' it supports older '-vga qxl' as well. The latter is used for the primary (the first) qxl video card, the former for other video cards. ---
Other approach is to set QEMU_CAPS_VGA_QXL unconditionally as supported by all qemu-1.2+ in qemuCapsInitQMPBasic(). But I think this one is slightly nicer.
src/qemu/qemu_capabilities.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index f49a31c..e16bc70 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -2018,6 +2018,9 @@ qemuCapsProbeQMPObjects(qemuCapsPtr caps, /* Prefer -chardev spicevmc (detected earlier) over -device spicevmc */ if (qemuCapsGet(caps, QEMU_CAPS_CHARDEV_SPICEVMC)) qemuCapsClear(caps, QEMU_CAPS_DEVICE_SPICEVMC); + /* If qemu supports newer -device qxl it supports -vga qxl as well */ + if (qemuCapsGet(caps, QEMU_CAPS_DEVICE_QXL)) + qemuCapsSet(caps, QEMU_CAPS_VGA_QXL);
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 :|

On 01/04/2013 05:00 PM, Michal Privoznik wrote:
Since 4c993d8a we failed to set this important capability, which allows starting a domain with QXL video card. We set DEVICE_QXL capability bit instead, which is not necessary wrong. Anyway, if qemu supports the new '-device qxl' it supports older '-vga qxl' as well. The latter is used for the primary (the first) qxl video card, the former for other video cards. ---
Other approach is to set QEMU_CAPS_VGA_QXL unconditionally as supported by all qemu-1.2+ in qemuCapsInitQMPBasic(). But I think this one is slightly nicer.
src/qemu/qemu_capabilities.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index f49a31c..e16bc70 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -2018,6 +2018,9 @@ qemuCapsProbeQMPObjects(qemuCapsPtr caps, /* Prefer -chardev spicevmc (detected earlier) over -device spicevmc */ if (qemuCapsGet(caps, QEMU_CAPS_CHARDEV_SPICEVMC)) qemuCapsClear(caps, QEMU_CAPS_DEVICE_SPICEVMC); + /* If qemu supports newer -device qxl it supports -vga qxl as well */ + if (qemuCapsGet(caps, QEMU_CAPS_DEVICE_QXL)) + qemuCapsSet(caps, QEMU_CAPS_VGA_QXL);
return 0; }
I don't think it is necessary to add this code. because we have set the caps flag in qemuCapsParseHelpStr() if (strstr(p, "|qxl")) qemuCapsSet(caps, QEMU_CAPS_VGA_QXL); The problem here is about collecting cap flags via QMP, we need to set QEMU_CAPS_VGA_QXL unconditionally but still in discussion. Patch from Doug Goldstein in [libvirt] [PATCH] The -vga CLI arg accepts qxl in qemu 1.2+ always The -vga command always accepts qxl in 1.2 and newer. --- src/qemu/qemu_capabilities.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index f49a31c..c3ab488 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -2282,6 +2282,7 @@ qemuCapsInitQMPBasic(qemuCapsPtr caps) qemuCapsSet(caps, QEMU_CAPS_NO_USER_CONFIG); qemuCapsSet(caps, QEMU_CAPS_NETDEV_BRIDGE); qemuCapsSet(caps, QEMU_CAPS_SECCOMP_SANDBOX); + qemuCapsSet(caps, QEMU_CAPS_VGA_QXL); }

On 04.01.2013 15:06, Guannan Ren wrote:
On 01/04/2013 05:00 PM, Michal Privoznik wrote:
Since 4c993d8a we failed to set this important capability, which allows starting a domain with QXL video card. We set DEVICE_QXL capability bit instead, which is not necessary wrong. Anyway, if qemu supports the new '-device qxl' it supports older '-vga qxl' as well. The latter is used for the primary (the first) qxl video card, the former for other video cards. ---
Other approach is to set QEMU_CAPS_VGA_QXL unconditionally as supported by all qemu-1.2+ in qemuCapsInitQMPBasic(). But I think this one is slightly nicer.
src/qemu/qemu_capabilities.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index f49a31c..e16bc70 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -2018,6 +2018,9 @@ qemuCapsProbeQMPObjects(qemuCapsPtr caps, /* Prefer -chardev spicevmc (detected earlier) over -device spicevmc */ if (qemuCapsGet(caps, QEMU_CAPS_CHARDEV_SPICEVMC)) qemuCapsClear(caps, QEMU_CAPS_DEVICE_SPICEVMC); + /* If qemu supports newer -device qxl it supports -vga qxl as well */ + if (qemuCapsGet(caps, QEMU_CAPS_DEVICE_QXL)) + qemuCapsSet(caps, QEMU_CAPS_VGA_QXL); return 0; }
I don't think it is necessary to add this code. because we have set the caps flag in qemuCapsParseHelpStr()
if (strstr(p, "|qxl")) qemuCapsSet(caps, QEMU_CAPS_VGA_QXL);
which is not called if capabilities are initialized via QMP.
The problem here is about collecting cap flags via QMP, we need to set QEMU_CAPS_VGA_QXL unconditionally but still in discussion.
Patch from Doug Goldstein in [libvirt] [PATCH] The -vga CLI arg accepts qxl in qemu 1.2+ always
The -vga command always accepts qxl in 1.2 and newer. --- src/qemu/qemu_capabilities.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index f49a31c..c3ab488 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -2282,6 +2282,7 @@ qemuCapsInitQMPBasic(qemuCapsPtr caps) qemuCapsSet(caps, QEMU_CAPS_NO_USER_CONFIG); qemuCapsSet(caps, QEMU_CAPS_NETDEV_BRIDGE); qemuCapsSet(caps, QEMU_CAPS_SECCOMP_SANDBOX); + qemuCapsSet(caps, QEMU_CAPS_VGA_QXL); }
I don't think it should be set unconditionally neither. I know I wrote it under commit message, but now re-thinking it again - what if somebody builds his own qemu without QXL? Michal

On 01/04/2013 07:10 AM, Michal Privoznik wrote:
The problem here is about collecting cap flags via QMP, we need to set QEMU_CAPS_VGA_QXL unconditionally but still in discussion.
That discussion was conclusive - we do not want the flag unconditionally.
Patch from Doug Goldstein in [libvirt] [PATCH] The -vga CLI arg accepts qxl in qemu 1.2+ always
The -vga command always accepts qxl in 1.2 and newer.
Not true...
I don't think it should be set unconditionally neither. I know I wrote it under commit message, but now re-thinking it again - what if somebody builds his own qemu without QXL?
...precisely because of this possibility. Michal's patch is correct - if QXL is available, then -vga qxl is available; but it is possible to self-build qemu without QXL. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On 04.01.2013 15:21, Eric Blake wrote:
On 01/04/2013 07:10 AM, Michal Privoznik wrote:
The problem here is about collecting cap flags via QMP, we need to set QEMU_CAPS_VGA_QXL unconditionally but still in discussion.
That discussion was conclusive - we do not want the flag unconditionally.
Patch from Doug Goldstein in [libvirt] [PATCH] The -vga CLI arg accepts qxl in qemu 1.2+ always
The -vga command always accepts qxl in 1.2 and newer.
Not true...
I don't think it should be set unconditionally neither. I know I wrote it under commit message, but now re-thinking it again - what if somebody builds his own qemu without QXL?
...precisely because of this possibility. Michal's patch is correct - if QXL is available, then -vga qxl is available; but it is possible to self-build qemu without QXL.
Okay, now I've pushed the patch. Thanks. Michal

On Fri, Jan 4, 2013 at 3:00 AM, Michal Privoznik <mprivozn@redhat.com> wrote:
Since 4c993d8a we failed to set this important capability, which allows starting a domain with QXL video card. We set DEVICE_QXL capability bit instead, which is not necessary wrong. Anyway, if qemu supports the new '-device qxl' it supports older '-vga qxl' as well. The latter is used for the primary (the first) qxl video card, the former for other video cards. ---
Other approach is to set QEMU_CAPS_VGA_QXL unconditionally as supported by all qemu-1.2+ in qemuCapsInitQMPBasic(). But I think this one is slightly nicer.
src/qemu/qemu_capabilities.c | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index f49a31c..e16bc70 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -2018,6 +2018,9 @@ qemuCapsProbeQMPObjects(qemuCapsPtr caps, /* Prefer -chardev spicevmc (detected earlier) over -device spicevmc */ if (qemuCapsGet(caps, QEMU_CAPS_CHARDEV_SPICEVMC)) qemuCapsClear(caps, QEMU_CAPS_DEVICE_SPICEVMC); + /* If qemu supports newer -device qxl it supports -vga qxl as well */ + if (qemuCapsGet(caps, QEMU_CAPS_DEVICE_QXL)) + qemuCapsSet(caps, QEMU_CAPS_VGA_QXL);
return 0; } -- 1.8.0.2
I'm late to the party but ACK as being a better patch than the one I sent earlier. -- Doug Goldstein
participants (5)
-
Daniel P. Berrange
-
Doug Goldstein
-
Eric Blake
-
Guannan Ren
-
Michal Privoznik