[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] Re: [PATCH 5/9] Monitor: Return before exiting with 'quit'
From: |
Jan Kiszka |
Subject: |
[Qemu-devel] Re: [PATCH 5/9] Monitor: Return before exiting with 'quit' |
Date: |
Mon, 26 Apr 2010 21:10:18 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 |
Anthony Liguori wrote:
> On 04/26/2010 01:53 PM, Luiz Capitulino wrote:
>> On Mon, 26 Apr 2010 13:25:38 -0500
>> Anthony Liguori<address@hidden> wrote:
>>
>>
>>> On 04/26/2010 01:22 PM, Luiz Capitulino wrote:
>>>
>>>> On Mon, 26 Apr 2010 12:49:40 -0500
>>>> Anthony Liguori<address@hidden> wrote:
>>>>
>>>>
>>>>
>>>>> On 04/26/2010 10:47 AM, Luiz Capitulino wrote:
>>>>>
>>>>>
>>>>>> The 'quit' Monitor command (implemented by do_quit()) calls
>>>>>> exit() directly, this is problematic under QMP because QEMU
>>>>>> exits before having a chance to send the ok response.
>>>>>>
>>>>>> Clients don't know if QEMU exited because of a problem or
>>>>>> because the 'quit' command has been executed.
>>>>>>
>>>>>> This commit fixes that by moving the exit() call to the main
>>>>>> loop, so that do_quit() requests the system to quit, instead
>>>>>> of calling exit() directly.
>>>>>>
>>>>>>
>>>>>>
>>>>> Does this also have the effect of printing out a (qemu) prompt after
>>>>> quit before an EOF appears on that socket?
>>>>>
>>>>>
>>>> Ah, right..
>>>>
>>>>
>>> It's not necessarily a bad thing if it does. I just wanted to raise
>>> that because it's possible that someone depends on the behavior.
>>>
>> Yes, and it's also a bit ugly if you do '-monitor stdio':
>>
>> ~/stuff/virt/ ./qemu-qmp -monitor stdio
>> QEMU 0.12.50 monitor - type 'help' for more information
>> (qemu) quit
>> (qemu) ~/stuff/virt/
>>
>> So, I'd like to fix it.
>>
>>
>>> I'm not sure it matters to me if we change this behavior though.
>>>
>> It's very easy to fix, the following patch does it.
>>
>> I have (tested and) rebased the for-anthony branch with it.
>>
>> From 14ecef47d1989f9b646fc0fe7a4bf42c091d1432 Mon Sep 17 00:00:00 2001
>> From: Luiz Capitulino<address@hidden>
>> Date: Tue, 6 Apr 2010 18:55:54 -0300
>> Subject: [PATCH 5/9] Monitor: Return before exiting with 'quit'
>>
>> The 'quit' Monitor command (implemented by do_quit()) calls
>> exit() directly, this is problematic under QMP because QEMU
>> exits before having a chance to send the ok response.
>>
>> Clients don't know if QEMU exited because of a problem or
>> because the 'quit' command has been executed.
>>
>> This commit fixes that by moving the exit() call to the main
>> loop, so that do_quit() requests the system to quit, instead
>> of calling exit() directly.
>>
>> Signed-off-by: Luiz Capitulino<address@hidden>
>> ---
>> monitor.c | 7 ++++++-
>> sysemu.h | 2 ++
>> vl.c | 18 ++++++++++++++++++
>> 3 files changed, 26 insertions(+), 1 deletions(-)
>>
>> diff --git a/monitor.c b/monitor.c
>> index ef84298..5b0258f 100644
>> --- a/monitor.c
>> +++ b/monitor.c
>> @@ -1017,7 +1017,12 @@ static void do_info_cpu_stats(Monitor *mon)
>> */
>> static int do_quit(Monitor *mon, const QDict *qdict, QObject
>> **ret_data)
>> {
>> - exit(0);
>> + if (monitor_ctrl_mode(mon)) {
>> + qemu_system_exit_request();
>> + } else {
>> + exit(0);
>> + }
>> +
>>
>
> Now they have different behaviors though because
> qemu_system_exit_request() actually exits gracefully.
>
> For instance, now in QMP mode, an ifdown script will be executed when
> the 'quit' command is invoked whereas it won't be executed when done
> through the human monitor.
>
> I honestly don't mind the weird print outs with -monitor stdio. I think
> exiting gracefully in both cases is better.
Just suspend the monitor before leaving for termination. That should
have both the proper visual and functional effect.
Jan
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PATCH 1/9] QError: New QERR_QMP_BAD_INPUT_OBJECT_MEMBER, (continued)
- [Qemu-devel] [PATCH 1/9] QError: New QERR_QMP_BAD_INPUT_OBJECT_MEMBER, Luiz Capitulino, 2010/04/26
- [Qemu-devel] [PATCH 2/9] QMP: Use QERR_QMP_BAD_INPUT_OBJECT_MEMBER, Luiz Capitulino, 2010/04/26
- [Qemu-devel] [PATCH 3/9] QError: Improve QERR_QMP_BAD_INPUT_OBJECT desc, Luiz Capitulino, 2010/04/26
- [Qemu-devel] [PATCH 4/9] QMP: Check "arguments" member's type, Luiz Capitulino, 2010/04/26
- [Qemu-devel] [PATCH 5/9] Monitor: Return before exiting with 'quit', Luiz Capitulino, 2010/04/26
- Re: [Qemu-devel] [PATCH 5/9] Monitor: Return before exiting with 'quit', Anthony Liguori, 2010/04/26
- Re: [Qemu-devel] [PATCH 5/9] Monitor: Return before exiting with 'quit', Luiz Capitulino, 2010/04/26
- Re: [Qemu-devel] [PATCH 5/9] Monitor: Return before exiting with 'quit', Anthony Liguori, 2010/04/26
- Re: [Qemu-devel] [PATCH 5/9] Monitor: Return before exiting with 'quit', Luiz Capitulino, 2010/04/26
- Re: [Qemu-devel] [PATCH 5/9] Monitor: Return before exiting with 'quit', Anthony Liguori, 2010/04/26
- [Qemu-devel] Re: [PATCH 5/9] Monitor: Return before exiting with 'quit',
Jan Kiszka <=
- [Qemu-devel] Re: [PATCH 5/9] Monitor: Return before exiting with 'quit', Anthony Liguori, 2010/04/26
- [Qemu-devel] Re: [PATCH 5/9] Monitor: Return before exiting with 'quit', Luiz Capitulino, 2010/04/26
- [Qemu-devel] Re: [PATCH 5/9] Monitor: Return before exiting with 'quit', Paolo Bonzini, 2010/04/27
- [Qemu-devel] Re: [PATCH 5/9] Monitor: Return before exiting with 'quit', Luiz Capitulino, 2010/04/27
- [Qemu-devel] Re: [PATCH 5/9] Monitor: Return before exiting with 'quit', Paolo Bonzini, 2010/04/27
[Qemu-devel] [PATCH 6/9] monitor: Cleanup ID assignment for compat switch, Luiz Capitulino, 2010/04/26
[Qemu-devel] [PATCH 7/9] monitor: Reorder intialization to drop initial mux focus, Luiz Capitulino, 2010/04/26
[Qemu-devel] [PATCH 8/9] chardev: Document mux option, Luiz Capitulino, 2010/04/26
[Qemu-devel] [PATCH 9/9] stash away SCM_RIGHTS fd until a getfd command arrives, Luiz Capitulino, 2010/04/26
Re: [Qemu-devel] [PATCH 0/9][PULL]: QMP/Monitor queue, Anthony Liguori, 2010/04/26