代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/libvirt 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 56e4777e883bb3c11f4951848080104a2098277f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Hyman=20Huang=28=E9=BB=84=E5=8B=87=29?=
<huangy81@chinatelecom.cn>
Date: Mon, 5 Dec 2022 07:05:23 -0500
Subject: [PATCH 7/7] qemu_driver: Add mode parameter to
qemuDomainStartDirtyRateCalc
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Add mode parameter to qemuDomainStartDirtyRateCalc API, 'mode'
option of 'calc-dirty-rate' command was introduced since
qemu >= 6.2.
Signed-off-by: Hyman Huang(黄勇) <huangy81@chinatelecom.cn>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
---
src/qemu/qemu_driver.c | 3 ++-
src/qemu/qemu_monitor.c | 5 +++--
src/qemu/qemu_monitor.h | 17 ++++++++++++++++-
src/qemu/qemu_monitor_json.c | 14 +++++++++++++-
src/qemu/qemu_monitor_json.h | 3 ++-
5 files changed, 36 insertions(+), 6 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 19d32b5fa3..8b19be46f1 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -23312,6 +23312,7 @@ qemuDomainStartDirtyRateCalc(virDomainPtr dom,
virQEMUDriverPtr driver = dom->conn->privateData;
virDomainObjPtr vm;
qemuDomainObjPrivatePtr priv;
+ qemuMonitorDirtyRateCalcMode mode = QEMU_MONITOR_DIRTYRATE_CALC_MODE_PAGE_SAMPLING;
int ret = -1;
virCheckFlags(0, -1);
@@ -23354,7 +23355,7 @@ qemuDomainStartDirtyRateCalc(virDomainPtr dom,
VIR_DEBUG("Calculate dirty rate in next %d seconds", seconds);
qemuDomainObjEnterMonitor(driver, vm);
- ret = qemuMonitorStartDirtyRateCalc(priv->mon, seconds);
+ ret = qemuMonitorStartDirtyRateCalc(priv->mon, seconds, mode);
if (qemuDomainObjExitMonitor(driver, vm) < 0)
ret = -1;
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 05855c0ae9..04592fdcd5 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -4646,13 +4646,14 @@ qemuMonitorTransactionBackup(virJSONValuePtr actions,
int
qemuMonitorStartDirtyRateCalc(qemuMonitorPtr mon,
- int seconds)
+ int seconds,
+ qemuMonitorDirtyRateCalcMode mode)
{
VIR_DEBUG("seconds=%d", seconds);
QEMU_CHECK_MONITOR(mon);
- return qemuMonitorJSONStartDirtyRateCalc(mon, seconds);
+ return qemuMonitorJSONStartDirtyRateCalc(mon, seconds, mode);
}
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 9c797d5ff5..4f9b70d820 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -1426,9 +1426,24 @@ qemuMonitorTransactionBackup(virJSONValuePtr actions,
const char *bitmap,
qemuMonitorTransactionBackupSyncMode syncmode);
+/**
+ * qemuMonitorDirtyRateCalcMode:
+ *
+ * Dirty page rate calculation mode used during measurement.
+ */
+typedef enum {
+ QEMU_MONITOR_DIRTYRATE_CALC_MODE_PAGE_SAMPLING = 0,
+ QEMU_MONITOR_DIRTYRATE_CALC_MODE_DIRTY_BITMAP,
+ QEMU_MONITOR_DIRTYRATE_CALC_MODE_DIRTY_RING,
+ QEMU_MONITOR_DIRTYRATE_CALC_MODE_LAST,
+} qemuMonitorDirtyRateCalcMode;
+
+VIR_ENUM_DECL(qemuMonitorDirtyRateCalcMode);
+
int
qemuMonitorStartDirtyRateCalc(qemuMonitorPtr mon,
- int seconds);
+ int seconds,
+ qemuMonitorDirtyRateCalcMode mode);
typedef struct _qemuMonitorDirtyRateInfo qemuMonitorDirtyRateInfo;
typedef qemuMonitorDirtyRateInfo *qemuMonitorDirtyRateInfoPtr;
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 3ec7fc84f5..a1617cdfed 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -9375,15 +9375,27 @@ qemuMonitorJSONGetJobInfo(qemuMonitorPtr mon,
return 0;
}
+VIR_ENUM_IMPL(qemuMonitorDirtyRateCalcMode,
+ QEMU_MONITOR_DIRTYRATE_CALC_MODE_LAST,
+ "page-sampling",
+ "dirty-bitmap",
+ "dirty-ring");
+
int
qemuMonitorJSONStartDirtyRateCalc(qemuMonitorPtr mon,
- int seconds)
+ int seconds,
+ qemuMonitorDirtyRateCalcMode mode)
{
g_autoptr(virJSONValue) cmd = NULL;
g_autoptr(virJSONValue) reply = NULL;
+ const char *modestr = NULL;
+
+ if (mode != QEMU_MONITOR_DIRTYRATE_CALC_MODE_PAGE_SAMPLING)
+ modestr = qemuMonitorDirtyRateCalcModeTypeToString(mode);
if (!(cmd = qemuMonitorJSONMakeCommand("calc-dirty-rate",
"i:calc-time", seconds,
+ "S:mode", modestr,
NULL)))
return -1;
diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h
index 531ff59a00..3fc67c4668 100644
--- a/src/qemu/qemu_monitor_json.h
+++ b/src/qemu/qemu_monitor_json.h
@@ -694,7 +694,8 @@ int qemuMonitorJSONSetDBusVMStateIdList(qemuMonitorPtr mon,
int
qemuMonitorJSONStartDirtyRateCalc(qemuMonitorPtr mon,
- int seconds);
+ int seconds,
+ qemuMonitorDirtyRateCalcMode mode);
int
qemuMonitorJSONQueryDirtyRate(qemuMonitorPtr mon,
--
2.27.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。