qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/3] qapi: return ShutdownCause for events
@ 2018-10-31 11:52 Dominik Csapak
  2018-10-31 11:52 ` [Qemu-devel] [PATCH 1/3] qapi: move ShutdownCause to qapi/run-state.json Dominik Csapak
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Dominik Csapak @ 2018-10-31 11:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: eblake, armbru, pbonzini, kwolf, mreitz

This series improves the QMP SHUTDOWN and RESET events by adding
the ShutdownCause as additional parameter and splitting
the HOST_QMP reason into HOST_QMP_QUIT and HOST_QMP_SYSTEM_RESET
to be able to detect the difference between them when using '--no-reboot'

this is an alternative to my previous patches[1][2] which
added an exit-script/added a 'reset' argument to the events

 1: https://lists.gnu.org/archive/html/qemu-devel/2018-10/msg00697.html
 2: https://lists.gnu.org/archive/html/qemu-devel/2018-10/msg01271.html

Dominik Csapak (3):
  qapi: move ShutdownCause to qapi/run-state.json
  qapi: split host-qmp into quit and system-reset
  qapi: add reason to SHUTDOWN and RESET events

 include/sysemu/sysemu.h    | 20 --------------------
 qapi/run-state.json        | 39 +++++++++++++++++++++++++++++++++++++--
 qmp.c                      |  4 ++--
 tests/qemu-iotests/060.out |  4 ++--
 tests/qemu-iotests/071.out |  4 ++--
 tests/qemu-iotests/081.out |  2 +-
 tests/qemu-iotests/087.out | 12 ++++++------
 tests/qemu-iotests/094.out |  2 +-
 tests/qemu-iotests/109.out | 44 ++++++++++++++++++++++----------------------
 tests/qemu-iotests/117.out |  2 +-
 tests/qemu-iotests/119.out |  2 +-
 tests/qemu-iotests/120.out |  2 +-
 tests/qemu-iotests/127.out |  2 +-
 tests/qemu-iotests/140.out |  2 +-
 tests/qemu-iotests/143.out |  2 +-
 tests/qemu-iotests/156.out |  2 +-
 tests/qemu-iotests/176.out | 16 ++++++++--------
 tests/qemu-iotests/183.out |  4 ++--
 tests/qemu-iotests/184.out | 12 ++++++++----
 tests/qemu-iotests/185.out | 10 +++++-----
 tests/qemu-iotests/191.out |  6 ++++--
 tests/qemu-iotests/195.out |  6 ++++--
 tests/qemu-iotests/223.out |  2 +-
 tests/qemu-iotests/227.out | 12 ++++++++----
 vl.c                       |  4 ++--
 25 files changed, 122 insertions(+), 95 deletions(-)

-- 
2.11.0

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Qemu-devel] [PATCH 1/3] qapi: move ShutdownCause to qapi/run-state.json
  2018-10-31 11:52 [Qemu-devel] [PATCH 0/3] qapi: return ShutdownCause for events Dominik Csapak
@ 2018-10-31 11:52 ` Dominik Csapak
  2018-11-30  9:00   ` Markus Armbruster
  2018-10-31 11:52 ` [Qemu-devel] [PATCH 2/3] qapi: split host-qmp into quit and system-reset Dominik Csapak
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 11+ messages in thread
From: Dominik Csapak @ 2018-10-31 11:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: eblake, armbru, pbonzini, kwolf, mreitz

this makes it possible to use the reason as return value
in a QMP event, such as SHUTDOWN

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 include/sysemu/sysemu.h | 20 --------------------
 qapi/run-state.json     | 33 +++++++++++++++++++++++++++++++++
 2 files changed, 33 insertions(+), 20 deletions(-)

diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index 8d6095d98b..f83522c7e7 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -31,26 +31,6 @@ VMChangeStateEntry *qemu_add_vm_change_state_handler(VMChangeStateHandler *cb,
 void qemu_del_vm_change_state_handler(VMChangeStateEntry *e);
 void vm_state_notify(int running, RunState state);
 
-/* Enumeration of various causes for shutdown. */
-typedef enum ShutdownCause {
-    SHUTDOWN_CAUSE_NONE,          /* No shutdown request pending */
-    SHUTDOWN_CAUSE_HOST_ERROR,    /* An error prevents further use of guest */
-    SHUTDOWN_CAUSE_HOST_QMP,      /* Reaction to a QMP command, like 'quit' */
-    SHUTDOWN_CAUSE_HOST_SIGNAL,   /* Reaction to a signal, such as SIGINT */
-    SHUTDOWN_CAUSE_HOST_UI,       /* Reaction to UI event, like window close */
-    SHUTDOWN_CAUSE_GUEST_SHUTDOWN,/* Guest shutdown/suspend request, via
-                                     ACPI or other hardware-specific means */
-    SHUTDOWN_CAUSE_GUEST_RESET,   /* Guest reset request, and command line
-                                     turns that into a shutdown */
-    SHUTDOWN_CAUSE_GUEST_PANIC,   /* Guest panicked, and command line turns
-                                     that into a shutdown */
-    SHUTDOWN_CAUSE_SUBSYSTEM_RESET,/* Partial guest reset that does not trigger
-                                      QMP events and ignores --no-reboot. This
-                                      is useful for sanitize hypercalls on s390
-                                      that are used during kexec/kdump/boot */
-    SHUTDOWN_CAUSE__MAX,
-} ShutdownCause;
-
 static inline bool shutdown_caused_by_guest(ShutdownCause cause)
 {
     return cause >= SHUTDOWN_CAUSE_GUEST_SHUTDOWN;
diff --git a/qapi/run-state.json b/qapi/run-state.json
index 332e44897b..883bed167c 100644
--- a/qapi/run-state.json
+++ b/qapi/run-state.json
@@ -60,6 +60,39 @@
             'guest-panicked', 'colo', 'preconfig' ] }
 
 ##
+# @ShutdownCause:
+#
+# An enumeration of reasons for a Shutdown.
+#
+# @none: No shutdown request pending
+#
+# @host-error: An error prevented further use of guest
+#
+# @host-qmp: Reaction to a QMP command, like 'quit'
+#
+# @host-signal: Reaction to a signal, such as SIGINT
+#
+# @host-ui: Reaction to a UI event, like window close
+#
+# @guest-shutdown: Guest shutdown/suspend request, via ACPI or other
+#                  hardware-specific means
+#
+# @guest-reset: Guest reset request, and command line turns that into
+#               a shutdown
+#
+# @guest-panic: Guest panicked, and command line turns that into a shutdown
+#
+# @subsystem-reset: Partial guest reset that does not trigger QMP events and
+#                  ignores --no-reboot. This is useful for sanitizing
+#                  hypercalls on s390 that are used during kexec/kdump/boot
+#
+##
+{ 'enum': 'ShutdownCause',
+  'data': [ 'none', 'host-error', 'host-qmp', 'host-signal', 'host-ui',
+            'guest-shutdown', 'guest-reset', 'guest-panic',
+            'subsystem-reset'] }
+
+##
 # @StatusInfo:
 #
 # Information about VCPU run state
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [Qemu-devel] [PATCH 2/3] qapi: split host-qmp into quit and system-reset
  2018-10-31 11:52 [Qemu-devel] [PATCH 0/3] qapi: return ShutdownCause for events Dominik Csapak
  2018-10-31 11:52 ` [Qemu-devel] [PATCH 1/3] qapi: move ShutdownCause to qapi/run-state.json Dominik Csapak
@ 2018-10-31 11:52 ` Dominik Csapak
  2018-11-30  9:41   ` Markus Armbruster
  2018-10-31 11:52 ` [Qemu-devel] [PATCH 3/3] qapi: add reason to SHUTDOWN and RESET events Dominik Csapak
  2018-11-19 13:45 ` [Qemu-devel] [PATCH 0/3] qapi: return ShutdownCause for events Dominik Csapak
  3 siblings, 1 reply; 11+ messages in thread
From: Dominik Csapak @ 2018-10-31 11:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: eblake, armbru, pbonzini, kwolf, mreitz

it is interesting to know whether the shutdown cause was 'quit' or
'reset', especially when using --no-reboot

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 qapi/run-state.json | 10 ++++++----
 qmp.c               |  4 ++--
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/qapi/run-state.json b/qapi/run-state.json
index 883bed167c..c215b6ef83 100644
--- a/qapi/run-state.json
+++ b/qapi/run-state.json
@@ -68,7 +68,9 @@
 #
 # @host-error: An error prevented further use of guest
 #
-# @host-qmp: Reaction to a QMP command, like 'quit'
+# @host-qmp-quit: Reaction to the QMP command 'quit'
+#
+# @host-qmp-system-reset: Reaction to the QMP command 'system_reset'
 #
 # @host-signal: Reaction to a signal, such as SIGINT
 #
@@ -88,9 +90,9 @@
 #
 ##
 { 'enum': 'ShutdownCause',
-  'data': [ 'none', 'host-error', 'host-qmp', 'host-signal', 'host-ui',
-            'guest-shutdown', 'guest-reset', 'guest-panic',
-            'subsystem-reset'] }
+  'data': [ 'none', 'host-error', 'host-qmp-quit', 'host-qmp-system-reset',
+            'host-signal', 'host-ui', 'guest-shutdown', 'guest-reset',
+            'guest-panic', 'subsystem-reset'] }
 
 ##
 # @StatusInfo:
diff --git a/qmp.c b/qmp.c
index e7c0a2fd60..82298f6cb0 100644
--- a/qmp.c
+++ b/qmp.c
@@ -88,7 +88,7 @@ UuidInfo *qmp_query_uuid(Error **errp)
 void qmp_quit(Error **errp)
 {
     no_shutdown = 0;
-    qemu_system_shutdown_request(SHUTDOWN_CAUSE_HOST_QMP);
+    qemu_system_shutdown_request(SHUTDOWN_CAUSE_HOST_QMP_QUIT);
 }
 
 void qmp_stop(Error **errp)
@@ -109,7 +109,7 @@ void qmp_stop(Error **errp)
 
 void qmp_system_reset(Error **errp)
 {
-    qemu_system_reset_request(SHUTDOWN_CAUSE_HOST_QMP);
+    qemu_system_reset_request(SHUTDOWN_CAUSE_HOST_QMP_SYSTEM_RESET);
 }
 
 void qmp_system_powerdown(Error **erp)
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [Qemu-devel] [PATCH 3/3] qapi: add reason to SHUTDOWN and RESET events
  2018-10-31 11:52 [Qemu-devel] [PATCH 0/3] qapi: return ShutdownCause for events Dominik Csapak
  2018-10-31 11:52 ` [Qemu-devel] [PATCH 1/3] qapi: move ShutdownCause to qapi/run-state.json Dominik Csapak
  2018-10-31 11:52 ` [Qemu-devel] [PATCH 2/3] qapi: split host-qmp into quit and system-reset Dominik Csapak
@ 2018-10-31 11:52 ` Dominik Csapak
  2018-11-30  9:43   ` Markus Armbruster
  2018-11-19 13:45 ` [Qemu-devel] [PATCH 0/3] qapi: return ShutdownCause for events Dominik Csapak
  3 siblings, 1 reply; 11+ messages in thread
