[libvirt] [PATCH 3/3] qemu: Properly abort migration to a file

Peter Krempa pkrempa at redhat.com
Thu May 22 14:14:22 UTC 2014


On 05/22/14 13:55, Jiri Denemark wrote:
> This is similar to the previous commit in that we need to explicitly
> send migrate_cancel when libvirt detects an error other than those
> reported by query-migrate. However, the possibility to hit such error is
> pretty small.
> 
> Signed-off-by: Jiri Denemark <jdenemar at redhat.com>
> ---
>  src/qemu/qemu_migration.c | 21 ++++++++++++++++++++-
>  1 file changed, 20 insertions(+), 1 deletion(-)
> 
> diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
> index ae18acb..5754f73 100644
> --- a/src/qemu/qemu_migration.c
> +++ b/src/qemu/qemu_migration.c
> @@ -4704,6 +4704,7 @@ qemuMigrationToFile(virQEMUDriverPtr driver, virDomainObjPtr vm,
>      int pipeFD[2] = { -1, -1 };
>      unsigned long saveMigBandwidth = priv->migMaxBandwidth;
>      char *errbuf = NULL;
> +    virErrorPtr orig_err = NULL;
>  
>      /* Increase migration bandwidth to unlimited since target is a file.
>       * Failure to change migration speed is not fatal. */
> @@ -4806,8 +4807,17 @@ qemuMigrationToFile(virQEMUDriverPtr driver, virDomainObjPtr vm,
>  
>      rc = qemuMigrationWaitForCompletion(driver, vm, asyncJob, NULL, false);
>  
> -    if (rc < 0)
> +    if (rc < 0) {
> +        if (rc == -2) {
> +            orig_err = virSaveLastError();
> +            virCommandAbort(cmd);

Shouldn't we abort the migration in qemu before killing the I/O helper?
Qemu will get a sigpipe probably after we do that. Not sure wether
that's worth dealing with as the migration is still going to fail.

> +            if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) == 0) {
> +                qemuMonitorMigrateCancel(priv->mon);
> +                qemuDomainObjExitMonitor(driver, vm);
> +            }
> +        }
>          goto cleanup;
> +    }
>  
>      if (cmd && virCommandWait(cmd, NULL) < 0)
>          goto cleanup;

ACK, preferably you respond to my question before pushing :)

Peter


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 901 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140522/05dca71b/attachment-0001.sig>


More information about the libvir-list mailing list