[Qemu-devel] [PATCH v3] qmp: return err msg when powerdown a vm when it isn't in running state
When send system_powerdown to QMP when the vm isn't in RUN_STATE_RUNNING, it will be ignored by system. So reply a err msg with the situation. Signed-off-by: Qinghua Jin --- This is an update of the patch as per Fam Zheng's suggestion: http://lists.gnu.org/archive/html/qemu-devel/2015-12/msg03949.html qmp.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/qmp.c b/qmp.c index 0a1fa19..384df56 100644 --- a/qmp.c +++ b/qmp.c @@ -114,8 +114,13 @@ void qmp_system_reset(Error **errp) qemu_system_reset_request(); } -void qmp_system_powerdown(Error **erp) +void qmp_system_powerdown(Error **errp) { +if (!runstate_check(RUN_STATE_RUNNING)) { +error_setg(errp, + "Can not powerdown virtual machine as it is not running"); +return; +} qemu_system_powerdown_request(); } -- 2.5.0
Re: [Qemu-devel] [PATCH v2] qmp: return err msg when powerdown a vm when it isn't in running state
Thanks for helping me, i'll use the patch format suggested by you. At 2015-12-22 10:06:17, "Fam Zheng" wrote: >On Tue, 12/22 09:42, Qinghua Jin wrote: >> This is an update of patch previously show in msg: >> >> http://lists.gnu.org/archive/html/qemu-devel/2015-12/msg03817.html > >The patch looks good to me, thanks for submitting the patch! There is only one >minor comment: > >Patch revision note should go after the --- line (or the cover letter if you >have one) so that it won't be commited into the git log (because it wouldn't be >informative): > >When send system_powerdown to QMP when the vm isn't in RUN_STATE_RUNNING, >it will be ignored by system. So reply a err msg with the situation. > >Signed-off-by: Qinghua Jin >--- > >This is an update of patch previously show in msg: > > http://lists.gnu.org/archive/html/qemu-devel/2015-12/msg03817.html > > qmp.c | 7 ++- > >> >> When send system_powerdown to QMP when the vm isn't in RUN_STATE_RUNNING, >> it will be ignored by system. So reply a err msg with the situation. >> >> Signed-off-by: Qinghua Jin >> --- >> qmp.c | 7 ++- >> 1 file changed, 6 insertions(+), 1 deletion(-) >> >> diff --git a/qmp.c b/qmp.c >> index 0a1fa19..384df56 100644 >> --- a/qmp.c >> +++ b/qmp.c >> @@ -114,8 +114,13 @@ void qmp_system_reset(Error **errp) >> qemu_system_reset_request(); >> } >> >> -void qmp_system_powerdown(Error **erp) >> +void qmp_system_powerdown(Error **errp) >> { >> +if (!runstate_check(RUN_STATE_RUNNING)) { >> +error_setg(errp, >> + "Can not powerdown virtual machine as it is not >> running"); >> +return; >> +} >> qemu_system_powerdown_request(); >> } >> >> -- >> 2.5.0 >> >> >>
[Qemu-devel] [PATCH v2] qmp: return err msg when powerdown a vm when it isn't in running state
This is an update of patch previously show in msg: http://lists.gnu.org/archive/html/qemu-devel/2015-12/msg03817.html When send system_powerdown to QMP when the vm isn't in RUN_STATE_RUNNING, it will be ignored by system. So reply a err msg with the situation. Signed-off-by: Qinghua Jin --- qmp.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/qmp.c b/qmp.c index 0a1fa19..384df56 100644 --- a/qmp.c +++ b/qmp.c @@ -114,8 +114,13 @@ void qmp_system_reset(Error **errp) qemu_system_reset_request(); } -void qmp_system_powerdown(Error **erp) +void qmp_system_powerdown(Error **errp) { +if (!runstate_check(RUN_STATE_RUNNING)) { +error_setg(errp, + "Can not powerdown virtual machine as it is not running"); +return; +} qemu_system_powerdown_request(); } -- 2.5.0
Re: [Qemu-devel] [PATCH] qmp: return err msg when powerdown a vm when it isn't in running state
Thanks for your help, i'll resubmit the patch right away. At 2015-12-22 01:55:35, "P J P" wrote: >+-- On Mon, 21 Dec 2015, Qinghua Jin wrote --+ >| -void qmp_system_powerdown(Error **erp) >| +void qmp_system_powerdown(Error **errp) >| { >| +if (!runstate_is_running()) { >| +error_setg(errp, "Can't powerdown the Virtual Machine when it isn't >running"); >| +return; >| +} >| qemu_system_powerdown_request(); >| } > > - Maybe direct call to 'if (!runstate_check(RUN_STATE_RUNNING))' is better? > runstate_is_running too invokes the same. Not sure why are there two > functions 'runstate_is_running' & 'runstate_check'. > - Can't -> Can not > - "...the Virtual Machine.." -> "...virtual machine.." (not capitalised) > - "...when it isn't.." -> "as it is not..." > - OR maybe just say -> "Virtual machine is not running" > >-- >Prasad J Pandit / Red Hat Product Security Team >47AF CE69 3A90 54AA 9045 1053 DD13 3D32 FE5B 041F
[Qemu-devel] [PATCH] qmp: return err msg when powerdown a vm when it isn't in running state
When send system_powerdown to QMP when the vm isn't in RUN_STATE_RUNNING, it will be ignored by system. So reply a err msg with the situation. Signed-off-by: Qinghua Jin --- qmp.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/qmp.c b/qmp.c index 0a1fa19..8e43435 100644 --- a/qmp.c +++ b/qmp.c @@ -114,8 +114,12 @@ void qmp_system_reset(Error **errp) qemu_system_reset_request(); } -void qmp_system_powerdown(Error **erp) +void qmp_system_powerdown(Error **errp) { +if (!runstate_is_running()) { +error_setg(errp, "Can't powerdown the Virtual Machine when it isn't running"); +return; +} qemu_system_powerdown_request(); } -- 2.5.0
Re: [Qemu-devel] [Qemu-trivial][PATCH] trace: reflect the file name change
Thanks for helping me, i'll use it next time. At 2015-12-15 11:03:12, "Stefan Hajnoczi" wrote: >On Fri, Dec 11, 2015 at 03:06:12PM +0800, Qinghua Jin wrote: >> Some functions was moved from block.c to block/io.c, so the trace-events >> file should reflect that change. >> >> >> Signed-off-by: Qinghua Jin >> --- >> trace-events | 4 +++- >> 1 file changed, 3 insertions(+), 1 deletion(-) > >Please use git-send-email(1) in the future. I had to manually apply >your patch. > > >Thanks, applied to my tracing-next tree: >https://github.com/stefanha/qemu/commits/tracing-next > >Stefan
[Qemu-devel] [Qemu-trivial][PATCH] trace: reflect the file name change
Some functions was moved from block.c to block/io.c, so the trace-events file should reflect that change. Signed-off-by: Qinghua Jin --- trace-events | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/trace-events b/trace-events index 2fce98e..bec1aa1 100644 --- a/trace-events +++ b/trace-events @@ -59,6 +59,9 @@ virtio_console_chr_event(unsigned int port, int event) "port %u, event %d" # block.c bdrv_open_common(void *bs, const char *filename, int flags, const char *format_name) "bs %p filename \"%s\" flags %#x format_name \"%s\"" +bdrv_lock_medium(void *bs, bool locked) "bs %p locked %d" + +# block/io.c multiwrite_cb(void *mcb, int ret) "mcb %p ret %d" bdrv_aio_multiwrite(void *mcb, int num_callbacks, int num_reqs) "mcb %p num_callbacks %d num_reqs %d" bdrv_aio_discard(void *bs, int64_t sector_num, int nb_sectors, void *opaque) "bs %p sector_num %"PRId64" nb_sectors %d opaque %p" @@ -66,7 +69,6 @@ bdrv_aio_flush(void *bs, void *opaque) "bs %p opaque %p" bdrv_aio_readv(void *bs, int64_t sector_num, int nb_sectors, void *opaque) "bs %p sector_num %"PRId64" nb_sectors %d opaque %p" bdrv_aio_writev(void *bs, int64_t sector_num, int nb_sectors, void *opaque) "bs %p sector_num %"PRId64" nb_sectors %d opaque %p" bdrv_aio_write_zeroes(void *bs, int64_t sector_num, int nb_sectors, int flags, void *opaque) "bs %p sector_num %"PRId64" nb_sectors %d flags %#x opaque %p" -bdrv_lock_medium(void *bs, bool locked) "bs %p locked %d" bdrv_co_readv(void *bs, int64_t sector_num, int nb_sector) "bs %p sector_num %"PRId64" nb_sectors %d" bdrv_co_copy_on_readv(void *bs, int64_t sector_num, int nb_sector) "bs %p sector_num %"PRId64" nb_sectors %d" bdrv_co_readv_no_serialising(void *bs, int64_t sector_num, int nb_sector) "bs %p sector_num %"PRId64" nb_sectors %d" -- 2.4.3
[Qemu-devel] [Bug 1524637] [NEW] system_powerdown/system_reset not working when exec stop on hmp
Public bug reported: system_powerdown/system_reset stops working in qemu for centos kernels if KVM is enabled. qemu versioin: 2.4 linux kernel versioin: 4.2.5 How to reproduce: 1. qemu-system-x86_64 -enable-kvm -drive if=none,id=drive0,file=/media/sda5/image/fc21/fc21.raw -device virtio-blk-pci,drive=drive0,iothread=iothread0 -machine smm=off -object iothread,id=iothread0 -monitor stdio 2. Enter stop in the qemu console, we can see the vm is stopped. 3. Enter system_powerdown in the qemu console 4. Nothing happens. Can you please give a prompt or something else when the vm isn't allowed to powerdown or reset? ** Affects: qemu Importance: Undecided Status: New ** Tags: qemu ** Tags added: qemu -- You received this bug notification because you are a member of qemu- devel-ml, which is subscribed to QEMU. https://bugs.launchpad.net/bugs/1524637 Title: system_powerdown/system_reset not working when exec stop on hmp Status in QEMU: New Bug description: system_powerdown/system_reset stops working in qemu for centos kernels if KVM is enabled. qemu versioin: 2.4 linux kernel versioin: 4.2.5 How to reproduce: 1. qemu-system-x86_64 -enable-kvm -drive if=none,id=drive0,file=/media/sda5/image/fc21/fc21.raw -device virtio-blk-pci,drive=drive0,iothread=iothread0 -machine smm=off -object iothread,id=iothread0 -monitor stdio 2. Enter stop in the qemu console, we can see the vm is stopped. 3. Enter system_powerdown in the qemu console 4. Nothing happens. Can you please give a prompt or something else when the vm isn't allowed to powerdown or reset? To manage notifications about this bug go to: https://bugs.launchpad.net/qemu/+bug/1524637/+subscriptions