From: Dominik Csapak @ 2018-10-31 11:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: eblake, armbru, pbonzini, kwolf, mreitz

this makes it possible to determine what the exact reason was for
a RESET or a SHUTDOWN

this patch also fixes the iotests

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 qapi/run-state.json        |  4 ++--
 tests/qemu-iotests/060.out |  4 ++--
 tests/qemu-iotests/071.out |  4 ++--
 tests/qemu-iotests/081.out |  2 +-
 tests/qemu-iotests/087.out | 12 ++++++------
 tests/qemu-iotests/094.out |  2 +-
 tests/qemu-iotests/109.out | 44 ++++++++++++++++++++++----------------------
 tests/qemu-iotests/117.out |  2 +-
 tests/qemu-iotests/119.out |  2 +-
 tests/qemu-iotests/120.out |  2 +-
 tests/qemu-iotests/127.out |  2 +-
 tests/qemu-iotests/140.out |  2 +-
 tests/qemu-iotests/143.out |  2 +-
 tests/qemu-iotests/156.out |  2 +-
 tests/qemu-iotests/176.out | 16 ++++++++--------
 tests/qemu-iotests/183.out |  4 ++--
 tests/qemu-iotests/184.out | 12 ++++++++----
 tests/qemu-iotests/185.out | 10 +++++-----
 tests/qemu-iotests/191.out |  6 ++++--
 tests/qemu-iotests/195.out |  6 ++++--
 tests/qemu-iotests/223.out |  2 +-
 tests/qemu-iotests/227.out | 12 ++++++++----
 vl.c                       |  4 ++--
 23 files changed, 85 insertions(+), 73 deletions(-)

diff --git a/qapi/run-state.json b/qapi/run-state.json
index c215b6ef83..370ccbe498 100644
--- a/qapi/run-state.json
+++ b/qapi/run-state.json
@@ -153,7 +153,7 @@
 #      "timestamp": { "seconds": 1267040730, "microseconds": 682951 } }
 #
 ##
-{ 'event': 'SHUTDOWN', 'data': { 'guest': 'bool' } }
+{ 'event': 'SHUTDOWN', 'data': { 'guest': 'bool', 'reason': 'ShutdownCause' } }
 
 ##
 # @POWERDOWN:
@@ -189,7 +189,7 @@
 #      "timestamp": { "seconds": 1267041653, "microseconds": 9518 } }
 #
 ##
-{ 'event': 'RESET', 'data': { 'guest': 'bool' } }
+{ 'event': 'RESET', 'data': { 'guest': 'bool', 'reason': 'ShutdownCause' } }
 
 ##
 # @STOP:
diff --git a/tests/qemu-iotests/060.out b/tests/qemu-iotests/060.out
index d67c6234a4..af623cfd86 100644
--- a/tests/qemu-iotests/060.out
+++ b/tests/qemu-iotests/060.out
@@ -419,7 +419,7 @@ QMP_VERSION
 write failed: Input/output error
 {"return": ""}
 {"return": {}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
 
 === Testing incoming inactive corrupted image ===
 
@@ -430,7 +430,7 @@ qcow2: Image is corrupt: L2 table offset 0x2a2a2a00 unaligned (L1 index: 0); fur
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "BLOCK_IMAGE_CORRUPTED", "data": {"device": "", "msg": "L2 table offset 0x2a2a2a00 unaligned (L1 index: 0)", "node-name": "drive", "fatal": false}}
 {"return": ""}
 {"return": {}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
 
     corrupt: false
 *** done
diff --git a/tests/qemu-iotests/071.out b/tests/qemu-iotests/071.out
index 1d5e28d730..bca0c02f5c 100644
--- a/tests/qemu-iotests/071.out
+++ b/tests/qemu-iotests/071.out
@@ -46,7 +46,7 @@ QMP_VERSION
 read failed: Input/output error
 {"return": ""}
 {"return": {}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
 
 
 === Testing blkverify on existing block device ===
@@ -85,7 +85,7 @@ wrote 512/512 bytes at offset 0
 read failed: Input/output error
 {"return": ""}
 {"return": {}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
 QEMU_PROG: Failed to flush the L2 table cache: Input/output error
 QEMU_PROG: Failed to flush the refcount block cache: Input/output error
 
diff --git a/tests/qemu-iotests/081.out b/tests/qemu-iotests/081.out
index 2533c31c78..749375f728 100644
--- a/tests/qemu-iotests/081.out
+++ b/tests/qemu-iotests/081.out
@@ -36,7 +36,7 @@ read 10485760/10485760 bytes at offset 0
 10 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 {"return": ""}
 {"return": {}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
 
 
 == using quorum rewrite corrupted mode ==
diff --git a/tests/qemu-iotests/087.out b/tests/qemu-iotests/087.out
index b1318c6ed6..2d92ea847b 100644
--- a/tests/qemu-iotests/087.out
+++ b/tests/qemu-iotests/087.out
@@ -8,7 +8,7 @@ QMP_VERSION
 {"return": {}}
 {"error": {"class": "GenericError", "desc": "'node-name' must be specified for the root node"}}
 {"return": {}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
 
 
 === Duplicate ID ===
@@ -19,7 +19,7 @@ QMP_VERSION
 {"error": {"class": "GenericError", "desc": "node-name=disk is conflicting with a device id"}}
 {"error": {"class": "GenericError", "desc": "Duplicate node name"}}
 {"return": {}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
 
 
 === aio=native without O_DIRECT ===
@@ -29,7 +29,7 @@ QMP_VERSION
 {"return": {}}
 {"error": {"class": "GenericError", "desc": "aio=native was specified, but it requires cache.direct=on, which was not specified."}}
 {"return": {}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
 
 
 === Encrypted image QCow ===
@@ -41,7 +41,7 @@ QMP_VERSION
 {"return": {}}
 {"error": {"class": "GenericError", "desc": "Use of AES-CBC encrypted IMGFMT images is no longer supported in system emulators"}}
 {"return": {}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
 
 
 === Encrypted image LUKS ===
@@ -53,7 +53,7 @@ QMP_VERSION
 {"return": {}}
 {"return": {}}
 {"return": {}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
 
 
 === Missing driver ===
@@ -64,6 +64,6 @@ QMP_VERSION
 {"return": {}}
 {"error": {"class": "GenericError", "desc": "Parameter 'driver' is missing"}}
 {"return": {}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
 
 *** done
diff --git a/tests/qemu-iotests/094.out b/tests/qemu-iotests/094.out
index 665b630b08..f3b9ecf22b 100644
--- a/tests/qemu-iotests/094.out
+++ b/tests/qemu-iotests/094.out
@@ -14,5 +14,5 @@ Formatting 'TEST_DIR/source.IMGFMT', fmt=IMGFMT size=67108864
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "concluded", "id": "src"}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "null", "id": "src"}}
 {"return": {}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
 *** done
diff --git a/tests/qemu-iotests/109.out b/tests/qemu-iotests/109.out
index ad0ee6fb48..9c1159bf08 100644
--- a/tests/qemu-iotests/109.out
+++ b/tests/qemu-iotests/109.out
@@ -18,7 +18,7 @@ WARNING: Image format was not specified for 'TEST_DIR/t.raw' and probing guessed
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "null", "id": "src"}}
 {"return": []}
 {"return": {}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
 read 65536/65536 bytes at offset 0
 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 {"return": {}}
@@ -29,7 +29,7 @@ read 65536/65536 bytes at offset 0
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "BLOCK_JOB_READY", "data": {"device": "src", "len": 1024, "offset": 1024, "speed": 0, "type": "mirror"}}
 {"return": [{"auto-finalize": true, "io-status": "ok", "device": "src", "auto-dismiss": true, "busy": false, "len": 1024, "offset": 1024, "status": "ready", "paused": false, "speed": 0, "ready": true, "type": "mirror"}]}
 {"return": {}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "waiting", "id": "src"}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "pending", "id": "src"}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "src", "len": 1024, "offset": 1024, "speed": 0, "type": "mirror"}}
@@ -56,7 +56,7 @@ WARNING: Image format was not specified for 'TEST_DIR/t.raw' and probing guessed
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "null", "id": "src"}}
 {"return": []}
 {"return": {}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
 read 65536/65536 bytes at offset 0
 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 {"return": {}}
@@ -67,7 +67,7 @@ read 65536/65536 bytes at offset 0
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "BLOCK_JOB_READY", "data": {"device": "src", "len": 197120, "offset": 197120, "speed": 0, "type": "mirror"}}
 {"return": [{"auto-finalize": true, "io-status": "ok", "device": "src", "auto-dismiss": true, "busy": false, "len": 197120, "offset": 197120, "status": "ready", "paused": false, "speed": 0, "ready": true, "type": "mirror"}]}
 {"return": {}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "waiting", "id": "src"}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "pending", "id": "src"}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "src", "len": 197120, "offset": 197120, "speed": 0, "type": "mirror"}}
