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

[libvirt] Patch for verbose Disk transfer



A virsh command like:

migrate --live --copy-storage-all Guest qemu+ssh://user host/system
--persistent --verbose

shows

Migration: [  0 %]

during the storage copy and does not start counting
untill the ram transfer starts

Patch for including the storage copy:

diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c
index 7bf733d..4ac8008 100644
--- a/src/qemu/qemu_monitor_text.c
+++ b/src/qemu/qemu_monitor_text.c
@@ -1183,6 +1183,9 @@ cleanup:
 #define MIGRATION_TRANSFER_PREFIX "transferred ram: "
 #define MIGRATION_REMAINING_PREFIX "remaining ram: "
 #define MIGRATION_TOTAL_PREFIX "total ram: "
+#define MIGRATION_DISK_TRANSFER_PREFIX "transferred disk: "
+#define MIGRATION_DISK_REMAINING_PREFIX "remaining disk: "
+#define MIGRATION_DISK_TOTAL_PREFIX "total disk: "

 int qemuMonitorTextGetMigrationStatus(qemuMonitorPtr mon,
                                       int *status,
@@ -1246,6 +1249,7 @@ int qemuMonitorTextGetMigrationStatus(qemuMonitorPtr mon,
                 goto cleanup;
             }
             *remaining *= 1024;
+            tmp = end;

             if (!(tmp = strstr(tmp, MIGRATION_TOTAL_PREFIX)))
                 goto done;
@@ -1257,7 +1261,53 @@ int qemuMonitorTextGetMigrationStatus(qemuMonitorPtr mon,
                 goto cleanup;
             }
             *total *= 1024;
+            tmp = end;
+
+            /*
+             * Check for Optional Disk Migration status
+             */
+
+            unsigned long long disk_transferred= 0;
+            unsigned long long disk_remaining= 0;
+            unsigned long long disk_total= 0;
+
+            if (!(tmp = strstr(tmp, MIGRATION_DISK_TRANSFER_PREFIX)))
+                goto done;
+            tmp += strlen(MIGRATION_DISK_TRANSFER_PREFIX);

+            if (virStrToLong_ull(tmp, &end, 10, &disk_transferred) < 0) {
+                qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                                _("cannot parse disk migration data
transferred statistic %s"), tmp);
+                goto cleanup;
+            }
+            disk_transferred *= 1024;
+            (*transferred)+= disk_transferred;
+            tmp = end;
+
+            if (!(tmp = strstr(tmp, MIGRATION_DISK_REMAINING_PREFIX)))
+                goto done;
+            tmp += strlen(MIGRATION_DISK_REMAINING_PREFIX);
+
+            if (virStrToLong_ull(tmp, &end, 10, &disk_remaining) < 0) {
+                qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                                _("cannot parse disk migration data
remaining statistic %s"), tmp);
+                goto cleanup;
+            }
+            disk_remaining *= 1024;
+            (*remaining)+= disk_remaining;
+            tmp = end;
+
+            if (!(tmp = strstr(tmp, MIGRATION_DISK_TOTAL_PREFIX)))
+                goto done;
+            tmp += strlen(MIGRATION_DISK_TOTAL_PREFIX);
+
+            if (virStrToLong_ull(tmp, &end, 10, &disk_total) < 0) {
+                qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                                _("cannot parse disk migration data
total statistic %s"), tmp);
+                goto cleanup;
+            }
+            disk_total *= 1024;
+            (*total)+= disk_total;
         }
     }


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