From: "Michael R. Hines" <mrhines@xxxxxxxxxx> Previously, QEMU's 'setup' state was no a formal state in their state machine, but it is now. This state is used by RDMA to optionally perform memory pinning. This state is now exposed over the monitor and also measured in the migration info status. This patch consumes both the new setup state as well as the timestamp of the total time spent in that state as reported by QEMU. RDMA migrations perform an optional 'pin-all' operation du Signed-off-by: Michael R. Hines <mrhines@xxxxxxxxxx> --- include/libvirt/libvirt.h.in | 2 ++ src/qemu/qemu_migration.c | 6 ++++++ src/qemu/qemu_monitor.c | 2 +- src/qemu/qemu_monitor.h | 11 +++++++++++ src/qemu/qemu_monitor_json.c | 18 ++++++++++++++++++ 5 files changed, 38 insertions(+), 1 deletion(-) diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in index c0eb25b..31fb37e 100644 --- a/include/libvirt/libvirt.h.in +++ b/include/libvirt/libvirt.h.in @@ -4048,6 +4048,8 @@ struct _virDomainJobInfo { /* Time is measured in mill-seconds */ unsigned long long timeElapsed; /* Always set */ unsigned long long timeRemaining; /* Only for VIR_DOMAIN_JOB_BOUNDED */ + unsigned long long setupTime; /* length of the SETUP phase */ + double mbps; /* Migration throughput in Mbps */ /* Data is measured in bytes unless otherwise specified * and is measuring the job as a whole diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 3dedfe8..19001b9 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -1667,6 +1667,12 @@ qemuMigrationUpdateJobStatus(virQEMUDriverPtr driver, priv->job.status.ram_transferred + priv->job.status.disk_transferred; + priv->job.info.mbps = priv->job.status.mbps; + priv->job.info.setupTime = priv->job.status.setup_time; + + ret = 0; + break; + case QEMU_MONITOR_MIGRATION_STATUS_SETUP: ret = 0; break; diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 0b73411..86aed75 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -108,7 +108,7 @@ VIR_ONCE_GLOBAL_INIT(qemuMonitor) VIR_ENUM_IMPL(qemuMonitorMigrationStatus, QEMU_MONITOR_MIGRATION_STATUS_LAST, - "inactive", "active", "completed", "failed", "cancelled") + "inactive", "setup", "active", "completed", "failed", "cancelled") VIR_ENUM_IMPL(qemuMonitorMigrationCaps, QEMU_MONITOR_MIGRATION_CAPS_LAST, diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 4a55501..82e6ae2 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -348,6 +348,7 @@ int qemuMonitorSetMigrationCacheSize(qemuMonitorPtr mon, enum { QEMU_MONITOR_MIGRATION_STATUS_INACTIVE, + QEMU_MONITOR_MIGRATION_STATUS_SETUP, QEMU_MONITOR_MIGRATION_STATUS_ACTIVE, QEMU_MONITOR_MIGRATION_STATUS_COMPLETED, QEMU_MONITOR_MIGRATION_STATUS_ERROR, @@ -366,6 +367,16 @@ struct _qemuMonitorMigrationStatus { /* total or expected depending on status */ bool downtime_set; unsigned long long downtime; + /* + * Duration of the QEMU 'setup' state. + * for RDMA, this may be on the order of several seconds + * if pinning support is requested before the migration begins. + */ + unsigned long long setup_time; + /* + * Migration throughput in Mbps. + */ + double mbps; unsigned long long ram_transferred; unsigned long long ram_remaining; diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 12f7e69..20ca05e 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -2426,6 +2426,14 @@ qemuMonitorJSONGetMigrationStatusReply(virJSONValuePtr reply, virJSONValueObjectGetNumberUlong(ram, "normal-bytes", &status->ram_normal_bytes); + if (virJSONValueObjectGetNumberDouble(ram, "mbps", + &status->mbps) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("migration was active, but RAM 'mbps' " + "data was missing")); + return -1; + } + virJSONValuePtr disk = virJSONValueObjectGet(ret, "disk"); if (disk) { rc = virJSONValueObjectGetNumberUlong(disk, "transferred", @@ -2504,6 +2512,16 @@ qemuMonitorJSONGetMigrationStatusReply(virJSONValuePtr reply, return -1; } } + + rc = virJSONValueObjectGetNumberUlong(ret, "setup-time", + &status->setup_time); + + if (rc < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("migration was active, but no setup-time was set")); + return -1; + } + } return 0; -- 1.7.10.4 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list