[libvirt] Re: [Qemu-devel] [PATCH 1/6] Allow multiple monitor devices (v2)

Avi Kivity avi at redhat.com
Thu Apr 9 15:11:37 UTC 2009


Anthony Liguori wrote:
> Avi Kivity wrote:
>>
>> I'd make everything line-oriented.  Anything from the user up to \n 
>> is buffered and ignored until the \n arrives.
>>
>> Once the \n arrives, the command is acted upon atomically, either 
>> completing fully or launching an async notification.
>>
>> So the rules are: whenever the monitor is idle, a notification can be 
>> printed out.
>
> So by idle, you mean, the end of the output buffer ends in either '\n' 
> or '\n(qemu) '.  The input buffer must also be empty.

You don't have to look any buffers.  If the monitor is processing a 
command, it is busy.  An asynchronous command ('migrate -d') is not 
processed in the monitor after it is launched, so it doesn't keep the 
monitor busy.  A monitor enters idle after printing the prompt, and 
leaves idle when it starts processing a command.

If you meant from the user side, a notification always follows the prompt.

>
>> (qemu) notify enospace on
>> (qemu) notify vnc-connect on
>> (qemu)
>> notification: vnc connection ...
>> (qemu) notify migration-completion on
>> (qemu) migrate -d ...
>> notification: enospc on ide0-0
>> (qemu) migrate_cancel
>> notification: migration cancelled
>> (qemu) migrate -d ...
>> (qemu)
>> notification: migration completed 
>
> This hurts my eyes.  It's not human readable.

I'm sorry, I don't see why.  It's just like a shell session.

Compare with:

Monitor 1:
(qemu) notify enospace on
(qemu) notify vnc-connect on
(qemu) notify migration-completion on
(qemu) migrate -d ...
(qemu) migrate_cancel
(qemu) migrate -d ...


Monitor 2:
(qemu) wait
vnc connection ...
(qemu) wait
enospc on ide0-0
(qemu) wait
migration cancelled
(qemu) wait
notification: migration completed

There is no way to tell by looking what has happened (well, in this case 
you can, but in the general case you cannot).  You have to look at two 
separate interactive sessions (ctrl-alt-2 ctrl-alt-3 ctrl-alt-3).  You 
have to keep reissuing the wait command.  Oh, and it's racy, so if 
you're interested in what really happens you have to issue info commands 
on session 1.

That's unusable.

>   If we're going to do this, we might as well have a non-human mode 
> which would oddly enough be more human readable.  If you do this, then 
> your session looks an awful lot like my session from a previous note.

I think we should.

>
> I think the thing that is missing is that the 'wait' command does not 
> have to be part of the non-human mode.  In non-human mode, you are 
> always doing an implicit wait.
>

I think 'wait' is unusable for humans.  If I want qemu to tell me 
something happened, it's enough to enable notifications.  There's no 
need to tell it to wait every time something happens.  That's poll(2), 
there's no poll(1).

-- 
Do not meddle in the internals of kernels, for they are subtle and quick to panic.




More information about the libvir-list mailing list