[libvirt] [PATCH] qemu: Obtain job before checking if domain is live
Michal Privoznik
mprivozn at redhat.com
Tue Jun 14 08:13:13 UTC 2016
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 at redhat.com>
> ---
> 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
More information about the libvir-list
mailing list