On Tue, Feb 16, 2016 at 15:36:56 +0100, Jiri Denemark wrote:
When destroying a domain we need to make sure we will be able to
start a
job no matter what other operations are running or even stuck in a job.
This is done by killing the domain before starting the destroy job.
Let's introduce qemuProcessBeginStopJob which combines killing a domain
and starting a job in a single API which can be called everywhere we
need a job to stop a domain.
This patch does one additional thing ...
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
src/qemu/qemu_driver.c | 43 ++++++++++---------------------------------
src/qemu/qemu_process.c | 39 +++++++++++++++++++++++++++++++++++++++
src/qemu/qemu_process.h | 4 ++++
3 files changed, 53 insertions(+), 33 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 2bbc724..1770f81 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -2272,44 +2272,21 @@ qemuDomainDestroyFlags(virDomainPtr dom,
if (virDomainDestroyFlagsEnsureACL(dom->conn, vm->def) < 0)
goto cleanup;
+ if (qemuProcessBeginStopJob(driver, vm, QEMU_JOB_DESTROY,
+ !(flags & VIR_DOMAIN_DESTROY_GRACEFUL)) < 0)
+ goto cleanup;
+
+ if (!virDomainObjIsActive(vm)) {
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ "%s", _("domain is not running"));
+ goto endjob;
+ }
Moving this here is a non-reafactor change at this point. I'd suggest
you split this into two patches and explain why you want to move it.
+
qemuDomainSetFakeReboot(driver, vm, false);
if (priv->job.asyncJob == QEMU_ASYNC_JOB_MIGRATION_IN)
stopFlags |= VIR_QEMU_PROCESS_STOP_MIGRATED;
ACK with the split