[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 08/11] qemu: retrieve dirty sync count



Signed-off-by: Cristian Klein <cristiklein gmail com>
---
 src/qemu/qemu_monitor.h      | 1 +
 src/qemu/qemu_monitor_json.c | 4 ++++
 src/qemu/qemu_monitor_text.c | 1 +
 tests/qemumonitorjsontest.c  | 1 +
 4 files changed, 7 insertions(+)

diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 17bf879..4dd0bef 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -483,6 +483,7 @@ struct _qemuMonitorMigrationStatus {
     unsigned long long ram_duplicate;
     unsigned long long ram_normal;
     unsigned long long ram_normal_bytes;
+    unsigned long long ram_dirty_sync_count; /* how many times pre-copy restarted so far */
 
     unsigned long long disk_transferred;
     unsigned long long disk_remaining;
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index c83f738..0c4b7ad 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -2566,6 +2566,10 @@ qemuMonitorJSONGetMigrationStatusReply(virJSONValuePtr reply,
             return -1;
         }
 
+        if (virJSONValueObjectGetNumberUlong(ram, "dirty-sync-count",
+                                             &status->ram_dirty_sync_count) < 0) {
+            status->ram_dirty_sync_count = -1; /* silently ignored */
+        }
         if (virJSONValueObjectGetNumberUlong(ram, "transferred",
                                              &status->ram_transferred) < 0) {
             virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c
index 70aeaca..c4c0075 100644
--- a/src/qemu/qemu_monitor_text.c
+++ b/src/qemu/qemu_monitor_text.c
@@ -1435,6 +1435,7 @@ int qemuMonitorTextGetMigrationStatus(qemuMonitorPtr mon,
     int ret = -1;
 
     memset(status, 0, sizeof(*status));
+    status->ram_dirty_sync_count = -1; /* not implemented for text monitor */
 
     if (qemuMonitorHMPCommand(mon, "info migrate", &reply) < 0)
         return -1;
diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index 5bfcd20..343f010 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -1688,6 +1688,7 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationStatus(const void *data)
     expectedStatus.ram_total = 1611038720;
     expectedStatus.ram_remaining = 1605013504;
     expectedStatus.ram_transferred = 3625548;
+    expectedStatus.ram_dirty_sync_count = -1;
 
     if (qemuMonitorTestAddItem(test, "query-migrate",
                                "{"
-- 
1.9.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]