diff --git a/include/libvirt/virterror.h b/include/libvirt/virterror.h index 632503021a306413b03c659810570792c44513f9..f716cb97eae11735e288416ed36b387c77059959 100644 --- a/include/libvirt/virterror.h +++ b/include/libvirt/virterror.h @@ -307,6 +307,7 @@ typedef enum { VIR_ERR_CPU_INCOMPATIBLE = 91, /* given CPU is incompatible with host CPU*/ VIR_ERR_XML_INVALID_SCHEMA = 92, /* XML document doesn't validate against schema */ + VIR_ERR_MIGRATE_FINISH_OK = 93, /* Finish API succeeded but it is expected to return NULL */ } virErrorNumber; /** diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 58874ee3017004d5880d46bb26fd1ad3737441ed..a9cbadaac5c656bfd713476051a85275bea639be 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -5751,6 +5751,12 @@ qemuMigrationFinish(virQEMUDriverPtr driver, } virObjectUnref(caps); virObjectUnref(cfg); + + /* Set a special error if Finish is expected to return NULL as a result of + * successful call with retcode != 0 + */ + if (retcode != 0 && !dom && !virGetLastError()) + virReportError(VIR_ERR_MIGRATE_FINISH_OK, NULL); return dom; } diff --git a/src/util/virerror.c b/src/util/virerror.c index 60b2e793021b9533fd74baca42254213c80c4147..6dc05f48015d5ce40eb4421cf4ccae432c163eea 100644 --- a/src/util/virerror.c +++ b/src/util/virerror.c @@ -1369,6 +1369,9 @@ virErrorMsg(virErrorNumber error, const char *info) else errmsg = _("XML document failed to validate against schema: %s"); break; + case VIR_ERR_MIGRATE_FINISH_OK: + errmsg = _("migration successfully aborted"); + break; } return errmsg; }