1 Star 0 Fork 71

ccxiaop/libvirt

forked from src-openEuler/libvirt 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
qemu_driver-Add-mode-parameter-to-qemuDomainStartDir.patch 5.19 KB
一键复制 编辑 原始数据 按行查看 历史
yezengruan 提交于 2022-12-06 15:38 . libvirt update to version 6.2.0-47
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
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ccxiaop/libvirt.git
git@gitee.com:ccxiaop/libvirt.git
ccxiaop
libvirt
libvirt
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385