提交 ecd7a0d5 编写于 作者: D Dominik Csapak 提交者: Markus Armbruster

qmp: Add reason to SHUTDOWN and RESET events

This makes it possible to determine what the exact reason was for
a RESET or a SHUTDOWN. A management layer might need the specific reason
of those events to determine which cleanups or other actions it needs to do.

This patch also updates the iotests to the new expected output that includes
the reason.
Signed-off-by: NDominik Csapak <d.csapak@proxmox.com>
Message-Id: <20181205110131.23049-3-d.csapak@proxmox.com>
Reviewed-by: NMarkus Armbruster <armbru@redhat.com>
[Commit message tweaked]
Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
上级 d43013e2
...@@ -141,6 +141,8 @@ ...@@ -141,6 +141,8 @@
# a guest-initiated ACPI shutdown request or other hardware-specific action) # a guest-initiated ACPI shutdown request or other hardware-specific action)
# rather than a host request (such as sending qemu a SIGINT). (since 2.10) # rather than a host request (such as sending qemu a SIGINT). (since 2.10)
# #
# @reason: The @ShutdownCause which resulted in the SHUTDOWN. (since 4.0)
#
# Note: If the command-line option "-no-shutdown" has been specified, qemu will # Note: If the command-line option "-no-shutdown" has been specified, qemu will
# not exit, and a STOP event will eventually follow the SHUTDOWN event # not exit, and a STOP event will eventually follow the SHUTDOWN event
# #
...@@ -152,7 +154,7 @@ ...@@ -152,7 +154,7 @@
# "timestamp": { "seconds": 1267040730, "microseconds": 682951 } } # "timestamp": { "seconds": 1267040730, "microseconds": 682951 } }
# #
## ##
{ 'event': 'SHUTDOWN', 'data': { 'guest': 'bool' } } { 'event': 'SHUTDOWN', 'data': { 'guest': 'bool', 'reason': 'ShutdownCause' } }
## ##
# @POWERDOWN: # @POWERDOWN:
...@@ -180,6 +182,8 @@ ...@@ -180,6 +182,8 @@
# rather than a host request (such as the QMP command system_reset). # rather than a host request (such as the QMP command system_reset).
# (since 2.10) # (since 2.10)
# #
# @reason: The @ShutdownCause of the RESET. (since 4.0)
#
# Since: 0.12.0 # Since: 0.12.0
# #
# Example: # Example:
...@@ -188,7 +192,7 @@ ...@@ -188,7 +192,7 @@
# "timestamp": { "seconds": 1267041653, "microseconds": 9518 } } # "timestamp": { "seconds": 1267041653, "microseconds": 9518 } }
# #
## ##
{ 'event': 'RESET', 'data': { 'guest': 'bool' } } { 'event': 'RESET', 'data': { 'guest': 'bool', 'reason': 'ShutdownCause' } }
## ##
# @STOP: # @STOP:
......
...@@ -419,7 +419,7 @@ QMP_VERSION ...@@ -419,7 +419,7 @@ QMP_VERSION
write failed: Input/output error write failed: Input/output error
{"return": ""} {"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"}}
=== Testing incoming inactive corrupted image === === Testing incoming inactive corrupted image ===
...@@ -430,7 +430,7 @@ qcow2: Image is corrupt: L2 table offset 0x2a2a2a00 unaligned (L1 index: 0); fur ...@@ -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}} {"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": ""}
{"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"}}
corrupt: false corrupt: false
*** done *** done
...@@ -46,7 +46,7 @@ QMP_VERSION ...@@ -46,7 +46,7 @@ QMP_VERSION
read failed: Input/output error read failed: Input/output error
{"return": ""} {"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"}}
=== Testing blkverify on existing block device === === Testing blkverify on existing block device ===
...@@ -85,7 +85,7 @@ wrote 512/512 bytes at offset 0 ...@@ -85,7 +85,7 @@ wrote 512/512 bytes at offset 0
read failed: Input/output error read failed: Input/output error
{"return": ""} {"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"}}
QEMU_PROG: Failed to flush the L2 table cache: Input/output error QEMU_PROG: Failed to flush the L2 table cache: Input/output error
QEMU_PROG: Failed to flush the refcount block cache: Input/output error QEMU_PROG: Failed to flush the refcount block cache: Input/output error
......
...@@ -36,7 +36,7 @@ read 10485760/10485760 bytes at offset 0 ...@@ -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) 10 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
{"return": ""} {"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"}}
== using quorum rewrite corrupted mode == == using quorum rewrite corrupted mode ==
...@@ -80,7 +80,7 @@ QMP_VERSION ...@@ -80,7 +80,7 @@ QMP_VERSION
{"return": {}} {"return": {}}
{"return": {}} {"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"}}
Testing: Testing:
QMP_VERSION QMP_VERSION
...@@ -89,7 +89,7 @@ QMP_VERSION ...@@ -89,7 +89,7 @@ QMP_VERSION
{"return": {}} {"return": {}}
{"error": {"class": "GenericError", "desc": "Cannot add a child to a quorum in blkverify mode"}} {"error": {"class": "GenericError", "desc": "Cannot add a child to a quorum in blkverify mode"}}
{"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"}}
== dynamically removing a child from a quorum == == dynamically removing a child from a quorum ==
...@@ -99,7 +99,7 @@ QMP_VERSION ...@@ -99,7 +99,7 @@ QMP_VERSION
{"return": {}} {"return": {}}
{"return": {}} {"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"}}
Testing: Testing:
QMP_VERSION QMP_VERSION
...@@ -107,7 +107,7 @@ QMP_VERSION ...@@ -107,7 +107,7 @@ QMP_VERSION
{"return": {}} {"return": {}}
{"error": {"class": "GenericError", "desc": "The number of children cannot be lower than the vote threshold 2"}} {"error": {"class": "GenericError", "desc": "The number of children cannot be lower than the vote threshold 2"}}
{"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"}}
Testing: Testing:
QMP_VERSION QMP_VERSION
...@@ -115,7 +115,7 @@ QMP_VERSION ...@@ -115,7 +115,7 @@ QMP_VERSION
{"error": {"class": "GenericError", "desc": "blkverify=on can only be set if there are exactly two files and vote-threshold is 2"}} {"error": {"class": "GenericError", "desc": "blkverify=on can only be set if there are exactly two files and vote-threshold is 2"}}
{"error": {"class": "GenericError", "desc": "Cannot find device=drive0-quorum nor node_name=drive0-quorum"}} {"error": {"class": "GenericError", "desc": "Cannot find device=drive0-quorum nor node_name=drive0-quorum"}}
{"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"}}
Testing: Testing:
QMP_VERSION QMP_VERSION
...@@ -123,6 +123,6 @@ QMP_VERSION ...@@ -123,6 +123,6 @@ QMP_VERSION
{"return": {}} {"return": {}}
{"error": {"class": "GenericError", "desc": "The number of children cannot be lower than the vote threshold 2"}} {"error": {"class": "GenericError", "desc": "The number of children cannot be lower than the vote threshold 2"}}
{"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"}}
*** done *** done
...@@ -8,7 +8,7 @@ QMP_VERSION ...@@ -8,7 +8,7 @@ QMP_VERSION
{"return": {}} {"return": {}}
{"error": {"class": "GenericError", "desc": "'node-name' must be specified for the root node"}} {"error": {"class": "GenericError", "desc": "'node-name' must be specified for the root node"}}
{"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"}}
=== Duplicate ID === === Duplicate ID ===
...@@ -19,7 +19,7 @@ QMP_VERSION ...@@ -19,7 +19,7 @@ QMP_VERSION
{"error": {"class": "GenericError", "desc": "node-name=disk is conflicting with a device id"}} {"error": {"class": "GenericError", "desc": "node-name=disk is conflicting with a device id"}}
{"error": {"class": "GenericError", "desc": "Duplicate node name"}} {"error": {"class": "GenericError", "desc": "Duplicate node name"}}
{"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"}}
=== aio=native without O_DIRECT === === aio=native without O_DIRECT ===
...@@ -29,7 +29,7 @@ QMP_VERSION ...@@ -29,7 +29,7 @@ QMP_VERSION
{"return": {}} {"return": {}}
{"error": {"class": "GenericError", "desc": "aio=native was specified, but it requires cache.direct=on, which was not specified."}} {"error": {"class": "GenericError", "desc": "aio=native was specified, but it requires cache.direct=on, which was not specified."}}
{"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"}}
=== Encrypted image QCow === === Encrypted image QCow ===
...@@ -41,7 +41,7 @@ QMP_VERSION ...@@ -41,7 +41,7 @@ QMP_VERSION
{"return": {}} {"return": {}}
{"error": {"class": "GenericError", "desc": "Use of AES-CBC encrypted IMGFMT images is no longer supported in system emulators"}} {"error": {"class": "GenericError", "desc": "Use of AES-CBC encrypted IMGFMT images is no longer supported in system emulators"}}
{"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"}}
=== Encrypted image LUKS === === Encrypted image LUKS ===
...@@ -53,7 +53,7 @@ QMP_VERSION ...@@ -53,7 +53,7 @@ QMP_VERSION
{"return": {}} {"return": {}}
{"return": {}} {"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"}}
=== Missing driver === === Missing driver ===
...@@ -64,6 +64,6 @@ QMP_VERSION ...@@ -64,6 +64,6 @@ QMP_VERSION
{"return": {}} {"return": {}}
{"error": {"class": "GenericError", "desc": "Parameter 'driver' is missing"}} {"error": {"class": "GenericError", "desc": "Parameter 'driver' is missing"}}
{"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"}}
*** done *** done
...@@ -14,5 +14,5 @@ Formatting 'TEST_DIR/source.IMGFMT', fmt=IMGFMT size=67108864 ...@@ -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": "concluded", "id": "src"}}
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "null", "id": "src"}} {"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"}}
*** done *** done
此差异已折叠。
...@@ -7,7 +7,7 @@ wrote 65536/65536 bytes at offset 0 ...@@ -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) 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
{"return": ""} {"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"}}
No errors were found on the image. No errors were found on the image.
read 65536/65536 bytes at offset 0 read 65536/65536 bytes at offset 0
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
......
...@@ -6,6 +6,6 @@ read 65536/65536 bytes at offset 0 ...@@ -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) 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
{"return": ""} {"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"}}
*** done *** done
...@@ -6,7 +6,7 @@ wrote 65536/65536 bytes at offset 0 ...@@ -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) 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
{"return": ""} {"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"}}
read 65536/65536 bytes at offset 0 read 65536/65536 bytes at offset 0
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
read 65536/65536 bytes at offset 0 read 65536/65536 bytes at offset 0
......
...@@ -17,5 +17,5 @@ wrote 42/42 bytes at offset 0 ...@@ -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": "concluded", "id": "mirror"}}
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "null", "id": "mirror"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "null", "id": "mirror"}}
{"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"}}
*** done *** done
...@@ -11,5 +11,5 @@ read 65536/65536 bytes at offset 0 ...@@ -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 can't open device nbd+unix:///drv?socket=TEST_DIR/nbd: Requested export not available
server reported: export 'drv' not present server reported: export 'drv' not present
{"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"}}
*** done *** done
...@@ -4,5 +4,5 @@ QA output created by 143 ...@@ -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 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 server reported: export 'no_such_export' not present
{"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"}}
*** done *** done
...@@ -41,7 +41,7 @@ read 65536/65536 bytes at offset 196608 ...@@ -41,7 +41,7 @@ read 65536/65536 bytes at offset 196608
{"return": ""} {"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"}}
read 65536/65536 bytes at offset 0 read 65536/65536 bytes at offset 0
64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 64 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
......
...@@ -170,7 +170,7 @@ QMP_VERSION ...@@ -170,7 +170,7 @@ QMP_VERSION
{"return": {}} {"return": {}}
{"return": {}} {"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"}}
wrote 196608/196608 bytes at offset 2147287040 wrote 196608/196608 bytes at offset 2147287040
192 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 192 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 131072/131072 bytes at offset 2147352576 wrote 131072/131072 bytes at offset 2147352576
...@@ -207,7 +207,7 @@ QMP_VERSION ...@@ -207,7 +207,7 @@ QMP_VERSION
{"return": {}} {"return": {}}
{"return": {"sha256": HASH}} {"return": {"sha256": HASH}}
{"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"}}
=== Test pass bitmap.1 === === Test pass bitmap.1 ===
...@@ -219,7 +219,7 @@ QMP_VERSION ...@@ -219,7 +219,7 @@ QMP_VERSION
{"return": {}} {"return": {}}
{"return": {}} {"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"}}
wrote 196608/196608 bytes at offset 2147287040 wrote 196608/196608 bytes at offset 2147287040
192 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 192 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 131072/131072 bytes at offset 2147352576 wrote 131072/131072 bytes at offset 2147352576
...@@ -257,7 +257,7 @@ QMP_VERSION ...@@ -257,7 +257,7 @@ QMP_VERSION
{"return": {}} {"return": {}}
{"return": {"sha256": HASH}} {"return": {"sha256": HASH}}
{"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"}}
=== Test pass bitmap.2 === === Test pass bitmap.2 ===
...@@ -269,7 +269,7 @@ QMP_VERSION ...@@ -269,7 +269,7 @@ QMP_VERSION
{"return": {}} {"return": {}}
{"return": {}} {"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"}}
wrote 196608/196608 bytes at offset 2147287040 wrote 196608/196608 bytes at offset 2147287040
192 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 192 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 131072/131072 bytes at offset 2147352576 wrote 131072/131072 bytes at offset 2147352576
...@@ -307,7 +307,7 @@ QMP_VERSION ...@@ -307,7 +307,7 @@ QMP_VERSION
{"return": {}} {"return": {}}
{"return": {"sha256": HASH}} {"return": {"sha256": HASH}}
{"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"}}
=== Test pass bitmap.3 === === Test pass bitmap.3 ===
...@@ -319,7 +319,7 @@ QMP_VERSION ...@@ -319,7 +319,7 @@ QMP_VERSION
{"return": {}} {"return": {}}
{"return": {}} {"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"}}
wrote 196608/196608 bytes at offset 2147287040 wrote 196608/196608 bytes at offset 2147287040
192 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) 192 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
wrote 131072/131072 bytes at offset 2147352576 wrote 131072/131072 bytes at offset 2147352576
...@@ -354,5 +354,5 @@ QMP_VERSION ...@@ -354,5 +354,5 @@ QMP_VERSION
{"return": {}} {"return": {}}
{"return": {"sha256": HASH}} {"return": {"sha256": HASH}}
{"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"}}
*** done *** done
...@@ -36,8 +36,8 @@ wrote 65536/65536 bytes at offset 1048576 ...@@ -36,8 +36,8 @@ wrote 65536/65536 bytes at offset 1048576
{"return": {}} {"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"}}
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-qmp"}}
No errors were found on the image. No errors were found on the image.
No errors were found on the image. No errors were found on the image.
wrote 65536/65536 bytes at offset 1048576 wrote 65536/65536 bytes at offset 1048576
......
...@@ -94,7 +94,8 @@ Testing: ...@@ -94,7 +94,8 @@ Testing:
}, },
"event": "SHUTDOWN", "event": "SHUTDOWN",
"data": { "data": {
"guest": false "guest": false,
"reason": "host-qmp"
} }
} }
...@@ -173,7 +174,8 @@ Testing: ...@@ -173,7 +174,8 @@ Testing:
}, },
"event": "SHUTDOWN", "event": "SHUTDOWN",
"data": { "data": {
"guest": false "guest": false,
"reason": "host-qmp"
} }
} }
...@@ -214,7 +216,8 @@ Testing: ...@@ -214,7 +216,8 @@ Testing:
}, },
"event": "SHUTDOWN", "event": "SHUTDOWN",
"data": { "data": {
"guest": false "guest": false,
"reason": "host-qmp"
} }
} }
...@@ -249,7 +252,8 @@ Testing: ...@@ -249,7 +252,8 @@ Testing:
}, },
"event": "SHUTDOWN", "event": "SHUTDOWN",
"data": { "data": {
"guest": false "guest": false,
"reason": "host-qmp"
} }
} }
......
...@@ -21,7 +21,7 @@ Formatting 'TEST_DIR/t.qcow2', fmt=qcow2 size=67108864 backing_file=TEST_DIR/t.q ...@@ -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"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "disk"}}
{"return": {}} {"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"}}
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_CANCELLED", "data": {"device": "disk", "len": 67108864, "offset": 524288, "speed": 65536, "type": "commit"}} {"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 === === 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 ...@@ -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"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "disk"}}
{"return": {}} {"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"}}
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_CANCELLED", "data": {"device": "disk", "len": 4194304, "offset": 4194304, "speed": 65536, "type": "commit"}} {"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 === === Start mirror job and exit qemu ===
...@@ -42,7 +42,7 @@ Formatting 'TEST_DIR/t.qcow2.copy', fmt=qcow2 size=67108864 cluster_size=65536 l ...@@ -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"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "disk"}}
{"return": {}} {"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"}}
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_CANCELLED", "data": {"device": "disk", "len": 4194304, "offset": 4194304, "speed": 65536, "type": "mirror"}} {"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 === === Start backup job and exit qemu ===
...@@ -53,7 +53,7 @@ Formatting 'TEST_DIR/t.qcow2.copy', fmt=qcow2 size=67108864 cluster_size=65536 l ...@@ -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"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "disk"}}
{"return": {}} {"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"}}
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_CANCELLED", "data": {"device": "disk", "len": 67108864, "offset": 65536, "speed": 65536, "type": "backup"}} {"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 === === Start streaming job and exit qemu ===
...@@ -63,7 +63,7 @@ Formatting 'TEST_DIR/t.qcow2.copy', fmt=qcow2 size=67108864 cluster_size=65536 l ...@@ -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"}} {"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "JOB_STATUS_CHANGE", "data": {"status": "running", "id": "disk"}}
{"return": {}} {"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"}}
{"timestamp": {"seconds": TIMESTAMP, "microseconds": TIMESTAMP}, "event": "BLOCK_JOB_CANCELLED", "data": {"device": "disk", "len": 67108864, "offset": 524288, "speed": 65536, "type": "stream"}} {"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. No errors were found on the image.
*** done *** done
...@@ -389,7 +389,8 @@ wrote 65536/65536 bytes at offset 1048576 ...@@ -389,7 +389,8 @@ wrote 65536/65536 bytes at offset 1048576
}, },
"event": "SHUTDOWN", "event": "SHUTDOWN",
"data": { "data": {
"guest": false "guest": false,
"reason": "host-qmp"
} }
} }
image: TEST_DIR/t.IMGFMT image: TEST_DIR/t.IMGFMT
...@@ -806,7 +807,8 @@ wrote 65536/65536 bytes at offset 1048576 ...@@ -806,7 +807,8 @@ wrote 65536/65536 bytes at offset 1048576
}, },
"event": "SHUTDOWN", "event": "SHUTDOWN",
"data": { "data": {
"guest": false "guest": false,
"reason": "host-qmp"
} }
} }
image: TEST_DIR/t.IMGFMT image: TEST_DIR/t.IMGFMT
......
...@@ -28,7 +28,8 @@ Testing: -drive if=none,file=TEST_DIR/t.IMGFMT,backing.node-name=mid ...@@ -28,7 +28,8 @@ Testing: -drive if=none,file=TEST_DIR/t.IMGFMT,backing.node-name=mid
}, },
"event": "SHUTDOWN", "event": "SHUTDOWN",
"data": { "data": {
"guest": false "guest": false,
"reason": "host-qmp"
} }
} }
...@@ -65,7 +66,8 @@ Testing: -drive if=none,file=TEST_DIR/t.IMGFMT,node-name=top ...@@ -65,7 +66,8 @@ Testing: -drive if=none,file=TEST_DIR/t.IMGFMT,node-name=top
}, },
"event": "SHUTDOWN", "event": "SHUTDOWN",
"data": { "data": {
"guest": false "guest": false,
"reason": "host-qmp"
} }
} }
......
...@@ -12,7 +12,7 @@ QMP_VERSION ...@@ -12,7 +12,7 @@ QMP_VERSION
{"return": {}} {"return": {}}
{"return": {}} {"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"}}
=== Write part of the file under active bitmap === === Write part of the file under active bitmap ===
......
...@@ -53,7 +53,8 @@ Testing: -drive driver=null-co,if=virtio ...@@ -53,7 +53,8 @@ Testing: -drive driver=null-co,if=virtio
}, },
"event": "SHUTDOWN", "event": "SHUTDOWN",
"data": { "data": {
"guest": false "guest": false,
"reason": "host-qmp"
} }
} }
...@@ -110,7 +111,8 @@ Testing: -drive driver=null-co,if=none ...@@ -110,7 +111,8 @@ Testing: -drive driver=null-co,if=none
}, },
"event": "SHUTDOWN", "event": "SHUTDOWN",
"data": { "data": {
"guest": false "guest": false,
"reason": "host-qmp"
} }
} }
...@@ -140,7 +142,8 @@ Testing: -blockdev driver=null-co,node-name=null ...@@ -140,7 +142,8 @@ Testing: -blockdev driver=null-co,node-name=null
}, },
"event": "SHUTDOWN", "event": "SHUTDOWN",
"data": { "data": {
"guest": false "guest": false,
"reason": "host-qmp"
} }
} }
...@@ -198,7 +201,8 @@ Testing: -blockdev driver=null-co,node-name=null -device virtio-blk,drive=null,i ...@@ -198,7 +201,8 @@ Testing: -blockdev driver=null-co,node-name=null -device virtio-blk,drive=null,i
}, },
"event": "SHUTDOWN", "event": "SHUTDOWN",
"data": { "data": {
"guest": false "guest": false,
"reason": "host-qmp"
} }
} }
......
...@@ -1675,7 +1675,7 @@ void qemu_system_reset(ShutdownCause reason) ...@@ -1675,7 +1675,7 @@ void qemu_system_reset(ShutdownCause reason)
qemu_devices_reset(); qemu_devices_reset();
} }
if (reason != SHUTDOWN_CAUSE_SUBSYSTEM_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(); cpu_synchronize_all_post_reset();
} }
...@@ -1846,7 +1846,7 @@ static bool main_loop_should_exit(void) ...@@ -1846,7 +1846,7 @@ static bool main_loop_should_exit(void)
request = qemu_shutdown_requested(); request = qemu_shutdown_requested();
if (request) { if (request) {
qemu_kill_report(); 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) { if (no_shutdown) {
vm_stop(RUN_STATE_SHUTDOWN); vm_stop(RUN_STATE_SHUTDOWN);
} else { } else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册