代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/libvirt 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 9ba3e54d2b33e1105f5879fff3656c093337e60a Mon Sep 17 00:00:00 2001
From: Jiahui Cen <[email protected]>
Date: Thu, 25 Feb 2021 18:55:30 +0800
Subject: [PATCH] libvirt: Add 'retry' support for error policy
Introduce error_policy=/rerror_policy='retry' to support
werror=/rerror=retry mechanism in qemu.
Add retry_interval parameter to control the interval between retries.
Add retry_timeout parameter to control the total retry times.
Signed-off-by: Jiahui Cen <[email protected]>
Signed-off-by: Ying Fang <[email protected]>
---
src/conf/domain_conf.c | 25 +++++++++++++++++++++++++
src/conf/domain_conf.h | 3 +++
src/qemu/qemu_command.c | 8 ++++++++
src/qemu/qemu_domain.c | 2 ++
4 files changed, 38 insertions(+)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index dbc3e103ff..5c469cedd0 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -355,6 +355,7 @@ VIR_ENUM_IMPL(virDomainDiskErrorPolicy,
"report",
"ignore",
"enospace",
+ "retry",
);
VIR_ENUM_IMPL(virDomainDiskIo,
@@ -10213,6 +10214,30 @@ virDomainDiskDefDriverParseXML(virDomainDiskDefPtr def,
}
VIR_FREE(tmp);
+ def->retry_interval = -1;
+ if ((tmp = virXMLPropString(cur, "retry_interval")) &&
+ ((def->error_policy != VIR_DOMAIN_DISK_ERROR_POLICY_RETRY &&
+ def->rerror_policy != VIR_DOMAIN_DISK_ERROR_POLICY_RETRY) ||
+ (virStrToLong_l(tmp, NULL, 10, &def->retry_interval) < 0) ||
+ (def->retry_interval < 0))) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unknown disk retry interval '%s'"), tmp);
+ return -1;
+ }
+ VIR_FREE(tmp);
+
+ def->retry_timeout = -1;
+ if ((tmp = virXMLPropString(cur, "retry_timeout")) &&
+ ((def->error_policy != VIR_DOMAIN_DISK_ERROR_POLICY_RETRY &&
+ def->rerror_policy != VIR_DOMAIN_DISK_ERROR_POLICY_RETRY) ||
+ (virStrToLong_l(tmp, NULL, 10, &def->retry_timeout) < 0) ||
+ (def->retry_timeout < 0))) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+ _("unknown disk retry interval '%s'"), tmp);
+ return -1;
+ }
+ VIR_FREE(tmp);
+
if ((tmp = virXMLPropString(cur, "io")) &&
(def->iomode = virDomainDiskIoTypeFromString(tmp)) <= 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 16e625331c..86a86d3090 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -396,6 +396,7 @@ typedef enum {
VIR_DOMAIN_DISK_ERROR_POLICY_REPORT,
VIR_DOMAIN_DISK_ERROR_POLICY_IGNORE,
VIR_DOMAIN_DISK_ERROR_POLICY_ENOSPACE,
+ VIR_DOMAIN_DISK_ERROR_POLICY_RETRY,
VIR_DOMAIN_DISK_ERROR_POLICY_LAST
} virDomainDiskErrorPolicy;
@@ -561,6 +562,8 @@ struct _virDomainDiskDef {
int cachemode; /* enum virDomainDiskCache */
int error_policy; /* enum virDomainDiskErrorPolicy */
int rerror_policy; /* enum virDomainDiskErrorPolicy */
+ long retry_interval;
+ long retry_timeout;
int iomode; /* enum virDomainDiskIo */
int ioeventfd; /* enum virTristateSwitch */
int event_idx; /* enum virTristateSwitch */
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 315deb5cfd..c3ad041959 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -1723,6 +1723,14 @@ qemuBuildDiskFrontendAttributeErrorPolicy(virDomainDiskDefPtr disk,
virBufferAsprintf(buf, ",werror=%s", wpolicy);
if (rpolicy)
virBufferAsprintf(buf, ",rerror=%s", rpolicy);
+ if ((disk->error_policy == VIR_DOMAIN_DISK_ERROR_POLICY_RETRY ||
+ disk->rerror_policy == VIR_DOMAIN_DISK_ERROR_POLICY_RETRY) &&
+ disk->retry_interval >= 0)
+ virBufferAsprintf(buf, ",retry_interval=%ld", disk->retry_interval);
+ if ((disk->error_policy == VIR_DOMAIN_DISK_ERROR_POLICY_RETRY ||
+ disk->rerror_policy == VIR_DOMAIN_DISK_ERROR_POLICY_RETRY) &&
+ disk->retry_timeout >= 0)
+ virBufferAsprintf(buf, ",retry_timeout=%ld", disk->retry_timeout);
}
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index f89ff20a84..58493706a1 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -12308,6 +12308,8 @@ qemuDomainDiskChangeSupported(virDomainDiskDefPtr disk,
CHECK_EQ(cachemode, "cache", true);
CHECK_EQ(error_policy, "error_policy", true);
CHECK_EQ(rerror_policy, "rerror_policy", true);
+ CHECK_EQ(retry_interval, "retry_interval", true);
+ CHECK_EQ(retry_timeout, "retry_timeout", true);
CHECK_EQ(iomode, "io", true);
CHECK_EQ(ioeventfd, "ioeventfd", true);
CHECK_EQ(event_idx, "event_idx", true);
--
2.27.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。