Re: [PATCH] qemu: Obtain job before checking if domain is live

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 13.06.2016 15:33, Martin Kletzander wrote:
> Since obtaining a job can wait for another job to finish, the state
> might change in the meantime.  And checking it more than once is
> pointless.
> 
> Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx>
> ---
>  src/qemu/qemu_driver.c | 36 +++++++++++++++---------------------
>  1 file changed, 15 insertions(+), 21 deletions(-)
> 
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index efb3f854fb10..e677440c20b2 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c


> @@ -17942,15 +17936,15 @@ qemuDomainQemuAgentCommand(virDomainPtr domain,
>      if (virDomainQemuAgentCommandEnsureACL(domain->conn, vm->def) < 0)
>          goto cleanup;
> 
> +    if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
> +        goto cleanup;
> +
>      if (!virDomainObjIsActive(vm)) {
>          virReportError(VIR_ERR_OPERATION_INVALID,
>                         "%s", _("domain is not running"));
> -        goto cleanup;
> +        goto endjob;
>      }
> 
> -    if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
> -        goto cleanup;
> -
>      if (!qemuDomainAgentAvailable(vm, true))
>          goto endjob;
> 

There's another check for domain activeness just below this line. It can
be safely removed.

ACK

Michal

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]