Re: [PATCH] qemu: Use QMP for send-key if supported

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Apr 11, 2013 at 03:06:51PM +0200, Peter Krempa wrote:
> On 04/11/13 15:00, Eric Blake wrote:
> >On 04/11/2013 06:45 AM, Peter Krempa wrote:
> >>Instead of always using HMP use the QMP send-key command introduced in qemu 1.3.
> >>---
> >
> >>+++ b/src/qemu/qemu_monitor.c
> >>@@ -3008,14 +3008,15 @@ int qemuMonitorInjectNMI(qemuMonitorPtr mon)
> >>  int qemuMonitorSendKey(qemuMonitorPtr mon,
> >>                         unsigned int holdtime,
> >>                         unsigned int *keycodes,
> >>-                       unsigned int nkeycodes)
> >>+                       unsigned int nkeycodes,
> >>+                       bool useQMP)
> >>  {
> >>      int ret;
> >>
> >>      VIR_DEBUG("mon=%p, holdtime=%u, nkeycodes=%u",
> >>                mon, holdtime, nkeycodes);
> >>
> >>-    if (mon->json)
> >>+    if (mon->json && useQMP)
> >>          ret = qemuMonitorJSONSendKey(mon, holdtime, keycodes, nkeycodes);
> >>      else
> >>          ret = qemuMonitorTextSendKey(mon, holdtime, keycodes, nkeycodes);
> >
> >I'm not sure I like adding the useQMP parameter.  That makes for a leaky
> >abstraction (the caller is burdened with telling us which version of a
> >polymorphic function to dispatch to).  What we have done in other cases
> >is to always dispatch to the json code, and then have the json code
> >_try_ the command, and if the command fails, fall back to the hmp
> 
> I saw that approach and I didn't like it thus I created this.

We use that approach for all other monitors commands, and we should
maintain the consistent approach for this sendkey command too. So
please make this work as Eric describes.

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 :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]