@@ -94,7 +94,7 @@ WARNING: Image format was not specified for 'TEST_DIR/t.raw' and probing guessed
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "null", "id": "src"}}
 {"return": []}
 {"return": {}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
 read 65536/65536 bytes at offset 0
 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 {"return": {}}
@@ -105,7 +105,7 @@ read 65536/65536 bytes at offset 0
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "BLOCK_JOB_READY", "data": {"device": "src", "len": 327680, "offset": 327680, "speed": 0, "type": "mirror"}}
 {"return": [{"auto-finalize": true, "io-status": "ok", "device": "src", "auto-dismiss": true, "busy": false, "len": 327680, "offset": 327680, "status": "ready", "paused": false, "speed": 0, "ready": true, "type": "mirror"}]}
 {"return": {}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "waiting", "id": "src"}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "pending", "id": "src"}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "src", "len": 327680, "offset": 327680, "speed": 0, "type": "mirror"}}
@@ -132,7 +132,7 @@ WARNING: Image format was not specified for 'TEST_DIR/t.raw' and probing guessed
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "null", "id": "src"}}
 {"return": []}
 {"return": {}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
 read 65536/65536 bytes at offset 0
 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 {"return": {}}
@@ -143,7 +143,7 @@ read 65536/65536 bytes at offset 0
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "BLOCK_JOB_READY", "data": {"device": "src", "len": 1024, "offset": 1024, "speed": 0, "type": "mirror"}}
 {"return": [{"auto-finalize": true, "io-status": "ok", "device": "src", "auto-dismiss": true, "busy": false, "len": 1024, "offset": 1024, "status": "ready", "paused": false, "speed": 0, "ready": true, "type": "mirror"}]}
 {"return": {}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "waiting", "id": "src"}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "pending", "id": "src"}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "src", "len": 1024, "offset": 1024, "speed": 0, "type": "mirror"}}
@@ -170,7 +170,7 @@ WARNING: Image format was not specified for 'TEST_DIR/t.raw' and probing guessed
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "null", "id": "src"}}
 {"return": []}
 {"return": {}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
 read 65536/65536 bytes at offset 0
 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 {"return": {}}
@@ -181,7 +181,7 @@ read 65536/65536 bytes at offset 0
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "BLOCK_JOB_READY", "data": {"device": "src", "len": 65536, "offset": 65536, "speed": 0, "type": "mirror"}}
 {"return": [{"auto-finalize": true, "io-status": "ok", "device": "src", "auto-dismiss": true, "busy": false, "len": 65536, "offset": 65536, "status": "ready", "paused": false, "speed": 0, "ready": true, "type": "mirror"}]}
 {"return": {}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "waiting", "id": "src"}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "pending", "id": "src"}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "src", "len": 65536, "offset": 65536, "speed": 0, "type": "mirror"}}
@@ -208,7 +208,7 @@ WARNING: Image format was not specified for 'TEST_DIR/t.raw' and probing guessed
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "null", "id": "src"}}
 {"return": []}
 {"return": {}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
 read 65536/65536 bytes at offset 0
 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 {"return": {}}
@@ -219,7 +219,7 @@ read 65536/65536 bytes at offset 0
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "BLOCK_JOB_READY", "data": {"device": "src", "len": 2560, "offset": 2560, "speed": 0, "type": "mirror"}}
 {"return": [{"auto-finalize": true, "io-status": "ok", "device": "src", "auto-dismiss": true, "busy": false, "len": 2560, "offset": 2560, "status": "ready", "paused": false, "speed": 0, "ready": true, "type": "mirror"}]}
 {"return": {}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "waiting", "id": "src"}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "pending", "id": "src"}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "src", "len": 2560, "offset": 2560, "speed": 0, "type": "mirror"}}
@@ -245,7 +245,7 @@ WARNING: Image format was not specified for 'TEST_DIR/t.raw' and probing guessed
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "null", "id": "src"}}
 {"return": []}
 {"return": {}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
 read 65536/65536 bytes at offset 0
 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 {"return": {}}
@@ -256,7 +256,7 @@ read 65536/65536 bytes at offset 0
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "BLOCK_JOB_READY", "data": {"device": "src", "len": 2560, "offset": 2560, "speed": 0, "type": "mirror"}}
 {"return": [{"auto-finalize": true, "io-status": "ok", "device": "src", "auto-dismiss": true, "busy": false, "len": 2560, "offset": 2560, "status": "ready", "paused": false, "speed": 0, "ready": true, "type": "mirror"}]}
 {"return": {}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "waiting", "id": "src"}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "pending", "id": "src"}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "src", "len": 2560, "offset": 2560, "speed": 0, "type": "mirror"}}
@@ -282,7 +282,7 @@ WARNING: Image format was not specified for 'TEST_DIR/t.raw' and probing guessed
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "null", "id": "src"}}
 {"return": []}
 {"return": {}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
 read 65536/65536 bytes at offset 0
 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 {"return": {}}
@@ -293,7 +293,7 @@ read 65536/65536 bytes at offset 0
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "BLOCK_JOB_READY", "data": {"device": "src", "len": 31457280, "offset": 31457280, "speed": 0, "type": "mirror"}}
 {"return": [{"auto-finalize": true, "io-status": "ok", "device": "src", "auto-dismiss": true, "busy": false, "len": 31457280, "offset": 31457280, "status": "ready", "paused": false, "speed": 0, "ready": true, "type": "mirror"}]}
 {"return": {}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "waiting", "id": "src"}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "pending", "id": "src"}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "src", "len": 31457280, "offset": 31457280, "speed": 0, "type": "mirror"}}
@@ -319,7 +319,7 @@ WARNING: Image format was not specified for 'TEST_DIR/t.raw' and probing guessed
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "null", "id": "src"}}
 {"return": []}
 {"return": {}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
 read 65536/65536 bytes at offset 0
 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 {"return": {}}
@@ -330,7 +330,7 @@ read 65536/65536 bytes at offset 0
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "BLOCK_JOB_READY", "data": {"device": "src", "len": 327680, "offset": 327680, "speed": 0, "type": "mirror"}}
 {"return": [{"auto-finalize": true, "io-status": "ok", "device": "src", "auto-dismiss": true, "busy": false, "len": 327680, "offset": 327680, "status": "ready", "paused": false, "speed": 0, "ready": true, "type": "mirror"}]}
 {"return": {}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "waiting", "id": "src"}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "pending", "id": "src"}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "src", "len": 327680, "offset": 327680, "speed": 0, "type": "mirror"}}
