代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/libvirt 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 04292a5ad4cb9741fa8f9687befd1e1c644043a6 Mon Sep 17 00:00:00 2001
From: Jiahui Cen <cenjiahui@huawei.com>
Date: Thu, 18 Mar 2021 15:14:20 +0800
Subject: [PATCH] libvirt/conf: Set default values of retry fileds
Currently the default values of retry_interval and retry_timeout are set
to -1, when 'driver' option exists without retry fileds. It conflicts
with the default values when the 'driver' option does not exist.
So let's set default values of retry_interval and retry_timeout to 0 when
retry policy is not enabled.
Signed-off-by: Jiahui Cen <cenjiahui@huawei.com>
---
src/conf/domain_conf.c | 18 ++++++++++++------
src/conf/domain_conf.h | 3 +++
2 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 5c469cedd0..a4e9b3290c 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -10186,6 +10186,7 @@ virDomainDiskDefDriverParseXML(virDomainDiskDefPtr def,
xmlNodePtr cur)
{
g_autofree char *tmp = NULL;
+ bool retry_enabled = false;
def->driverName = virXMLPropString(cur, "name");
@@ -10214,28 +10215,33 @@ virDomainDiskDefDriverParseXML(virDomainDiskDefPtr def,
}
VIR_FREE(tmp);
- def->retry_interval = -1;
+ retry_enabled = (def->error_policy == VIR_DOMAIN_DISK_ERROR_POLICY_RETRY) ||
+ (def->rerror_policy == VIR_DOMAIN_DISK_ERROR_POLICY_RETRY);
+
if ((tmp = virXMLPropString(cur, "retry_interval")) &&
- ((def->error_policy != VIR_DOMAIN_DISK_ERROR_POLICY_RETRY &&
- def->rerror_policy != VIR_DOMAIN_DISK_ERROR_POLICY_RETRY) ||
+ (!retry_enabled ||
(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;
}
+ if (retry_enabled && !tmp) {
+ def->retry_interval = VIR_DOMAIN_DISK_DEFAULT_RETRY_INTERVAL;
+ }
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) ||
+ (!retry_enabled ||
(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;
}
+ if (retry_enabled && !tmp) {
+ def->retry_timeout = VIR_DOMAIN_DISK_DEFAULT_RETRY_TIMEOUT;
+ }
VIR_FREE(tmp);
if ((tmp = virXMLPropString(cur, "io")) &&
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 86a86d3090..ccee986849 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -523,6 +523,9 @@ typedef enum {
} virDomainMemoryAllocation;
+#define VIR_DOMAIN_DISK_DEFAULT_RETRY_INTERVAL 1000
+#define VIR_DOMAIN_DISK_DEFAULT_RETRY_TIMEOUT 0
+
/* Stores the virtual disk configuration */
struct _virDomainDiskDef {
virStorageSourcePtr src; /* non-NULL. XXX Allow NULL for empty cdrom? */
--
2.27.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。