mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 15:27:47 +00:00
qemu: drop QEMU_MIGRATION_COMPLETED_UPDATE_STATS
This way we get stats only in one place. The former code waits for complete/postcopy status basically and don't need to mess with stats. The patch drops raising an error on stats updates failure. This does not make much sense anyway. Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
parent
09f57f9aac
commit
e87d4b9e2f
@ -1436,8 +1436,7 @@ qemuMigrationUpdateJobStatus(virQEMUDriverPtr driver,
|
|||||||
static int
|
static int
|
||||||
qemuMigrationCheckJobStatus(virQEMUDriverPtr driver,
|
qemuMigrationCheckJobStatus(virQEMUDriverPtr driver,
|
||||||
virDomainObjPtr vm,
|
virDomainObjPtr vm,
|
||||||
qemuDomainAsyncJob asyncJob,
|
qemuDomainAsyncJob asyncJob)
|
||||||
bool updateJobStats)
|
|
||||||
{
|
{
|
||||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||||
qemuDomainJobInfoPtr jobInfo = priv->job.current;
|
qemuDomainJobInfoPtr jobInfo = priv->job.current;
|
||||||
@ -1466,12 +1465,6 @@ qemuMigrationCheckJobStatus(virQEMUDriverPtr driver,
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
case QEMU_DOMAIN_JOB_STATUS_COMPLETED:
|
case QEMU_DOMAIN_JOB_STATUS_COMPLETED:
|
||||||
/* Fetch statistics of a completed migration */
|
|
||||||
if (events && updateJobStats &&
|
|
||||||
qemuMigrationUpdateJobStatus(driver, vm, asyncJob) < 0)
|
|
||||||
return -1;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case QEMU_DOMAIN_JOB_STATUS_ACTIVE:
|
case QEMU_DOMAIN_JOB_STATUS_ACTIVE:
|
||||||
case QEMU_DOMAIN_JOB_STATUS_POSTCOPY:
|
case QEMU_DOMAIN_JOB_STATUS_POSTCOPY:
|
||||||
break;
|
break;
|
||||||
@ -1483,10 +1476,10 @@ qemuMigrationCheckJobStatus(virQEMUDriverPtr driver,
|
|||||||
enum qemuMigrationCompletedFlags {
|
enum qemuMigrationCompletedFlags {
|
||||||
QEMU_MIGRATION_COMPLETED_ABORT_ON_ERROR = (1 << 0),
|
QEMU_MIGRATION_COMPLETED_ABORT_ON_ERROR = (1 << 0),
|
||||||
QEMU_MIGRATION_COMPLETED_CHECK_STORAGE = (1 << 1),
|
QEMU_MIGRATION_COMPLETED_CHECK_STORAGE = (1 << 1),
|
||||||
QEMU_MIGRATION_COMPLETED_UPDATE_STATS = (1 << 2),
|
QEMU_MIGRATION_COMPLETED_POSTCOPY = (1 << 2),
|
||||||
QEMU_MIGRATION_COMPLETED_POSTCOPY = (1 << 3),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns 1 if migration completed successfully,
|
* Returns 1 if migration completed successfully,
|
||||||
* 0 if the domain is still being migrated,
|
* 0 if the domain is still being migrated,
|
||||||
@ -1503,9 +1496,8 @@ qemuMigrationCompleted(virQEMUDriverPtr driver,
|
|||||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||||
qemuDomainJobInfoPtr jobInfo = priv->job.current;
|
qemuDomainJobInfoPtr jobInfo = priv->job.current;
|
||||||
int pauseReason;
|
int pauseReason;
|
||||||
bool updateStats = !!(flags & QEMU_MIGRATION_COMPLETED_UPDATE_STATS);
|
|
||||||
|
|
||||||
if (qemuMigrationCheckJobStatus(driver, vm, asyncJob, updateStats) < 0)
|
if (qemuMigrationCheckJobStatus(driver, vm, asyncJob) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (flags & QEMU_MIGRATION_COMPLETED_CHECK_STORAGE &&
|
if (flags & QEMU_MIGRATION_COMPLETED_CHECK_STORAGE &&
|
||||||
@ -1533,9 +1525,6 @@ qemuMigrationCompleted(virQEMUDriverPtr driver,
|
|||||||
if (flags & QEMU_MIGRATION_COMPLETED_POSTCOPY &&
|
if (flags & QEMU_MIGRATION_COMPLETED_POSTCOPY &&
|
||||||
jobInfo->status == QEMU_DOMAIN_JOB_STATUS_POSTCOPY) {
|
jobInfo->status == QEMU_DOMAIN_JOB_STATUS_POSTCOPY) {
|
||||||
VIR_DEBUG("Migration switched to post-copy");
|
VIR_DEBUG("Migration switched to post-copy");
|
||||||
if (updateStats &&
|
|
||||||
qemuMigrationUpdateJobStatus(driver, vm, asyncJob) < 0)
|
|
||||||
goto error;
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1574,8 +1563,6 @@ qemuMigrationWaitForCompletion(virQEMUDriverPtr driver,
|
|||||||
bool events = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_EVENT);
|
bool events = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_EVENT);
|
||||||
int rv;
|
int rv;
|
||||||
|
|
||||||
flags |= QEMU_MIGRATION_COMPLETED_UPDATE_STATS;
|
|
||||||
|
|
||||||
jobInfo->status = QEMU_DOMAIN_JOB_STATUS_ACTIVE;
|
jobInfo->status = QEMU_DOMAIN_JOB_STATUS_ACTIVE;
|
||||||
while ((rv = qemuMigrationCompleted(driver, vm, asyncJob,
|
while ((rv = qemuMigrationCompleted(driver, vm, asyncJob,
|
||||||
dconn, flags)) != 1) {
|
dconn, flags)) != 1) {
|
||||||
@ -1597,6 +1584,9 @@ qemuMigrationWaitForCompletion(virQEMUDriverPtr driver,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (events)
|
||||||
|
ignore_value(qemuMigrationUpdateJobStatus(driver, vm, asyncJob));
|
||||||
|
|
||||||
qemuDomainJobInfoUpdateDowntime(jobInfo);
|
qemuDomainJobInfoUpdateDowntime(jobInfo);
|
||||||
VIR_FREE(priv->job.completed);
|
VIR_FREE(priv->job.completed);
|
||||||
if (VIR_ALLOC(priv->job.completed) == 0)
|
if (VIR_ALLOC(priv->job.completed) == 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user