@@ -356,7 +356,7 @@ WARNING: Image format was not specified for 'TEST_DIR/t.raw' and probing guessed
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "null", "id": "src"}}
 {"return": []}
 {"return": {}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
 read 65536/65536 bytes at offset 0
 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 {"return": {}}
@@ -367,7 +367,7 @@ read 65536/65536 bytes at offset 0
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "BLOCK_JOB_READY", "data": {"device": "src", "len": 2048, "offset": 2048, "speed": 0, "type": "mirror"}}
 {"return": [{"auto-finalize": true, "io-status": "ok", "device": "src", "auto-dismiss": true, "busy": false, "len": 2048, "offset": 2048, "status": "ready", "paused": false, "speed": 0, "ready": true, "type": "mirror"}]}
 {"return": {}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "waiting", "id": "src"}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "pending", "id": "src"}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "src", "len": 2048, "offset": 2048, "speed": 0, "type": "mirror"}}
@@ -390,7 +390,7 @@ WARNING: Image format was not specified for 'TEST_DIR/t.raw' and probing guessed
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "BLOCK_JOB_READY", "data": {"device": "src", "len": 512, "offset": 512, "speed": 0, "type": "mirror"}}
 {"return": [{"auto-finalize": true, "io-status": "ok", "device": "src", "auto-dismiss": true, "busy": false, "len": 512, "offset": 512, "status": "ready", "paused": false, "speed": 0, "ready": true, "type": "mirror"}]}
 {"return": {}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "waiting", "id": "src"}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "pending", "id": "src"}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "src", "len": 512, "offset": 512, "speed": 0, "type": "mirror"}}
@@ -406,7 +406,7 @@ Images are identical.
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "BLOCK_JOB_READY", "data": {"device": "src", "len": 512, "offset": 512, "speed": 0, "type": "mirror"}}
 {"return": [{"auto-finalize": true, "io-status": "ok", "device": "src", "auto-dismiss": true, "busy": false, "len": 512, "offset": 512, "status": "ready", "paused": false, "speed": 0, "ready": true, "type": "mirror"}]}
 {"return": {}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "waiting", "id": "src"}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "pending", "id": "src"}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "BLOCK_JOB_COMPLETED", "data": {"device": "src", "len": 512, "offset": 512, "speed": 0, "type": "mirror"}}
diff --git a/tests/qemu-iotests/117.out b/tests/qemu-iotests/117.out
index 851e214144..57079af167 100644
--- a/tests/qemu-iotests/117.out
+++ b/tests/qemu-iotests/117.out
@@ -7,7 +7,7 @@ wrote 65536/65536 bytes at offset 0
 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 {"return": ""}
 {"return": {}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
 No errors were found on the image.
 read 65536/65536 bytes at offset 0
 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
diff --git a/tests/qemu-iotests/119.out b/tests/qemu-iotests/119.out
index a8743b810e..7b7f0f4bcc 100644
--- a/tests/qemu-iotests/119.out
+++ b/tests/qemu-iotests/119.out
@@ -6,6 +6,6 @@ read 65536/65536 bytes at offset 0
 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 {"return": ""}
 {"return": {}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
 
 *** done
diff --git a/tests/qemu-iotests/120.out b/tests/qemu-iotests/120.out
index 1af1aeb38d..0744c1f136 100644
--- a/tests/qemu-iotests/120.out
+++ b/tests/qemu-iotests/120.out
@@ -6,7 +6,7 @@ wrote 65536/65536 bytes at offset 0
 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 {"return": ""}
 {"return": {}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
 read 65536/65536 bytes at offset 0
 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 read 65536/65536 bytes at offset 0
diff --git a/tests/qemu-iotests/127.out b/tests/qemu-iotests/127.out
index 83b522d4c2..6c98b1824e 100644
--- a/tests/qemu-iotests/127.out
+++ b/tests/qemu-iotests/127.out
@@ -17,5 +17,5 @@ wrote 42/42 bytes at offset 0
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "concluded", "id": "mirror"}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "null", "id": "mirror"}}
 {"return": {}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
 *** done
diff --git a/tests/qemu-iotests/140.out b/tests/qemu-iotests/140.out
index 7295b3d975..704adcef40 100644
--- a/tests/qemu-iotests/140.out
+++ b/tests/qemu-iotests/140.out
@@ -11,5 +11,5 @@ read 65536/65536 bytes at offset 0
 can't open device nbd+unix:///drv?socket=TEST_DIR/nbd: Requested export not available
 server reported: export 'drv' not present
 {"return": {}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
 *** done
diff --git a/tests/qemu-iotests/143.out b/tests/qemu-iotests/143.out
index 1c7fb45543..3e55fcd0ac 100644
--- a/tests/qemu-iotests/143.out
+++ b/tests/qemu-iotests/143.out
@@ -4,5 +4,5 @@ QA output created by 143
 can't open device nbd+unix:///no_such_export?socket=TEST_DIR/nbd: Requested export not available
 server reported: export 'no_such_export' not present
 {"return": {}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
 *** done
diff --git a/tests/qemu-iotests/156.out b/tests/qemu-iotests/156.out
index 34c057b626..4c391a7603 100644
--- a/tests/qemu-iotests/156.out
+++ b/tests/qemu-iotests/156.out
@@ -41,7 +41,7 @@ read 65536/65536 bytes at offset 196608
 {"return": ""}
 
 {"return": {}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
 
 read 65536/65536 bytes at offset 0
 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
diff --git a/tests/qemu-iotests/176.out b/tests/qemu-iotests/176.out
index f03a2e776c..cc33def96b 100644
--- a/tests/qemu-iotests/176.out
+++ b/tests/qemu-iotests/176.out
@@ -170,7 +170,7 @@ QMP_VERSION
 {"return": {}}
 {"return": {}}
 {"return": {}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
 wrote 196608/196608 bytes at offset 2147287040
 192 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 wrote 131072/131072 bytes at offset 2147352576
@@ -207,7 +207,7 @@ QMP_VERSION
 {"return": {}}
 {"return": {"sha256": HASH}}
 {"return": {}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
 
 === Test pass bitmap.1 ===
 
@@ -219,7 +219,7 @@ QMP_VERSION
 {"return": {}}
 {"return": {}}
 {"return": {}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
 wrote 196608/196608 bytes at offset 2147287040
 192 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 wrote 131072/131072 bytes at offset 2147352576
@@ -257,7 +257,7 @@ QMP_VERSION
 {"return": {}}
 {"return": {"sha256": HASH}}
 {"return": {}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
 
 === Test pass bitmap.2 ===
 
@@ -269,7 +269,7 @@ QMP_VERSION
 {"return": {}}
 {"return": {}}
 {"return": {}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
 wrote 196608/196608 bytes at offset 2147287040
 192 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 wrote 131072/131072 bytes at offset 2147352576
@@ -307,7 +307,7 @@ QMP_VERSION
 {"return": {}}
 {"return": {"sha256": HASH}}
 {"return": {}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
 
 === Test pass bitmap.3 ===
 
@@ -319,7 +319,7 @@ QMP_VERSION
 {"return": {}}
 {"return": {}}
 {"return": {}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
 wrote 196608/196608 bytes at offset 2147287040
 192 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 wrote 131072/131072 bytes at offset 2147352576
@@ -354,5 +354,5 @@ QMP_VERSION
 {"return": {}}
 {"return": {"sha256": HASH}}
 {"return": {}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
 *** done
diff --git a/tests/qemu-iotests/183.out b/tests/qemu-iotests/183.out
index 103fdc778b..112cf31f8b 100644
--- a/tests/qemu-iotests/183.out
+++ b/tests/qemu-iotests/183.out
@@ -36,8 +36,8 @@ wrote 65536/65536 bytes at offset 1048576
 
 {"return": {}}
 {"return": {}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
 No errors were found on the image.
 No errors were found on the image.
 wrote 65536/65536 bytes at offset 1048576
diff --git a/tests/qemu-iotests/184.out b/tests/qemu-iotests/184.out
index 672650cde8..3deb3cfb94 100644
--- a/tests/qemu-iotests/184.out
+++ b/tests/qemu-iotests/184.out
@@ -94,7 +94,8 @@ Testing:
     },
     "event": "SHUTDOWN",
     "data": {
-        "guest": false
+        "guest": false,
+        "reason": "host-qmp-quit"
     }
 }
 
@@ -173,7 +174,8 @@ Testing:
     },
     "event": "SHUTDOWN",
     "data": {
-        "guest": false
+        "guest": false,
+        "reason": "host-qmp-quit"
     }
 }
 
@@ -214,7 +216,8 @@ Testing:
     },
     "event": "SHUTDOWN",
     "data": {
-        "guest": false
+        "guest": false,
+        "reason": "host-qmp-quit"
     }
 }
 
@@ -249,7 +252,8 @@ Testing:
     },
     "event": "SHUTDOWN",
     "data": {
-        "guest": false
+        "guest": false,
+        "reason": "host-qmp-quit"
     }
 }
 
diff --git a/tests/qemu-iotests/185.out b/tests/qemu-iotests/185.out
index 4e0ca0dffa..ddfbf3c765 100644
--- a/tests/qemu-iotests/185.out
+++ b/tests/qemu-iotests/185.out
@@ -21,7 +21,7 @@ Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 backing_file=TEST_DIR/t.q
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "disk"}}
 {"return": {}}
 {"return": {}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "BLOCK_JOB_CANCELLED", "data": {"device": "disk", "len": 67108864, "offset": 524288, "speed": 65536, "type": "commit"}}
 
 === Start active commit job and exit qemu ===
@@ -31,7 +31,7 @@ Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 backing_file=TEST_DIR/t.q
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "disk"}}
 {"return": {}}
 {"return": {}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "BLOCK_JOB_CANCELLED", "data": {"device": "disk", "len": 4194304, "offset": 4194304, "speed": 65536, "type": "commit"}}
 
 === Start mirror job and exit qemu ===
@@ -42,7 +42,7 @@ Formatting 'TEST_DIR/t.qcow2.copy', fmt=qcow2 size=67108864 cluster_size=65536 l
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "disk"}}
 {"return": {}}
 {"return": {}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "BLOCK_JOB_CANCELLED", "data": {"device": "disk", "len": 4194304, "offset": 4194304, "speed": 65536, "type": "mirror"}}
 
 === Start backup job and exit qemu ===
