qemu: blockjob: Avoid spurious log errors when cancelling a shallow copy with reused images
qemu: blockjob: Avoid spurious log errors when cancelling a shallow copy with reused images

In case when a user starts a block copy operation with
VIR_DOMAIN_BLOCK_COPY_SHALLOW and VIR_DOMAIN_BLOCK_COPY_REUSE_EXT and
both the reused image and the original disk have a backing image libvirt
specifically does not insert the backing image until after the job is
asked to be completed via virBlockJobAbort with
VIR_DOMAIN_BLOCK_JOB_ABORT_PIVOT.

This is so that management applications can copy the backing image on
the background.

Now when a user aborts the block job instead of cancelling it we'd
ignore the fact that we didn't insert the backing image yet and the
cancellation would result into a 'blockdev-del' of a invalid node name
and thus an 'error' severity entry in the log.

To solve this issue we use the same conditions when the backing image
addition is avoided to remove the internal state for them prior to the
call to unplug the mirror destination.

Reported-by: Kashyap Chamarthy <005b99b234026d47e167244b248f0ff319fdaf16@redhat.com>
Signed-off-by: Peter Krempa <2cf5c04c61aa466e4a47bfedc747d17279c72ffc@redhat.com>
Reviewed-by: Ján Tomko <4cab11cfb98d3c937327354a78eb07dbb6ee2bc6@redhat.com>

olafhering/libvirt,jfehlig/libvirt,crobinso/libvirt,libvirt/libvirt,jfehlig/libvirt,libvirt/libvirt,zippy2/libvirt,crobinso/libvirt,olafhering/libvirt,jfehlig/libvirt,olafhering/libvirt,olafhering/libvirt,zippy2/libvirt,zippy2/libvirt,libvirt/libvirt,jfehlig/libvirt,zippy2/libvirt,crobinso/libvirt,crobinso/libvirt,libvirt/libvirt