diff --git a/hmp-commands.hx b/hmp-commands.hx index b2f5cd1f47ce045a40fbbbae91d2509ca7eb09c4..07b493ca2770b7b38cbe2ee12971cf5890ec6606 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -492,8 +492,7 @@ ETEXI .args_type = "", .params = "", .help = "send system power down event", - .user_print = monitor_user_noop, - .mhandler.cmd_new = do_system_powerdown, + .mhandler.cmd = hmp_system_powerdown, }, STEXI diff --git a/hmp.c b/hmp.c index 24f30bc948288b60ebfd997ef6faed4511496013..34416fc3c708ca695cee853b1200445804d65cbd 100644 --- a/hmp.c +++ b/hmp.c @@ -109,3 +109,8 @@ void hmp_system_reset(Monitor *mon, const QDict *qdict) { qmp_system_reset(NULL); } + +void hmp_system_powerdown(Monitor *mon, const QDict *qdict) +{ + qmp_system_powerdown(NULL); +} diff --git a/hmp.h b/hmp.h index a49a6e674b55623915bedc34aab6c2004982c0f4..92433cff97b799642253bfa9fdafb245c9ff010b 100644 --- a/hmp.h +++ b/hmp.h @@ -26,5 +26,6 @@ void hmp_info_chardev(Monitor *mon); void hmp_quit(Monitor *mon, const QDict *qdict); void hmp_stop(Monitor *mon, const QDict *qdict); void hmp_system_reset(Monitor *mon, const QDict *qdict); +void hmp_system_powerdown(Monitor *mon, const QDict *qdict); #endif diff --git a/qapi-schema.json b/qapi-schema.json index 02de4b55c66d571a4e22df6d42ed83ba0c96ab88..5922c4a920c7cda4de84c519570af760a2b7904f 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -257,3 +257,17 @@ # Since: 0.14.0 ## { 'command': 'system_reset' } + +## +# @system_powerdown: +# +# Requests that a guest perform a powerdown operation. +# +# Since: 0.14.0 +# +# Notes: A guest may or may not respond to this command. This command +# returning does not indicate that a guest has accepted the request or +# that it has shut down. Many guests will respond to this command by +# prompting the user in some way. +## +{ 'command': 'system_powerdown' } diff --git a/qmp.c b/qmp.c index 51d93832a19fc8d743c27888c0275c7519c0f732..bf58b05a9a2945944c8aa6d72fb5ee182937efd2 100644 --- a/qmp.c +++ b/qmp.c @@ -85,3 +85,8 @@ void qmp_system_reset(Error **errp) { qemu_system_reset_request(); } + +void qmp_system_powerdown(Error **erp) +{ + qemu_system_powerdown_request(); +}