@@ -53,7 +53,7 @@ Formatting 'TEST_DIR/t.qcow2.copy', fmt=qcow2 size=67108864 cluster_size=65536 l
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "disk"}}
 {"return": {}}
 {"return": {}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "BLOCK_JOB_CANCELLED", "data": {"device": "disk", "len": 67108864, "offset": 65536, "speed": 65536, "type": "backup"}}
 
 === Start streaming job and exit qemu ===
@@ -63,7 +63,7 @@ Formatting 'TEST_DIR/t.qcow2.copy', fmt=qcow2 size=67108864 cluster_size=65536 l
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "disk"}}
 {"return": {}}
 {"return": {}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
 {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "BLOCK_JOB_CANCELLED", "data": {"device": "disk", "len": 67108864, "offset": 524288, "speed": 65536, "type": "stream"}}
 No errors were found on the image.
 *** done
diff --git a/tests/qemu-iotests/191.out b/tests/qemu-iotests/191.out
index 31a0c7d4c4..a513ccca0b 100644
--- a/tests/qemu-iotests/191.out
+++ b/tests/qemu-iotests/191.out
@@ -389,7 +389,8 @@ wrote 65536/65536 bytes at offset 1048576
     },
     "event": "SHUTDOWN",
     "data": {
-        "guest": false
+        "guest": false,
+        "reason": "host-qmp-quit"
     }
 }
 image: TEST_DIR/t.IMGFMT
@@ -806,7 +807,8 @@ wrote 65536/65536 bytes at offset 1048576
     },
     "event": "SHUTDOWN",
     "data": {
-        "guest": false
+        "guest": false,
+        "reason": "host-qmp-quit"
     }
 }
 image: TEST_DIR/t.IMGFMT
diff --git a/tests/qemu-iotests/195.out b/tests/qemu-iotests/195.out
index 7613575c64..1e9330b1be 100644
--- a/tests/qemu-iotests/195.out
+++ b/tests/qemu-iotests/195.out
@@ -28,7 +28,8 @@ Testing: -drive if=none,file=TEST_DIR/t.IMGFMT,backing.node-name=mid
     },
     "event": "SHUTDOWN",
     "data": {
-        "guest": false
+        "guest": false,
+        "reason": "host-qmp-quit"
     }
 }
 
@@ -65,7 +66,8 @@ Testing: -drive if=none,file=TEST_DIR/t.IMGFMT,node-name=top
     },
     "event": "SHUTDOWN",
     "data": {
-        "guest": false
+        "guest": false,
+        "reason": "host-qmp-quit"
     }
 }
 
diff --git a/tests/qemu-iotests/223.out b/tests/qemu-iotests/223.out
index 33021c8e6a..d150e8ac14 100644
--- a/tests/qemu-iotests/223.out
+++ b/tests/qemu-iotests/223.out
@@ -11,7 +11,7 @@ QMP_VERSION
 {"return": {}}
 {"return": {}}
 {"return": {}}
-{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp-quit"}}
 
 
 === Write part of the file under active bitmap ===
diff --git a/tests/qemu-iotests/227.out b/tests/qemu-iotests/227.out
index 736f2e3b11..e77efaf4cf 100644
--- a/tests/qemu-iotests/227.out
+++ b/tests/qemu-iotests/227.out
@@ -53,7 +53,8 @@ Testing: -drive driver=null-co,if=virtio
     },
     "event": "SHUTDOWN",
     "data": {
-        "guest": false
+        "guest": false,
+        "reason": "host-qmp-quit"
     }
 }
 
@@ -110,7 +111,8 @@ Testing: -drive driver=null-co,if=none
     },
     "event": "SHUTDOWN",
     "data": {
-        "guest": false
+        "guest": false,
+        "reason": "host-qmp-quit"
     }
 }
 
@@ -140,7 +142,8 @@ Testing: -blockdev driver=null-co,node-name=null
     },
     "event": "SHUTDOWN",
     "data": {
-        "guest": false
+        "guest": false,
+        "reason": "host-qmp-quit"
     }
 }
 
@@ -198,7 +201,8 @@ Testing: -blockdev driver=null-co,node-name=null -device virtio-blk,drive=null,i
     },
     "event": "SHUTDOWN",
     "data": {
-        "guest": false
+        "guest": false,
+        "reason": "host-qmp-quit"
     }
 }
 
diff --git a/vl.c b/vl.c
index 1fcacc5caa..a59776638b 100644
--- a/vl.c
+++ b/vl.c
@@ -1677,7 +1677,7 @@ void qemu_system_reset(ShutdownCause reason)
         qemu_devices_reset();
     }
     if (reason != SHUTDOWN_CAUSE_SUBSYSTEM_RESET) {
-        qapi_event_send_reset(shutdown_caused_by_guest(reason));
+        qapi_event_send_reset(shutdown_caused_by_guest(reason), reason);
     }
     cpu_synchronize_all_post_reset();
 }
