]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Add VIR_DOMAIN_ABORT_JOB_POSTCOPY flag for virDomainAbortJobFlags
authorJiri Denemark <jdenemar@redhat.com>
Tue, 10 May 2022 13:20:25 +0000 (15:20 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Tue, 7 Jun 2022 15:40:21 +0000 (17:40 +0200)
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
include/libvirt/libvirt-domain.h
src/libvirt-domain.c

index 0b321f364a4fa5cb6e45d4c9b45b60155ba16f8c..2aec69bc54e0150bf443f654934a968295a79e2a 100644 (file)
@@ -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.5.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.5.0) */
+    VIR_DOMAIN_ABORT_JOB_POSTCOPY = 1 << 0,
+} virDomainAbortJobFlagsValues;
+
 int virDomainAbortJobFlags(virDomainPtr dom,
                            unsigned int flags);
 
index 0da4f44fa162070ef6514937db2931b519baa2f7..842663a608d8bf727373ae8842738fd3ebc9ee43 100644 (file)
@@ -9473,12 +9473,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.
  *
@@ -9816,7 +9816,9 @@ virDomainMigrateGetMaxSpeed(virDomainPtr domain,
  * will remain running with VIR_DOMAIN_RUNNING_POSTCOPY_FAILED reason.
  * 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.
+ * 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