[PATCH v2] qemuDomainGetGuestInfo: Exit early if getting info fails

Ján Tomko jtomko at redhat.com
Wed Dec 2 11:56:55 UTC 2020


On a Tuesday in 2020, Michal Privoznik wrote:
>If there is an error getting info from guest agent, then the
>control on qemuDomainGetGuestInfo() jumps onto 'exitagent' label
>and subsequently continues on 'endagentjob'. Both labels are hit
>also in success case too. The control then continues by
>attempting to match fetched info (e.g. disk addresses) with
>domain def. But this is needless - the API will return error
>regardless.
>
>To return early from the function move both 'exitagent' and
>'endagentjob' labels at the end of the function and jump straight
>onto 'cleanup' afterwards. This allows us to set 'ret = 0' later
>- only when we know we succeeded.
>
>Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
>---
>
>v2 of:
>
>https://www.redhat.com/archives/libvir-list/2020-December/msg00020.html
>
> src/qemu/qemu_driver.c | 14 +++++++++-----
> 1 file changed, 9 insertions(+), 5 deletions(-)
>

Reviewed-by: Ján Tomko <jtomko at redhat.com>

Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20201202/a95c9a97/attachment-0001.sig>


More information about the libvir-list mailing list