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

Martin Kletzander mkletzan at redhat.com
Tue Jun 14 09:11:48 UTC 2016


On Tue, Jun 14, 2016 at 10:13:13AM +0200, Michal Privoznik wrote:
>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.
>

And the same thing happened in qemuDomainGetVcpusFlags(), so I fixed it
there as well and pushed.  Thanks.

>ACK
>
>Michal
>
-------------- 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/20160614/e06a1c9a/attachment-0001.sig>


More information about the libvir-list mailing list