[PATCH] qemu: Report error aborting stopped postcopy migration

Jiri Denemark via Devel posted 1 patch 1 week, 4 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/e21c07a108413b2f6faf052085dccc5908254b9b.1771499549.git.jdenemar@redhat.com
src/qemu/qemu_driver.c | 6 ++++++
1 file changed, 6 insertions(+)
[PATCH] qemu: Report error aborting stopped postcopy migration
Posted by Jiri Denemark via Devel 1 week, 4 days ago
From: Jiri Denemark <jdenemar@redhat.com>

When virDomainAbortJob is called with VIR_DOMAIN_ABORT_JOB_POSTCOPY flag
and the post-copy migration of the domain is already stopped (either
because of a failure or previous call to virDomainAbortJob), the
migrate-pause QMP command fails with "migrate-pause is currently only
supported during postcopy-active or postcopy-recover state". Such error
might be confusing to end users especially when we mark it as an
internal error. Let's not call the QMP command at all and report a
clear error message instead.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
 src/qemu/qemu_driver.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 7f08fd05e9..c5eedeedfa 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -12318,6 +12318,12 @@ qemuDomainAbortJobPostcopy(virDomainObj *vm,
         return -1;
     }
 
+    if (virDomainObjIsFailedPostcopy(vm, vm->job)) {
+        virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                       _("post-copy migration already stopped"));
+        return -1;
+    }
+
     VIR_DEBUG("Suspending post-copy migration at client request");
 
     qemuDomainObjAbortAsyncJob(vm);
-- 
2.53.0
Re: [PATCH] qemu: Report error aborting stopped postcopy migration
Posted by Michal Prívozník via Devel 1 week, 4 days ago
On 2/19/26 12:12, Jiri Denemark via Devel wrote:
> From: Jiri Denemark <jdenemar@redhat.com>
> 
> When virDomainAbortJob is called with VIR_DOMAIN_ABORT_JOB_POSTCOPY flag
> and the post-copy migration of the domain is already stopped (either
> because of a failure or previous call to virDomainAbortJob), the
> migrate-pause QMP command fails with "migrate-pause is currently only
> supported during postcopy-active or postcopy-recover state". Such error
> might be confusing to end users especially when we mark it as an
> internal error. Let's not call the QMP command at all and report a
> clear error message instead.
> 
> Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
> ---
>  src/qemu/qemu_driver.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Michal