[Qemu-devel] [PATCH v2 0/3] add exit-script option to qemu

Dominik Csapak posted 3 patches 5 years, 6 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20181004114312.27346-1-d.csapak@proxmox.com
Test docker-clang@ubuntu failed
Test checkpatch passed
include/qemu/osdep.h | 12 +++++++++++
net/tap.c            | 56 ++++++++++------------------------------------------
qemu-options.hx      | 20 +++++++++++++++++++
util/oslib-posix.c   | 34 +++++++++++++++++++++++++++++++
util/oslib-win32.c   |  8 ++++++++
vl.c                 | 29 +++++++++++++++++++++++++++
6 files changed, 113 insertions(+), 46 deletions(-)
[Qemu-devel] [PATCH v2 0/3] add exit-script option to qemu
Posted by Dominik Csapak 5 years, 6 months ago
this patch series aims to execute a script when qemu exits
so that one can do cleanups when using --daemonize without
having to use the qmp monitor

changes since v1:

* refactored as qemu_launch_script, only for non-windows platforms
* updated net/tap.c to use qemu_launch_script instead of launch_script
* fixed a small error in the option description

Dominik Csapak (3):
  osdep: add qemu_launch_script for executing scripts
  tap: use qemu_launch_script instead of launch_script
  vl.c: call optional script when exiting

 include/qemu/osdep.h | 12 +++++++++++
 net/tap.c            | 56 ++++++++++------------------------------------------
 qemu-options.hx      | 20 +++++++++++++++++++
 util/oslib-posix.c   | 34 +++++++++++++++++++++++++++++++
 util/oslib-win32.c   |  8 ++++++++
 vl.c                 | 29 +++++++++++++++++++++++++++
 6 files changed, 113 insertions(+), 46 deletions(-)

-- 
2.11.0



Re: [Qemu-devel] [PATCH v2 0/3] add exit-script option to qemu
Posted by Jason Wang 5 years, 6 months ago

On 2018年10月04日 19:43, Dominik Csapak wrote:
> this patch series aims to execute a script when qemu exits
> so that one can do cleanups when using --daemonize without
> having to use the qmp monitor

Hi:

Can you give a example of why it must be done through this way? It looks 
to me that we can do this by monitor the pid and behave accordingly 
through bash.

Thanks

>
> changes since v1:
>
> * refactored as qemu_launch_script, only for non-windows platforms
> * updated net/tap.c to use qemu_launch_script instead of launch_script
> * fixed a small error in the option description
>
> Dominik Csapak (3):
>    osdep: add qemu_launch_script for executing scripts
>    tap: use qemu_launch_script instead of launch_script
>    vl.c: call optional script when exiting
>
>   include/qemu/osdep.h | 12 +++++++++++
>   net/tap.c            | 56 ++++++++++------------------------------------------
>   qemu-options.hx      | 20 +++++++++++++++++++
>   util/oslib-posix.c   | 34 +++++++++++++++++++++++++++++++
>   util/oslib-win32.c   |  8 ++++++++
>   vl.c                 | 29 +++++++++++++++++++++++++++
>   6 files changed, 113 insertions(+), 46 deletions(-)
>


Re: [Qemu-devel] [PATCH v2 0/3] add exit-script option to qemu
Posted by Dominik Csapak 5 years, 6 months ago
On 10/8/18 5:28 AM, Jason Wang wrote:
> 
> 
> On 2018年10月04日 19:43, Dominik Csapak wrote:
>> this patch series aims to execute a script when qemu exits
>> so that one can do cleanups when using --daemonize without
>> having to use the qmp monitor
> 
> Hi:
> 
> Can you give a example of why it must be done through this way? It looks 
> to me that we can do this by monitor the pid and behave accordingly 
> through bash.
> 
> Thanks

Hi,

as i said in a reply on my original patch, the reason was twofold

first, i thought having an additional process just for monitoring
the exit of qemu with qmp/pidfile was too much for some users, as 
opposed to a simple script that executes then

ans second (more important), i wanted to know the reason qemu
exited (e.g. user initiated shutdown/reset/etc.),
especially when '-no-reboot' is set

please ignore this series (maybe the refactoring of the launch script
is interesting, i don't know), i will send a patch to be able
to distinguish the shutdown/reset with no-reboot in a seperate
patch for qmp

> 
>>
>> changes since v1:
>>
>> * refactored as qemu_launch_script, only for non-windows platforms
>> * updated net/tap.c to use qemu_launch_script instead of launch_script
>> * fixed a small error in the option description
>>
>> Dominik Csapak (3):
>>    osdep: add qemu_launch_script for executing scripts
>>    tap: use qemu_launch_script instead of launch_script
>>    vl.c: call optional script when exiting
>>
>>   include/qemu/osdep.h | 12 +++++++++++
>>   net/tap.c            | 56 
>> ++++++++++------------------------------------------
>>   qemu-options.hx      | 20 +++++++++++++++++++
>>   util/oslib-posix.c   | 34 +++++++++++++++++++++++++++++++
>>   util/oslib-win32.c   |  8 ++++++++
>>   vl.c                 | 29 +++++++++++++++++++++++++++
>>   6 files changed, 113 insertions(+), 46 deletions(-)
>>
> 
>