[libvirt PATCH 77/80] Add VIR_DOMAIN_ABORT_JOB_POSTCOPY flag for virDomainAbortJobFlags

Jiri Denemark jdenemar at redhat.com
Tue May 10 15:21:38 UTC 2022


Signed-off-by: Jiri Denemark <jdenemar at redhat.com>
---
 include/libvirt/libvirt-domain.h | 16 ++++++++++++++++
 src/libvirt-domain.c             | 10 ++++++----
 2 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
index af4406cb61..bcd377b74f 100644
--- a/include/libvirt/libvirt-domain.h
+++ b/include/libvirt/libvirt-domain.h
@@ -4099,6 +4099,22 @@ int virDomainGetJobStats(virDomainPtr domain,
                          unsigned int flags);
 int virDomainAbortJob(virDomainPtr dom);
 
+/**
+ * virDomainAbortJobFlagsValues:
+ *
+ * Flags OR'ed together to provide specific behavior when aborting a domain job.
+ *
+ * Since: 8.4.0
+ */
+typedef enum {
+    /* Interrupt post-copy migration. Since migration in a post-copy phase
+     * cannot be aborted without losing the domain (none of the hosts involved
+     * in migration has a complete state of the domain), the migration will be
+     * suspended and it can later be resumed using virDomainMigrate* APIs with
+     * VIR_MIGRATE_POSTCOPY_RESUME flag. (Since: 8.4.0) */
+    VIR_DOMAIN_ABORT_JOB_POSTCOPY = 1 << 0,
+} virDomainAbortJobFlagsValues;
+
 int virDomainAbortJobFlags(virDomainPtr dom,
                            unsigned int flags);
 
diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
index 1e1b378361..5f0f60781a 100644
--- a/src/libvirt-domain.c
+++ b/src/libvirt-domain.c
@@ -9462,12 +9462,12 @@ virDomainAbortJob(virDomainPtr domain)
 /**
  * virDomainAbortJobFlags:
  * @domain: a domain object
- * @flags: extra flags; not used yet, callers should always pass 0
+ * @flags: bitwise-OR of virDomainAbortJobFlagsValues
  *
  * Requests that the current background job be aborted at the
  * soonest opportunity. In case the job is a migration in a post-copy mode,
- * this function will report an error (see virDomainMigrateStartPostCopy for
- * more details).
+ * this function will report an error unless VIR_DOMAIN_ABORT_JOB_POSTCOPY
+ * flag is used (see virDomainMigrateStartPostCopy for more details).
  *
  * Returns 0 in case of success and -1 in case of failure.
  *
@@ -9807,7 +9807,9 @@ virDomainMigrateGetMaxSpeed(virDomainPtr domain,
  * running, individual tasks in the guest may be blocked waiting for a page that
  * has not been migrated yet. It's up to the upper layer to decide what to do
  * in such case. Because of this, libvirt will refuse to cancel post-copy
- * migration via virDomainAbortJob.
+ * migration via virDomainAbortJobFlags unless it is called with
+ * VIR_DOMAIN_ABORT_JOB_POSTCOPY, in which case the post-copy migration will be
+ * paused.
  *
  * Failed post-copy migration can be recovered once the cause for the failure
  * (e.g., a network issue) is resolved by repeating the migration with an
-- 
2.35.1



More information about the libvir-list mailing list