Close the source fd if the destination qemu exits during tunnelled migration
Close the source fd if the destination qemu exits during tunnelled migration

Tunnelled migration can hang if the destination qemu exits despite all the
ABI checks. This happens whenever the destination qemu exits before the
complete transfer is noticed by source qemu. The savevm state checks at
runtime can fail at destination and cause qemu to error out.
The source qemu cant notice it as the EPIPE is not propogated to it.
The qemuMigrationIOFunc() notices the stream being broken from virStreamSend()
and it cleans up the stream alone. The qemuMigrationWaitForCompletion() would
never get to 100% transfer completion.
The qemuMigrationWaitForCompletion() never breaks out as well since
the ssh connection to destination is healthy, and the source qemu also thinks
the migration is ongoing as the Fd to which it transfers, is never
closed or broken. So, the migration will hang forever. Even Ctrl-C on the
virsh migrate wouldn't be honoured. Close the source side FD when there is
an error in the stream. That way, the source qemu updates itself and
qemuMigrationWaitForCompletion() notices the failure.

Close the FD for all kinds of errors to be sure. The error message is not
copied for EPIPE so that the destination error is copied instead later.

Note:
Reproducible with repeated migrations between Power hosts running in different
subcores-per-core modes.

Signed-off-by: Shivaprasad G Bhat <90f736271cc61454bf7410f17f3d154578105aa0@linux.vnet.ibm.com>

eskultety/libvirt,datto/libvirt,taget/libvirt,zippy2/libvirt,taget/libvirt,jardasgit/libvirt,fabianfreyer/libvirt,libvirt/libvirt,jardasgit/libvirt,fabianfreyer/libvirt,crobinso/libvirt,andreabolognani/libvirt,fabianfreyer/libvirt,VenkatDatta/libvirt,taget/libvirt,VenkatDatta/libvirt,fabianfreyer/libvirt,zippy2/libvirt,andreabolognani/libvirt,jardasgit/libvirt,rlaager/libvirt,datto/libvirt,VenkatDatta/libvirt,andreabolognani/libvirt,datto/libvirt,nertpinx/libvirt,eskultety/libvirt,jardasgit/libvirt,rlaager/libvirt,datto/libvirt,taget/libvirt,jfehlig/libvirt,taget/libvirt,libvirt/libvirt,datto/libvirt,VenkatDatta/libvirt,andreabolognani/libvirt,crobinso/libvirt,VenkatDatta/libvirt,zippy2/libvirt,libvirt/libvirt,jfehlig/libvirt,eskultety/libvirt,libvirt/libvirt,eskultety/libvirt,crobinso/libvirt,nertpinx/libvirt,fabianfreyer/libvirt,nertpinx/libvirt,olafhering/libvirt,jfehlig/libvirt,andreabolognani/libvirt,olafhering/libvirt,jfehlig/libvirt,crobinso/libvirt,rlaager/libvirt,jardasgit/libvirt,eskultety/libvirt,zippy2/libvirt,nertpinx/libvirt,rlaager/libvirt,olafhering/libvirt,olafhering/libvirt,rlaager/libvirt,nertpinx/libvirt