79c4324644
Change-Id: I2d302dda68298877c65c99147f5bf22186a59aac
147 lines
5.2 KiB
Diff
147 lines
5.2 KiB
Diff
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
|
|
|