@@ -1848,7 +1848,7 @@ static bool main_loop_should_exit(void)
     request = qemu_shutdown_requested();
     if (request) {
         qemu_kill_report();
-        qapi_event_send_shutdown(shutdown_caused_by_guest(request));
+        qapi_event_send_shutdown(shutdown_caused_by_guest(request), request);
         if (no_shutdown) {
             vm_stop(RUN_STATE_SHUTDOWN);
         } else {
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [PATCH 0/3] qapi: return ShutdownCause for events
  2018-10-31 11:52 [Qemu-devel] [PATCH 0/3] qapi: return ShutdownCause for events Dominik Csapak
                   ` (2 preceding siblings ...)
  2018-10-31 11:52 ` [Qemu-devel] [PATCH 3/3] qapi: add reason to SHUTDOWN and RESET events Dominik Csapak
@ 2018-11-19 13:45 ` Dominik Csapak
  3 siblings, 0 replies; 11+ messages in thread
From: Dominik Csapak @ 2018-11-19 13:45 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, pbonzini, armbru, mreitz

Hi,

i guess many of you are occupied with 3.1,
but had anyone time to look at this?

kind regards

On 10/31/18 12:52 PM, Dominik Csapak wrote:
> This series improves the QMP SHUTDOWN and RESET events by adding
> the ShutdownCause as additional parameter and splitting
> the HOST_QMP reason into HOST_QMP_QUIT and HOST_QMP_SYSTEM_RESET
> to be able to detect the difference between them when using '--no-reboot'
> 
> this is an alternative to my previous patches[1][2] which
> added an exit-script/added a 'reset' argument to the events
> 
>   1: https://lists.gnu.org/archive/html/qemu-devel/2018-10/msg00697.html
>   2: https://lists.gnu.org/archive/html/qemu-devel/2018-10/msg01271.html
> 
> Dominik Csapak (3):
>    qapi: move ShutdownCause to qapi/run-state.json
>    qapi: split host-qmp into quit and system-reset
>    qapi: add reason to SHUTDOWN and RESET events
> 
>   include/sysemu/sysemu.h    | 20 --------------------
>   qapi/run-state.json        | 39 +++++++++++++++++++++++++++++++++++++--
>   qmp.c                      |  4 ++--
>   tests/qemu-iotests/060.out |  4 ++--
>   tests/qemu-iotests/071.out |  4 ++--
>   tests/qemu-iotests/081.out |  2 +-
>   tests/qemu-iotests/087.out | 12 ++++++------
>   tests/qemu-iotests/094.out |  2 +-
>   tests/qemu-iotests/109.out | 44 ++++++++++++++++++++++----------------------
>   tests/qemu-iotests/117.out |  2 +-
>   tests/qemu-iotests/119.out |  2 +-
>   tests/qemu-iotests/120.out |  2 +-
>   tests/qemu-iotests/127.out |  2 +-
>   tests/qemu-iotests/140.out |  2 +-
>   tests/qemu-iotests/143.out |  2 +-
>   tests/qemu-iotests/156.out |  2 +-
>   tests/qemu-iotests/176.out | 16 ++++++++--------
>   tests/qemu-iotests/183.out |  4 ++--
>   tests/qemu-iotests/184.out | 12 ++++++++----
>   tests/qemu-iotests/185.out | 10 +++++-----
>   tests/qemu-iotests/191.out |  6 ++++--
>   tests/qemu-iotests/195.out |  6 ++++--
>   tests/qemu-iotests/223.out |  2 +-
>   tests/qemu-iotests/227.out | 12 ++++++++----
>   vl.c                       |  4 ++--
>   25 files changed, 122 insertions(+), 95 deletions(-)
> 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [PATCH 1/3] qapi: move ShutdownCause to qapi/run-state.json
  2018-10-31 11:52 ` [Qemu-devel] [PATCH 1/3] qapi: move ShutdownCause to qapi/run-state.json Dominik Csapak
@ 2018-11-30  9:00   ` Markus Armbruster
  2018-11-30  9:15     ` Markus Armbruster
  0 siblings, 1 reply; 11+ messages in thread
From: Markus Armbruster @ 2018-11-30  9:00 UTC (permalink / raw)
  To: Dominik Csapak; +Cc: qemu-devel, kwolf, pbonzini, mreitz

Dominik Csapak <d.csapak@proxmox.com> writes:

> this makes it possible to use the reason as return value
> in a QMP event, such as SHUTDOWN

Please start your sentences with a capital letter and end them with
punctuation.

The patch's purpose could perhaps be stated a bit more clearly.  Let me
try:

  qapi: Turn ShutdownCause into a QAPI enum

  Needed so the patch after next can add ShutdownCause to QMP events
  SHUTDOWN and RESET.

> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
>  include/sysemu/sysemu.h | 20 --------------------
>  qapi/run-state.json     | 33 +++++++++++++++++++++++++++++++++
>  2 files changed, 33 insertions(+), 20 deletions(-)
>
> diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
> index 8d6095d98b..f83522c7e7 100644
> --- a/include/sysemu/sysemu.h
> +++ b/include/sysemu/sysemu.h
> @@ -31,26 +31,6 @@ VMChangeStateEntry *qemu_add_vm_change_state_handler(VMChangeStateHandler *cb,
>  void qemu_del_vm_change_state_handler(VMChangeStateEntry *e);
>  void vm_state_notify(int running, RunState state);
>  
> -/* Enumeration of various causes for shutdown. */
> -typedef enum ShutdownCause {
> -    SHUTDOWN_CAUSE_NONE,          /* No shutdown request pending */
> -    SHUTDOWN_CAUSE_HOST_ERROR,    /* An error prevents further use of guest */
> -    SHUTDOWN_CAUSE_HOST_QMP,      /* Reaction to a QMP command, like 'quit' */
> -    SHUTDOWN_CAUSE_HOST_SIGNAL,   /* Reaction to a signal, such as SIGINT */
> -    SHUTDOWN_CAUSE_HOST_UI,       /* Reaction to UI event, like window close */
> -    SHUTDOWN_CAUSE_GUEST_SHUTDOWN,/* Guest shutdown/suspend request, via
> -                                     ACPI or other hardware-specific means */
> -    SHUTDOWN_CAUSE_GUEST_RESET,   /* Guest reset request, and command line
> -                                     turns that into a shutdown */
> -    SHUTDOWN_CAUSE_GUEST_PANIC,   /* Guest panicked, and command line turns
> -                                     that into a shutdown */
> -    SHUTDOWN_CAUSE_SUBSYSTEM_RESET,/* Partial guest reset that does not trigger
> -                                      QMP events and ignores --no-reboot. This
> -                                      is useful for sanitize hypercalls on s390
> -                                      that are used during kexec/kdump/boot */
> -    SHUTDOWN_CAUSE__MAX,
> -} ShutdownCause;
> -
>  static inline bool shutdown_caused_by_guest(ShutdownCause cause)
>  {
>      return cause >= SHUTDOWN_CAUSE_GUEST_SHUTDOWN;
> diff --git a/qapi/run-state.json b/qapi/run-state.json
> index 332e44897b..883bed167c 100644
> --- a/qapi/run-state.json
> +++ b/qapi/run-state.json
> @@ -60,6 +60,39 @@
>              'guest-panicked', 'colo', 'preconfig' ] }
>  
>  ##
> +# @ShutdownCause:
> +#
> +# An enumeration of reasons for a Shutdown.
> +#
> +# @none: No shutdown request pending
> +#
> +# @host-error: An error prevented further use of guest

Any particular reason for changing the tense from "prevents" to
"prevented"?

> +#
> +# @host-qmp: Reaction to a QMP command, like 'quit'
> +#
> +# @host-signal: Reaction to a signal, such as SIGINT
> +#
> +# @host-ui: Reaction to a UI event, like window close
> +#
> +# @guest-shutdown: Guest shutdown/suspend request, via ACPI or other
> +#                  hardware-specific means
> +#
> +# @guest-reset: Guest reset request, and command line turns that into
> +#               a shutdown
> +#
> +# @guest-panic: Guest panicked, and command line turns that into a shutdown
> +#
> +# @subsystem-reset: Partial guest reset that does not trigger QMP events and
> +#                  ignores --no-reboot. This is useful for sanitizing
> +#                  hypercalls on s390 that are used during kexec/kdump/boot
> +#
> +##
> +{ 'enum': 'ShutdownCause',
> +  'data': [ 'none', 'host-error', 'host-qmp', 'host-signal', 'host-ui',
> +            'guest-shutdown', 'guest-reset', 'guest-panic',
> +            'subsystem-reset'] }
> +
> +##
>  # @StatusInfo:
>  #
>  # Information about VCPU run state

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [PATCH 1/3] qapi: move ShutdownCause to qapi/run-state.json
  2018-11-30  9:00   ` Markus Armbruster
@ 2018-11-30  9:15     ` Markus Armbruster
  0 siblings, 0 replies; 11+ messages in thread
From: Markus Armbruster @ 2018-11-30  9:15 UTC (permalink / raw)
  To: Dominik Csapak; +Cc: qemu-devel, kwolf, pbonzini, mreitz

One more thing...

Markus Armbruster <armbru@redhat.com> writes:

> Dominik Csapak <d.csapak@proxmox.com> writes:
>
>> this makes it possible to use the reason as return value
>> in a QMP event, such as SHUTDOWN
>
> Please start your sentences with a capital letter and end them with
> punctuation.
>
> The patch's purpose could perhaps be stated a bit more clearly.  Let me
> try:
>
>   qapi: Turn ShutdownCause into a QAPI enum
>
>   Needed so the patch after next can add ShutdownCause to QMP events
>   SHUTDOWN and RESET.
>
>> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
>> ---
>>  include/sysemu/sysemu.h | 20 --------------------
>>  qapi/run-state.json     | 33 +++++++++++++++++++++++++++++++++
>>  2 files changed, 33 insertions(+), 20 deletions(-)
>>
>> diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
>> index 8d6095d98b..f83522c7e7 100644
>> --- a/include/sysemu/sysemu.h
>> +++ b/include/sysemu/sysemu.h
>> @@ -31,26 +31,6 @@ VMChangeStateEntry *qemu_add_vm_change_state_handler(VMChangeStateHandler *cb,
>>  void qemu_del_vm_change_state_handler(VMChangeStateEntry *e);
>>  void vm_state_notify(int running, RunState state);
>>  
>> -/* Enumeration of various causes for shutdown. */
>> -typedef enum ShutdownCause {
>> -    SHUTDOWN_CAUSE_NONE,          /* No shutdown request pending */
>> -    SHUTDOWN_CAUSE_HOST_ERROR,    /* An error prevents further use of guest */
>> -    SHUTDOWN_CAUSE_HOST_QMP,      /* Reaction to a QMP command, like 'quit' */
>> -    SHUTDOWN_CAUSE_HOST_SIGNAL,   /* Reaction to a signal, such as SIGINT */
>> -    SHUTDOWN_CAUSE_HOST_UI,       /* Reaction to UI event, like window close */
>> -    SHUTDOWN_CAUSE_GUEST_SHUTDOWN,/* Guest shutdown/suspend request, via
>> -                                     ACPI or other hardware-specific means */
>> -    SHUTDOWN_CAUSE_GUEST_RESET,   /* Guest reset request, and command line
>> -                                     turns that into a shutdown */
>> -    SHUTDOWN_CAUSE_GUEST_PANIC,   /* Guest panicked, and command line turns
>> -                                     that into a shutdown */
>> -    SHUTDOWN_CAUSE_SUBSYSTEM_RESET,/* Partial guest reset that does not trigger
>> -                                      QMP events and ignores --no-reboot. This
>> -                                      is useful for sanitize hypercalls on s390
>> -                                      that are used during kexec/kdump/boot */
>> -    SHUTDOWN_CAUSE__MAX,
>> -} ShutdownCause;
>> -
>>  static inline bool shutdown_caused_by_guest(ShutdownCause cause)
>>  {
>>      return cause >= SHUTDOWN_CAUSE_GUEST_SHUTDOWN;

Because of this, order matters.  Your patch moves the enumeration away,
so readers get even less of a chance to catch this.

>> diff --git a/qapi/run-state.json b/qapi/run-state.json
>> index 332e44897b..883bed167c 100644
>> --- a/qapi/run-state.json
>> +++ b/qapi/run-state.json
>> @@ -60,6 +60,39 @@
>>              'guest-panicked', 'colo', 'preconfig' ] }
>>  
>>  ##
>> +# @ShutdownCause:
>> +#
>> +# An enumeration of reasons for a Shutdown.
>> +#
>> +# @none: No shutdown request pending
>> +#
>> +# @host-error: An error prevented further use of guest
>
> Any particular reason for changing the tense from "prevents" to
> "prevented"?
>
>> +#
>> +# @host-qmp: Reaction to a QMP command, like 'quit'
>> +#
>> +# @host-signal: Reaction to a signal, such as SIGINT
>> +#
>> +# @host-ui: Reaction to a UI event, like window close
>> +#
>> +# @guest-shutdown: Guest shutdown/suspend request, via ACPI or other
>> +#                  hardware-specific means
>> +#
>> +# @guest-reset: Guest reset request, and command line turns that into
>> +#               a shutdown
>> +#
>> +# @guest-panic: Guest panicked, and command line turns that into a shutdown
>> +#
>> +# @subsystem-reset: Partial guest reset that does not trigger QMP events and
>> +#                  ignores --no-reboot. This is useful for sanitizing
>> +#                  hypercalls on s390 that are used during kexec/kdump/boot
>> +#
>> +##
>> +{ 'enum': 'ShutdownCause',

Let's add

       # Beware, shutdown_caused_by_guest() depends on enumeration order

here.  Adding it to the doc comment above would be no good, because
that's external documentation (it would end up in the QEMU QMP reference
manual).

>> +  'data': [ 'none', 'host-error', 'host-qmp', 'host-signal', 'host-ui',
>> +            'guest-shutdown', 'guest-reset', 'guest-panic',
>> +            'subsystem-reset'] }
>> +
>> +##
>>  # @StatusInfo:
>>  #
>>  # Information about VCPU run state

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [PATCH 2/3] qapi: split host-qmp into quit and system-reset
  2018-10-31 11:52 ` [Qemu-devel] [PATCH 2/3] qapi: split host-qmp into quit and system-reset Dominik Csapak
@ 2018-11-30  9:41   ` Markus Armbruster
  2018-11-30 13:20     ` Dominik Csapak
  0 siblings, 1 reply; 11+ messages in thread
From: Markus Armbruster @ 2018-11-30  9:41 UTC (permalink / raw)
  To: Dominik Csapak
  Cc: qemu-devel, kwolf, pbonzini, armbru, mreitz, Pavel Dovgalyuk,
	Eric Blake

Cc: Pavel to assess possible impact on replay.

Cc: Eric to give him a chance to correct misunderstandings of
ShutdownCause.

Dominik Csapak <d.csapak@proxmox.com> writes:

> it is interesting to know whether the shutdown cause was 'quit' or
> 'reset', especially when using --no-reboot

Are you sure it *is* interesting?  I suspect it *will be* only after the
next patch.

Please start your sentences with a capital letter and end them with
punctuation.

> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
>  qapi/run-state.json | 10 ++++++----
>  qmp.c               |  4 ++--
>  2 files changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/qapi/run-state.json b/qapi/run-state.json
> index 883bed167c..c215b6ef83 100644
> --- a/qapi/run-state.json
> +++ b/qapi/run-state.json
> @@ -68,7 +68,9 @@
>  #
>  # @host-error: An error prevented further use of guest
>  #
> -# @host-qmp: Reaction to a QMP command, like 'quit'
> +# @host-qmp-quit: Reaction to the QMP command 'quit'
> +#
> +# @host-qmp-system-reset: Reaction to the QMP command 'system_reset'
>  #
>  # @host-signal: Reaction to a signal, such as SIGINT
>  #
> @@ -88,9 +90,9 @@
>  #
>  ##
>  { 'enum': 'ShutdownCause',
> -  'data': [ 'none', 'host-error', 'host-qmp', 'host-signal', 'host-ui',
> -            'guest-shutdown', 'guest-reset', 'guest-panic',
> -            'subsystem-reset'] }
> +  'data': [ 'none', 'host-error', 'host-qmp-quit', 'host-qmp-system-reset',
> +            'host-signal', 'host-ui', 'guest-shutdown', 'guest-reset',
> +            'guest-panic', 'subsystem-reset'] }
>  
>  ##
>  # @StatusInfo:
> diff --git a/qmp.c b/qmp.c
> index e7c0a2fd60..82298f6cb0 100644
> --- a/qmp.c
> +++ b/qmp.c
> @@ -88,7 +88,7 @@ UuidInfo *qmp_query_uuid(Error **errp)
>  void qmp_quit(Error **errp)
>  {
>      no_shutdown = 0;
> -    qemu_system_shutdown_request(SHUTDOWN_CAUSE_HOST_QMP);
> +    qemu_system_shutdown_request(SHUTDOWN_CAUSE_HOST_QMP_QUIT);
>  }
>  
>  void qmp_stop(Error **errp)
> @@ -109,7 +109,7 @@ void qmp_stop(Error **errp)
>  
>  void qmp_system_reset(Error **errp)
>  {
> -    qemu_system_reset_request(SHUTDOWN_CAUSE_HOST_QMP);
> +    qemu_system_reset_request(SHUTDOWN_CAUSE_HOST_QMP_SYSTEM_RESET);
>  }
>  
>  void qmp_system_powerdown(Error **erp)

Let's see how these guys are used.

qemu_system_shutdown_request() and qemu_system_reset_request() put their
argument in @shutdown_requested or @reset_requested.  There's some
replay magic going on in qemu_system_shutdown_request().

main_loop_should_exit() retrieves them with qemu_shutdown_requested()
and qemu_reset_requested().  @shutdown_requested is only passed to
shutdown_caused_by_guest().  @reset_requested is only passed to
qemu_system_reset().  None of these functions is affected by your
change.  There's some replay magic going on in
qemu_system_reset_requested().

Xen's cpu_handle_ioreq() retrieves them with
qemu_shutdown_requested_get() and qemu_reset_requested_get().  None of
these functions is affected by your change.

Looks like ShutdownCause is overengineered[*]: we're only ever
interested in none, host, guest.  Your PATCH 3 will change that.  Okay,
but your commit message is misleading: this patch has no interesting
effect now.  The change becomes visible only after PATCH 3.

I'd swap PATCH 2 and 3, because that would make writing non-misleading
commit messages easier for me.


[*] Goes back to Eric's commit 7af88279e49..08fba7ac9b6, which were
surely done for a reason.  Perhaps I'm just confused.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [PATCH 3/3] qapi: add reason to SHUTDOWN and RESET events
  2018-10-31 11:52 ` [Qemu-devel] [PATCH 3/3] qapi: add reason to SHUTDOWN and RESET events Dominik Csapak
@ 2018-11-30  9:43   ` Markus Armbruster
  0 siblings, 0 replies; 11+ messages in thread
From: Markus Armbruster @ 2018-11-30  9:43 UTC (permalink / raw)
  To: Dominik Csapak; +Cc: qemu-devel, kwolf, pbonzini, mreitz

Dominik Csapak <d.csapak@proxmox.com> writes:

> this makes it possible to determine what the exact reason was for
> a RESET or a SHUTDOWN

Yes, but why is that useful?  I can guess, but the commit shouldn't make
me guess.

Please start your sentences with a capital letter and end them with
punctuation.

> this patch also fixes the iotests

> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [PATCH 2/3] qapi: split host-qmp into quit and system-reset
  2018-11-30  9:41   ` Markus Armbruster
@ 2018-11-30 13:20     ` Dominik Csapak
  2018-11-30 13:55       ` Eric Blake
  0 siblings, 1 reply; 11+ messages in thread
From: Dominik Csapak @ 2018-11-30 13:20 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: kwolf, qemu-devel, mreitz, Pavel Dovgalyuk, pbonzini

On 11/30/18 10:41 AM, Markus Armbruster wrote:
> Cc: Pavel to assess possible impact on replay.
> 
> Cc: Eric to give him a chance to correct misunderstandings of
> ShutdownCause.
> 
> Dominik Csapak <d.csapak@proxmox.com> writes:
> 
>> it is interesting to know whether the shutdown cause was 'quit' or
>> 'reset', especially when using --no-reboot
> 
> Are you sure it *is* interesting?  I suspect it *will be* only after the
> next patch.
> 
> Please start your sentences with a capital letter and end them with
> punctuation.
> 
>> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
>> ---
>>   qapi/run-state.json | 10 ++++++----
>>   qmp.c               |  4 ++--
>>   2 files changed, 8 insertions(+), 6 deletions(-)
>>
>> diff --git a/qapi/run-state.json b/qapi/run-state.json
>> index 883bed167c..c215b6ef83 100644
>> --- a/qapi/run-state.json
>> +++ b/qapi/run-state.json
>> @@ -68,7 +68,9 @@
>>   #
>>   # @host-error: An error prevented further use of guest
>>   #
>> -# @host-qmp: Reaction to a QMP command, like 'quit'
>> +# @host-qmp-quit: Reaction to the QMP command 'quit'
>> +#
>> +# @host-qmp-system-reset: Reaction to the QMP command 'system_reset'
>>   #
>>   # @host-signal: Reaction to a signal, such as SIGINT
>>   #
>> @@ -88,9 +90,9 @@
>>   #
>>   ##
>>   { 'enum': 'ShutdownCause',
>> -  'data': [ 'none', 'host-error', 'host-qmp', 'host-signal', 'host-ui',
>> -            'guest-shutdown', 'guest-reset', 'guest-panic',
>> -            'subsystem-reset'] }
>> +  'data': [ 'none', 'host-error', 'host-qmp-quit', 'host-qmp-system-reset',
>> +            'host-signal', 'host-ui', 'guest-shutdown', 'guest-reset',
>> +            'guest-panic', 'subsystem-reset'] }
>>   
>>   ##
>>   # @StatusInfo:
>> diff --git a/qmp.c b/qmp.c
>> index e7c0a2fd60..82298f6cb0 100644
>> --- a/qmp.c
>> +++ b/qmp.c
>> @@ -88,7 +88,7 @@ UuidInfo *qmp_query_uuid(Error **errp)
>>   void qmp_quit(Error **errp)
>>   {
>>       no_shutdown = 0;
>> -    qemu_system_shutdown_request(SHUTDOWN_CAUSE_HOST_QMP);
>> +    qemu_system_shutdown_request(SHUTDOWN_CAUSE_HOST_QMP_QUIT);
>>   }
>>   
>>   void qmp_stop(Error **errp)
>> @@ -109,7 +109,7 @@ void qmp_stop(Error **errp)
>>   
>>   void qmp_system_reset(Error **errp)
>>   {
>> -    qemu_system_reset_request(SHUTDOWN_CAUSE_HOST_QMP);
>> +    qemu_system_reset_request(SHUTDOWN_CAUSE_HOST_QMP_SYSTEM_RESET);
>>   }
>>   
>>   void qmp_system_powerdown(Error **erp)
> 
> Let's see how these guys are used.
> 
> qemu_system_shutdown_request() and qemu_system_reset_request() put their
> argument in @shutdown_requested or @reset_requested.  There's some
> replay magic going on in qemu_system_shutdown_request().
> 
> main_loop_should_exit() retrieves them with qemu_shutdown_requested()
> and qemu_reset_requested().  @shutdown_requested is only passed to
> shutdown_caused_by_guest().  @reset_requested is only passed to
> qemu_system_reset().  None of these functions is affected by your
> change.  There's some replay magic going on in
> qemu_system_reset_requested().
> 
> Xen's cpu_handle_ioreq() retrieves them with
> qemu_shutdown_requested_get() and qemu_reset_requested_get().  None of
> these functions is affected by your change.
> 
> Looks like ShutdownCause is overengineered[*]: we're only ever
> interested in none, host, guest.  Your PATCH 3 will change that.  Okay,
> but your commit message is misleading: this patch has no interesting
> effect now.  The change becomes visible only after PATCH 3.
> 
> I'd swap PATCH 2 and 3, because that would make writing non-misleading
> commit messages easier for me.
> 
> 
> [*] Goes back to Eric's commit 7af88279e49..08fba7ac9b6, which were
> surely done for a reason.  Perhaps I'm just confused.
> 
> 


