aboutsummaryrefslogtreecommitdiff
path: root/migration/dirtyrate.c
diff options
context:
space:
mode:
authorChuan Zheng <zhengchuan@huawei.com>2020-09-29 11:42:18 +0800
committerDr. David Alan Gilbert <dgilbert@redhat.com>2020-10-12 12:39:38 +0100
commitb1a859cfb04db1d2b80dd9979ce6081cb9c00d75 (patch)
treeb6062e5c9f3ceaec3880b125cfe269d78b075793 /migration/dirtyrate.c
parentaa84b506f75db0bdab2ef0d68a4c5e266eab05e6 (diff)
migration/dirtyrate: present dirty rate only when querying the rate has completed
Make dirty_rate field optional, present dirty rate only when querying the rate has completed. The qmp results is shown as follow: @unstarted: {"return":{"status":"unstarted","start-time":0,"calc-time":0},"id":"libvirt-12"} @measuring: {"return":{"status":"measuring","start-time":102931,"calc-time":1},"id":"libvirt-85"} @measured: {"return":{"status":"measured","dirty-rate":4,"start-time":150146,"calc-time":1},"id":"libvirt-15"} Signed-off-by: Chuan Zheng <zhengchuan@huawei.com> Reviewed-by: David Edmondson <david.edmondson@oracle.com> Message-Id: <1601350938-128320-3-git-send-email-zhengchuan@huawei.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Diffstat (limited to 'migration/dirtyrate.c')
-rw-r--r--migration/dirtyrate.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/migration/dirtyrate.c b/migration/dirtyrate.c
index 40e41e793e..ab9e1301f6 100644
--- a/migration/dirtyrate.c
+++ b/migration/dirtyrate.c
@@ -69,9 +69,8 @@ static struct DirtyRateInfo *query_dirty_rate_info(void)
struct DirtyRateInfo *info = g_malloc0(sizeof(DirtyRateInfo));
if (qatomic_read(&CalculatingState) == DIRTY_RATE_STATUS_MEASURED) {
+ info->has_dirty_rate = true;
info->dirty_rate = dirty_rate;
- } else {
- info->dirty_rate = -1;
}
info->status = CalculatingState;