Re: [PATCH 02/20] Wait to receive QMP greeting before sending any monitor commands

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

 



On 09/11/2012 08:11 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>
> 
> Technically speaking we should wait until we receive the QMP
> greeting message before attempting to send any QMP monitor
> commands. Mostly we've got away with this, but there is a race
> in some QEMU which cause it to SEGV if you sent it data too
> soon after startup. Waiting for the QMP greeting avoids the
> race
> 
> Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
> ---
>  src/qemu/qemu_monitor.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)

ACK.

> @@ -716,6 +721,8 @@ qemuMonitorOpen(virDomainObjPtr vm,
>      mon->fd = -1;
>      mon->vm = vm;
>      mon->json = json;
> +    if (json)
> +        mon->wait_greeting = 1;

Could collapse 3 lines to 1 with:

mon->json = mon->wait_greeting = json;

but that comes at the expense of readability, so keep your version.

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

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