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;
}
}
Show replies by date
On 08/13/2011 02:54 AM, Tom Vijlbrief wrote:
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
This only covers the text monitor; does the JSON monitor present the
same information? If so, then we need to cover both monitors before
calling this patch complete.
But overall, the idea looks nice.
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org