hi,

yeah switching 2 and 3 makes sense, i guess i did it this way so that
i only have to touch the iotests one time

should i fix the iotests in both 2 and 3 when i switch them ?
(with 2 the reason gets added there, and 3 changes the reason)
or should i send an extra patch (4/4) that fixes only the iotests?
or only change them in 3/3 ?

when this is clear, i will send a v2 with all your remarks fixed

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Qemu-devel] [PATCH 2/3] qapi: split host-qmp into quit and system-reset
  2018-11-30 13:20     ` Dominik Csapak
@ 2018-11-30 13:55       ` Eric Blake
  0 siblings, 0 replies; 11+ messages in thread
From: Eric Blake @ 2018-11-30 13:55 UTC (permalink / raw)
  To: Dominik Csapak, Markus Armbruster
  Cc: kwolf, pbonzini, qemu-devel, Pavel Dovgalyuk, mreitz

On 11/30/18 7:20 AM, Dominik Csapak wrote:
> On 11/30/18 10:41 AM, Markus Armbruster wrote:
>> Cc: Pavel to assess possible impact on replay.
>>
>> Cc: Eric to give him a chance to correct misunderstandings of
>> ShutdownCause.

I still need to look more closely at the series, but in answer to your 
question,


> 
> yeah switching 2 and 3 makes sense, i guess i did it this way so that
> i only have to touch the iotests one time
> 
> should i fix the iotests in both 2 and 3 when i switch them ?
> (with 2 the reason gets added there, and 3 changes the reason)
> or should i send an extra patch (4/4) that fixes only the iotests?
> or only change them in 3/3 ?

