From 14088d9c72f7b2d383fcc8a74f3f8ada913f5703 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 06:34:56 -0500
Subject: [PATCH 3/7] qemu_capabilities: Introduce QEMU_CAPS_CALC_DIRTY_RATE
 capability
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

calc-dirty-rate command was introduced since qemu >=5.2.0.
Introduce QEMU_CAPS_CALC_DIRTY_RATE capability definition.

Signed-off-by: Hyman Huang(黄勇) <huangy81@chinatelecom.cn>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
---
 src/qemu/qemu_capabilities.c | 4 ++++
 src/qemu/qemu_capabilities.h | 3 +++
 2 files changed, 7 insertions(+)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index d78d8f1431..c9b0a6c191 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -575,6 +575,9 @@ VIR_ENUM_IMPL(virQEMUCaps,
               "migration-param.xbzrle-cache-size",
               "object.qapified",
               "vhost-user-blk",
+
+              /* 365 */
+              "calc-dirty-rate",
     );
 
 
@@ -1144,6 +1147,7 @@ struct virQEMUCapsStringFlags virQEMUCapsCommands[] = {
     { "block-dirty-bitmap-merge", QEMU_CAPS_BITMAP_MERGE },
     { "query-cpu-model-baseline", QEMU_CAPS_QUERY_CPU_MODEL_BASELINE },
     { "query-cpu-model-comparison", QEMU_CAPS_QUERY_CPU_MODEL_COMPARISON },
+    { "calc-dirty-rate", QEMU_CAPS_CALC_DIRTY_RATE },
 };
 
 struct virQEMUCapsStringFlags virQEMUCapsMigration[] = {
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 165cacca3c..6245072fc3 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -557,6 +557,9 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */
     QEMU_CAPS_OBJECT_QAPIFIED, /* parameters for object-add are formally described */
     QEMU_CAPS_DEVICE_VHOST_USER_BLK, /* -device vhost-user-blk */
 
+    /* 365 */
+    QEMU_CAPS_CALC_DIRTY_RATE, /* accepts calc-dirty-rate */
+
     QEMU_CAPS_LAST /* this must always be the last item */
 } virQEMUCapsFlags;
 
-- 
2.27.0

