在 2022/1/27 16:23, Peter Krempa 写道:
On Thu, Jan 27, 2022 at 15:25:18 +0800, huangy81@xxxxxxxxxxxxxxx wrote:
From: Hyman Huang(黄勇) <huangy81@xxxxxxxxxxxxxxx>
Probing QEMU_CAPS_CALC_DIRTY_RATE capability in advance
in case of failure when calculating dirty page rate.
Signed-off-by: Hyman Huang(黄勇) <huangy81@xxxxxxxxxxxxxxx>
---
src/qemu/qemu_driver.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 0a1ba74..0e8e9b1 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -20647,10 +20647,22 @@ qemuDomainStartDirtyRateCalc(virDomainPtr dom,
virQEMUDriver *driver = dom->conn->privateData;
virDomainObj *vm = NULL;
qemuDomainObjPrivate *priv;
+ g_autoptr(virQEMUCaps) qemucaps = NULL;
int ret = -1;
virCheckFlags(0, -1);
+ if (!(qemucaps = virQEMUCapsCacheLookupDefault(driver->qemuCapsCache,
+ NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL)))
+ return -1;
This is not needed, qemuCaps for a running vm are stored in
'priv->qemuCaps'. In fact it's wrong to not use the stored capabilities