Ideally, iotests should pass after each commit (reduces chance of 
confusion down the road when a 'git bisect' is trying to pinpoint a 
cause of some other iotest failure).  iotests are a bit fuzzier than 
'make check' in terms of how long things are allowed to be checked in 
with known failures (in part because iotests has so many different ways 
to be run, and not all configurations are run all the times, so many 
corner-case configurations end up broken over long stretches of commits 
without realizing it), so that at least gives you some flexibility. But 
if you KNOW the test is broken, and reordering the patches or tweaking 
the tests to pass is easy, then you might as well do it.

Churn in the tests as output changes is not too bad - especially if it 
shows that the patch is accomplishing its stated purpose of making the 
expected output nicer.  So having the test fixed in 2 to show the reason 
and again in 3 to show a change in the reason makes sense for a patch 
series.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2018-11-30 13:55 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-31 11:52 [Qemu-devel] [PATCH 0/3] qapi: return ShutdownCause for events Dominik Csapak
2018-10-31 11:52 ` [Qemu-devel] [PATCH 1/3] qapi: move ShutdownCause to qapi/run-state.json Dominik Csapak
2018-11-30  9:00   ` Markus Armbruster
2018-11-30  9:15     ` Markus Armbruster
2018-10-31 11:52 ` [Qemu-devel] [PATCH 2/3] qapi: split host-qmp into quit and system-reset Dominik Csapak
2018-11-30  9:41   ` Markus Armbruster
2018-11-30 13:20     ` Dominik Csapak
2018-11-30 13:55       ` Eric Blake
2018-10-31 11:52 ` [Qemu-devel] [PATCH 3/3] qapi: add reason to SHUTDOWN and RESET events Dominik Csapak
2018-11-30  9:43   ` Markus Armbruster
2018-11-19 13:45 ` [Qemu-devel] [PATCH 0/3] qapi: return ShutdownCause for events Dominik Csapak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).