[libvirt] [PATCH 3/4] qemu: Don't report false error from MigrateFinish

Peter Krempa pkrempa at redhat.com
Thu Jul 9 16:10:51 UTC 2015


On Wed, Jul 08, 2015 at 15:22:51 +0200, Jiri Denemark wrote:
> virDomainMigrateFinish* APIs were unfortunately designed to return the
> pointer to the domain on destination and NULL on error. This looks OK in
> normal cases but the same API is also called when we know migration
> failed and thus we expect Finish to return NULL even if it actually did
> all it was supposed to do without any error. The call is defined to
> return nonnull domain pointer over RPC, which means returning NULL will
> always result in an error being send. If this was not in fact an error,
> the API itself wouldn't set anything to the thread local virError, which
> makes the RPC layer come up with it's own "Library function returned
> error but did not set virError" error.
> 
> This is quite confusing and also hard to detect by the caller. This
> patch adds a special error code which can be used to check that Finish
> successfully aborted migration.
> 
> Signed-off-by: Jiri Denemark <jdenemar at redhat.com>
> ---
>  include/libvirt/virterror.h | 1 +
>  src/qemu/qemu_migration.c   | 6 ++++++
>  src/util/virerror.c         | 3 +++
>  3 files changed, 10 insertions(+)

I'm kind of not sure whether I like this solution or not. I understand
the reasons for having it but I'm not liking it. ACK but I'd prefer
another opinion on this if possible.

Peter
-------------- 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/20150709/a75eeb0f/attachment-0001.sig>


More information about the libvir-list mailing list