On Fri, Sep 01, 2017 at 09:49:24 +0300, Nikolay Shirokovskiy wrote:
qemuMigrationFetchJobStatus is rather inconvinient. Some of its
callers don't need status to be updated, some don't need to update
elapsed time right away. So let's update status or elapsed time
in callers instead.
This patch drops updating job status on getting job stats by
client. This way we will not provide status 'completed' while
it is not yet updated by migration routine.
...
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index e2760d1..a1923c3 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1376,24 +1376,26 @@ qemuMigrationUpdateJobType(qemuDomainJobInfoPtr jobInfo)
int
-qemuMigrationFetchJobStatus(virQEMUDriverPtr driver,
- virDomainObjPtr vm,
- qemuDomainAsyncJob asyncJob,
- qemuDomainJobInfoPtr jobInfo)
+qemuMigrationFetchStats(virQEMUDriverPtr driver,
+ virDomainObjPtr vm,
+ qemuDomainAsyncJob asyncJob,
+ qemuDomainJobInfoPtr jobInfo)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
+ qemuMonitorMigrationStats stats;
int rv;
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
return -1;
- rv = qemuMonitorGetMigrationStats(priv->mon, &jobInfo->stats);
+ rv = qemuMonitorGetMigrationStats(priv->mon, &stats);
if (qemuDomainObjExitMonitor(driver, vm) < 0 || rv < 0)
return -1;
- qemuMigrationUpdateJobType(jobInfo);
- return qemuDomainJobInfoUpdateTime(jobInfo);
+ jobInfo->stats = stats = stats;
One assignment would have been enough :-)
Jirka