mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
qemu_driver: Add mode parameter to qemuDomainStartDirtyRateCalc
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>
This commit is contained in:
parent
e7a8bd2173
commit
de4a066bfd
@ -20673,6 +20673,7 @@ qemuDomainStartDirtyRateCalc(virDomainPtr dom,
|
||||
virQEMUDriver *driver = dom->conn->privateData;
|
||||
virDomainObj *vm = NULL;
|
||||
qemuDomainObjPrivate *priv;
|
||||
qemuMonitorDirtyRateCalcMode mode = QEMU_MONITOR_DIRTYRATE_CALC_MODE_PAGE_SAMPLING;
|
||||
int ret = -1;
|
||||
|
||||
virCheckFlags(0, -1);
|
||||
@ -20715,7 +20716,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);
|
||||
|
||||
qemuDomainObjExitMonitor(driver, vm);
|
||||
|
||||
|
@ -4475,13 +4475,14 @@ qemuMonitorTransactionBackup(virJSONValue *actions,
|
||||
|
||||
int
|
||||
qemuMonitorStartDirtyRateCalc(qemuMonitor *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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1534,9 +1534,24 @@ qemuMonitorTransactionBackup(virJSONValue *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(qemuMonitor *mon,
|
||||
int seconds);
|
||||
int seconds,
|
||||
qemuMonitorDirtyRateCalcMode mode);
|
||||
|
||||
typedef struct _qemuMonitorDirtyRateInfo qemuMonitorDirtyRateInfo;
|
||||
struct _qemuMonitorDirtyRateInfo {
|
||||
|
@ -8740,18 +8740,30 @@ qemuMonitorJSONGetCPUMigratable(qemuMonitor *mon,
|
||||
migratable);
|
||||
}
|
||||
|
||||
VIR_ENUM_IMPL(qemuMonitorDirtyRateCalcMode,
|
||||
QEMU_MONITOR_DIRTYRATE_CALC_MODE_LAST,
|
||||
"page-sampling",
|
||||
"dirty-bitmap",
|
||||
"dirty-ring");
|
||||
|
||||
int
|
||||
qemuMonitorJSONStartDirtyRateCalc(qemuMonitor *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,
|
||||
NULL)))
|
||||
"S:mode", modestr,
|
||||
NULL))) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
|
||||
return -1;
|
||||
|
@ -853,7 +853,8 @@ qemuMonitorJSONGetCPUMigratable(qemuMonitor *mon,
|
||||
|
||||
int
|
||||
qemuMonitorJSONStartDirtyRateCalc(qemuMonitor *mon,
|
||||
int seconds);
|
||||
int seconds,
|
||||
qemuMonitorDirtyRateCalcMode mode);
|
||||
|
||||
int
|
||||
qemuMonitorJSONQueryDirtyRate(qemuMonitor *mon,
|
||||
|
Loading…
Reference in New Issue
Block a user