[libvirt] [PATCH 4/9] qemu: Introduce qemuProcessBeginStopJob

Peter Krempa pkrempa at redhat.com
Fri Feb 19 12:00:11 UTC 2016


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 at 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20160219/c167114b/attachment-0001.sig>


More information about the libvir-list mailing list