[libvirt] [PATCH] qemu: Remove redundant DomainObjIsActive check

Ján Tomko jtomko at redhat.com
Fri Apr 15 12:59:06 UTC 2016


On Fri, Apr 15, 2016 at 08:54:23AM -0400, Cole Robinson wrote:
> We perform the same check several lines earlier
> ---
>  src/qemu/qemu_driver.c | 6 ------
>  1 file changed, 6 deletions(-)
> 
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index e795062..ced808a 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -18403,32 +18403,26 @@ qemuDomainQemuAgentCommand(virDomainPtr domain,
>  
>      if (!virDomainObjIsActive(vm)) {
>          virReportError(VIR_ERR_OPERATION_INVALID,
>                         "%s", _("domain is not running"));
>          goto cleanup;
>      }
>  
>      if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
>          goto cleanup;
>  
>      if (!qemuDomainAgentAvailable(vm, true))
>          goto endjob;
>  

This is not redundant, the domain might stop running while we wait for
the job with the domain lock unlocked.

Jan

> -    if (!virDomainObjIsActive(vm)) {
> -        virReportError(VIR_ERR_OPERATION_INVALID,
> -                       "%s", _("domain is not running"));
> -        goto endjob;
> -    }
> -
>      qemuDomainObjEnterAgent(vm);
>      ret = qemuAgentArbitraryCommand(priv->agent, cmd, &result, timeout);
>      qemuDomainObjExitAgent(vm);
>      if (ret < 0)
>          VIR_FREE(result);
>  
>   endjob:
>      qemuDomainObjEndJob(driver, vm);
>  
>   cleanup:
>      virDomainObjEndAPI(&vm);
>      return result;
>  }
> -- 
> 2.7.3
> 
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list




More information about the libvir-list mailing list