提交 cf091094 编写于 作者: J Jiri Denemark

qemu: Add support for job completed event

Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
上级 f2893001
...@@ -149,6 +149,30 @@ void qemuDomainEventQueue(virQEMUDriverPtr driver, ...@@ -149,6 +149,30 @@ void qemuDomainEventQueue(virQEMUDriverPtr driver,
} }
void
qemuDomainEventEmitJobCompleted(virQEMUDriverPtr driver,
virDomainObjPtr vm)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
virObjectEventPtr event;
virTypedParameterPtr params = NULL;
int nparams = 0;
int type;
if (!priv->job.completed)
return;
if (qemuDomainJobInfoToParams(priv->job.completed, &type,
&params, &nparams) < 0) {
VIR_WARN("Could not get stats for completed job; domain %s",
vm->def->name);
}
event = virDomainEventJobCompletedNewFromObj(vm, params, nparams);
qemuDomainEventQueue(driver, event);
}
static int static int
qemuDomainObjInitJob(qemuDomainObjPrivatePtr priv) qemuDomainObjInitJob(qemuDomainObjPrivatePtr priv)
{ {
......
...@@ -265,6 +265,8 @@ void qemuDomainEventFlush(int timer, void *opaque); ...@@ -265,6 +265,8 @@ void qemuDomainEventFlush(int timer, void *opaque);
void qemuDomainEventQueue(virQEMUDriverPtr driver, void qemuDomainEventQueue(virQEMUDriverPtr driver,
virObjectEventPtr event); virObjectEventPtr event);
void qemuDomainEventEmitJobCompleted(virQEMUDriverPtr driver,
virDomainObjPtr vm);
int qemuDomainObjBeginJob(virQEMUDriverPtr driver, int qemuDomainObjBeginJob(virQEMUDriverPtr driver,
virDomainObjPtr obj, virDomainObjPtr obj,
......
...@@ -3866,7 +3866,7 @@ qemuMigrationConfirmPhase(virQEMUDriverPtr driver, ...@@ -3866,7 +3866,7 @@ qemuMigrationConfirmPhase(virQEMUDriverPtr driver,
int retcode) int retcode)
{ {
qemuMigrationCookiePtr mig; qemuMigrationCookiePtr mig;
virObjectEventPtr event = NULL; virObjectEventPtr event;
int rv = -1; int rv = -1;
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver); virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
qemuDomainObjPrivatePtr priv = vm->privateData; qemuDomainObjPrivatePtr priv = vm->privateData;
...@@ -3921,6 +3921,8 @@ qemuMigrationConfirmPhase(virQEMUDriverPtr driver, ...@@ -3921,6 +3921,8 @@ qemuMigrationConfirmPhase(virQEMUDriverPtr driver,
event = virDomainEventLifecycleNewFromObj(vm, event = virDomainEventLifecycleNewFromObj(vm,
VIR_DOMAIN_EVENT_STOPPED, VIR_DOMAIN_EVENT_STOPPED,
VIR_DOMAIN_EVENT_STOPPED_MIGRATED); VIR_DOMAIN_EVENT_STOPPED_MIGRATED);
qemuDomainEventQueue(driver, event);
qemuDomainEventEmitJobCompleted(driver, vm);
} else { } else {
virErrorPtr orig_err = virSaveLastError(); virErrorPtr orig_err = virSaveLastError();
...@@ -3935,6 +3937,7 @@ qemuMigrationConfirmPhase(virQEMUDriverPtr driver, ...@@ -3935,6 +3937,7 @@ qemuMigrationConfirmPhase(virQEMUDriverPtr driver,
event = virDomainEventLifecycleNewFromObj(vm, event = virDomainEventLifecycleNewFromObj(vm,
VIR_DOMAIN_EVENT_RESUMED, VIR_DOMAIN_EVENT_RESUMED,
VIR_DOMAIN_EVENT_RESUMED_MIGRATED); VIR_DOMAIN_EVENT_RESUMED_MIGRATED);
qemuDomainEventQueue(driver, event);
} }
if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0) if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm, driver->caps) < 0)
...@@ -3946,7 +3949,6 @@ qemuMigrationConfirmPhase(virQEMUDriverPtr driver, ...@@ -3946,7 +3949,6 @@ qemuMigrationConfirmPhase(virQEMUDriverPtr driver,
rv = 0; rv = 0;
cleanup: cleanup:
qemuDomainEventQueue(driver, event);
virObjectUnref(cfg); virObjectUnref(cfg);
return rv; return rv;
} }
...@@ -6071,6 +6073,7 @@ qemuMigrationToFile(virQEMUDriverPtr driver, virDomainObjPtr vm, ...@@ -6071,6 +6073,7 @@ qemuMigrationToFile(virQEMUDriverPtr driver, virDomainObjPtr vm,
if (cmd && virCommandWait(cmd, NULL) < 0) if (cmd && virCommandWait(cmd, NULL) < 0)
goto cleanup; goto cleanup;
qemuDomainEventEmitJobCompleted(driver, vm);
ret = 0; ret = 0;
cleanup: cleanup:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册