From 0b8b52e43ba34993c4b2781db477c4131f3abd30 Mon Sep 17 00:00:00 2001
From: Jiahui Cen <cenjiahui@huawei.com>
Date: Thu, 25 Feb 2021 18:55:31 +0800
Subject: [PATCH] qemu: Support 'retry' BLOCK_IO_ERROR event.

Accept BLOCK_IO_ERROR event with action='retry' from qemu.

Signed-off-by: Jiahui Cen <cenjiahui@huawei.com>
Signed-off-by: Ying Fang <fangying1@huawei.com>
---
 include/libvirt/libvirt-domain.h | 1 +
 src/qemu/qemu_monitor_json.c     | 2 +-
 tools/virsh-domain.c             | 3 ++-
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
index b440818ec2..90cb652db1 100644
--- a/include/libvirt/libvirt-domain.h
+++ b/include/libvirt/libvirt-domain.h
@@ -3701,6 +3701,7 @@ typedef enum {
     VIR_DOMAIN_EVENT_IO_ERROR_NONE = 0,  /* No action, IO error ignored */
     VIR_DOMAIN_EVENT_IO_ERROR_PAUSE,     /* Guest CPUs are paused */
     VIR_DOMAIN_EVENT_IO_ERROR_REPORT,    /* IO error reported to guest OS */
+    VIR_DOMAIN_EVENT_IO_ERROR_RETRY,     /* Failed IO retried */
 
 # ifdef VIR_ENUM_SENTINELS
     VIR_DOMAIN_EVENT_IO_ERROR_LAST
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 619717eae5..ef25764a98 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -898,7 +898,7 @@ static void qemuMonitorJSONHandleWatchdog(qemuMonitorPtr mon, virJSONValuePtr da
 VIR_ENUM_DECL(qemuMonitorIOErrorAction);
 VIR_ENUM_IMPL(qemuMonitorIOErrorAction,
               VIR_DOMAIN_EVENT_IO_ERROR_LAST,
-              "ignore", "stop", "report",
+              "ignore", "stop", "report", "retry",
 );
 
 
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 0a623086a4..65d5c831ec 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -13065,7 +13065,8 @@ VIR_ENUM_IMPL(virshDomainEventIOError,
               VIR_DOMAIN_EVENT_IO_ERROR_LAST,
               N_("none"),
               N_("pause"),
-              N_("report"));
+              N_("report"),
+              N_("retry"));
 
 static const char *
 virshDomainEventIOErrorToString(int action)
-- 
2.27.0

