[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 8/9] qapi: add I/O hang and I/O hang timeout qapi event
From: |
Jiahui Cen |
Subject: |
[PATCH v3 8/9] qapi: add I/O hang and I/O hang timeout qapi event |
Date: |
Thu, 22 Oct 2020 21:03:02 +0800 |
Sometimes hypervisor management tools like libvirt may need to monitor
I/O hang events. Let's report I/O hang and I/O hang timeout event via qapi.
Signed-off-by: Jiahui Cen <cenjiahui@huawei.com>
Signed-off-by: Ying Fang <fangying1@huawei.com>
---
block/block-backend.c | 3 +++
qapi/block-core.json | 26 ++++++++++++++++++++++++++
2 files changed, 29 insertions(+)
diff --git a/block/block-backend.c b/block/block-backend.c
index c812b3a9c7..42337ceb04 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -2556,6 +2556,7 @@ static bool blk_iohang_handle(BlockBackend *blk, int
new_status)
/* Case when I/O Hang is recovered */
blk->is_iohang_timeout = false;
blk->iohang_time = 0;
+ qapi_event_send_block_io_hang(false);
}
break;
case BLOCK_IO_HANG_STATUS_HANG:
@@ -2563,12 +2564,14 @@ static bool blk_iohang_handle(BlockBackend *blk, int
new_status)
/* Case when I/O hang is first triggered */
blk->iohang_time = qemu_clock_get_ms(QEMU_CLOCK_REALTIME) / 1000;
need_rehandle = true;
+ qapi_event_send_block_io_hang(true);
} else {
if (!blk->is_iohang_timeout) {
now = qemu_clock_get_ms(QEMU_CLOCK_REALTIME) / 1000;
if (now >= (blk->iohang_time + blk->iohang_timeout)) {
/* Case when I/O hang is timeout */
blk->is_iohang_timeout = true;
+ qapi_event_send_block_io_hang_timeout(true);
} else {
/* Case when I/O hang is continued */
need_rehandle = true;
diff --git a/qapi/block-core.json b/qapi/block-core.json
index ee5ebef7f2..709514498c 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
@@ -5379,3 +5379,29 @@
{ 'command': 'blockdev-snapshot-delete-internal-sync',
'data': { 'device': 'str', '*id': 'str', '*name': 'str'},
'returns': 'SnapshotInfo' }
+
+##
+# @BLOCK_IO_HANG:
+#
+# Emitted when device I/O hang trigger event begin or end
+#
+# @set: true if I/O hang begin; false if I/O hang end.
+#
+# Since: 5.2
+#
+##
+{ 'event': 'BLOCK_IO_HANG',
+ 'data': { 'set': 'bool' }}
+
+##
+# @BLOCK_IO_HANG_TIMEOUT:
+#
+# Emitted when device I/O hang timeout event set or clear
+#
+# @set: true if set; false if clear.
+#
+# Since: 5.2
+#
+##
+{ 'event': 'BLOCK_IO_HANG_TIMEOUT',
+ 'data': { 'set': 'bool' }}
--
2.19.1
- [PATCH v3 0/9] block-backend: Introduce I/O hang, Jiahui Cen, 2020/10/22
- [PATCH v3 1/9] block-backend: introduce I/O rehandle info, Jiahui Cen, 2020/10/22
- [PATCH v3 9/9] docs: add a doc about I/O hang, Jiahui Cen, 2020/10/22
- [PATCH v3 7/9] qemu-option: add I/O hang timeout option, Jiahui Cen, 2020/10/22
- [PATCH v3 8/9] qapi: add I/O hang and I/O hang timeout qapi event,
Jiahui Cen <=
- [PATCH v3 3/9] block-backend: add I/O hang timeout, Jiahui Cen, 2020/10/22
- [PATCH v3 6/9] virtio-blk: pause I/O hang when resetting, Jiahui Cen, 2020/10/22
- [PATCH v3 4/9] block-backend: add I/O rehandle pause/unpause, Jiahui Cen, 2020/10/22
- [PATCH v3 5/9] block-backend: enable I/O hang when timeout is set, Jiahui Cen, 2020/10/22
- [PATCH v3 2/9] block-backend: rehandle block aios when EIO, Jiahui Cen, 2020/10/22
- Re: [PATCH v3 0/9] block-backend: Introduce I/O hang, Stefan Hajnoczi, 2020/10/26