From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:49776) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UN84b-0000PR-06 for qemu-devel@nongnu.org; Tue, 02 Apr 2013 16:44:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UN84Y-0004EE-EH for qemu-devel@nongnu.org; Tue, 02 Apr 2013 16:44:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54547) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UN84Y-0004Dq-50 for qemu-devel@nongnu.org; Tue, 02 Apr 2013 16:44:50 -0400 Message-ID: <515B433C.7090709@redhat.com> Date: Tue, 02 Apr 2013 14:44:44 -0600 From: Eric Blake MIME-Version: 1.0 References: <1364933897-25803-1-git-send-email-lcapitulino@redhat.com> <1364933897-25803-4-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1364933897-25803-4-git-send-email-lcapitulino@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="----enig2VKHHGKAVOIBXELGAAPWC" Subject: Re: [Qemu-devel] [PATCH 3/4] hmp: human-monitor-command: stop using the Memory chardev driver List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Luiz Capitulino Cc: aliguori@us.ibm.com, fred.konrad@greensocs.com, kraxel@redhat.com, qemu-devel@nongnu.org, armbru@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2VKHHGKAVOIBXELGAAPWC Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 04/02/2013 02:18 PM, Luiz Capitulino wrote: > The Memory chardev driver was added because, as the Monitor's output > buffer was static, we needed a way to accumulate the output of an > HMP commmand when ran by human-monitor-command. >=20 > However, the Monitor's output buffer is now dynamic, so it's possible > for the human-monitor-command to use it instead of the Memory chardev > driver. >=20 > This commit does that change, but there are two important > obversations about it: s/obversations/observations/ >=20 > 1. We need a way to signal to the Monitor that it shouldn't call > chardev functions when flushing its output. This is done > by adding a new flag to the Monitor object called skip_flush > (which is set to true by qmp_human_monitor_command()) >=20 > 2. The current code has buffered semantics: QMP clients will > only see a command's output if it flushes its output with > a new-line character. This commit changes this to unbuffered, > which means that QMP clients will see a command's output > whenever the command prints anything. Ultimately, libvirt will still buffer until it has a complete JSON reply, even if portions of that reply are being sent unbuffered now where they were previously buffered until newlines. At any rate, I guess you could do some testing with libvirt, such as: virsh qemu-monitor-command $dom --hmp info and checking that libvirt isn't confused by the new output timing behavio= r. >=20 > I don't think this will matter in practice though, as I believe > all HMP commands print the new-line character anyway. Just looking at it from libvirt's point of view, the few HMP commands that libvirt.so relies on when talking to qemu 1.4 are: set_cpu drive_add drive_del savevm loadvm delvm inject-nmi sendkey [libvirt-qemu.so exposes human-monitor-command as a development aid, via 'virsh qemu-monitor-command', but this is explicitly unsupported and relegated to a separate library instead of libvirt.so for a reason] I chose to look at 'delvm'; that command always has a newline ending any error message, but on the success case, it looked like there was no output at all. But once again, since the command is only being used via the QMP 'human-monitor-command' wrapper, and libvirt is only checking for known errors and declaring success if none of the error strings are present, I think it will still work. I haven't actually tested it, thoug= h. >=20 > Signed-off-by: Luiz Capitulino > --- > monitor.c | 17 ++++++++--------- > 1 file changed, 8 insertions(+), 9 deletions(-) Even without an explicit test on my part, this looks sane enough that I don't mind if you use: Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org ------enig2VKHHGKAVOIBXELGAAPWC Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.13 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJRW0M8AAoJEKeha0olJ0NqCgMIAI+YJkrjP1ltFHvydWpQOVBd 8atwlS6JcMzXlLD/A46ekAl6eYeWbw7sOrs7Ax/syiGxxMIEVak1fk2ZjyRp70OO uqHyhagD8IjjgFigb/BLeVBlYXYxdW1IDdDQFIEzoxSBpysXNCo2qTMumYcg6TfR P4FtQE1kphk/7C50fQ4qOAJ2UFGkKDjKM7iGS6jWzz0mvDGJ1La8xUsqgKzHAD5+ pzr63tnXj2+G7zF/sN3sDsX/nzsSuWr27vQ4DgBhplLKlScE8n6SciDEzyRay4lg ZUin+/8E/BTDv1lEWMI/COPPT+O+j63ujJSZFTWfhCv/bAj7PPZVrWH7ZjAijVY= =MRcU -----END PGP SIGNATURE----- ------enig2VKHHGKAVOIBXELGAAPWC--