[libvirt PATCH 75/80] Add virDomainAbortJobFlags public API

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The original virDomainAbortJob did not support flags.

Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx>
---
 include/libvirt/libvirt-domain.h |  3 +++
 src/driver-hypervisor.h          |  5 ++++
 src/libvirt-domain.c             | 45 ++++++++++++++++++++++++++++++++
 src/libvirt_public.syms          |  1 +
 src/remote/remote_driver.c       |  1 +
 src/remote/remote_protocol.x     | 14 +++++++++-
 src/remote_protocol-structs      |  5 ++++
 7 files changed, 73 insertions(+), 1 deletion(-)

diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
index aee2b49114..af4406cb61 100644
--- a/include/libvirt/libvirt-domain.h
+++ b/include/libvirt/libvirt-domain.h
@@ -4099,6 +4099,9 @@ int virDomainGetJobStats(virDomainPtr domain,
                          unsigned int flags);
 int virDomainAbortJob(virDomainPtr dom);
 
+int virDomainAbortJobFlags(virDomainPtr dom,
+                           unsigned int flags);
+
 /**
  * virDomainJobOperation:
  *
diff --git a/src/driver-hypervisor.h b/src/driver-hypervisor.h
index 69516e8fea..016d5cec7c 100644
--- a/src/driver-hypervisor.h
+++ b/src/driver-hypervisor.h
@@ -746,6 +746,10 @@ typedef int
 typedef int
 (*virDrvDomainAbortJob)(virDomainPtr domain);
 
+typedef int
+(*virDrvDomainAbortJobFlags)(virDomainPtr domain,
+                             unsigned int flags);
+
 typedef int
 (*virDrvDomainMigrateGetMaxDowntime)(virDomainPtr domain,
                                      unsigned long long *downtime,
@@ -1590,6 +1594,7 @@ struct _virHypervisorDriver {
     virDrvDomainGetJobInfo domainGetJobInfo;
     virDrvDomainGetJobStats domainGetJobStats;
     virDrvDomainAbortJob domainAbortJob;
+    virDrvDomainAbortJobFlags domainAbortJobFlags;
     virDrvDomainMigrateGetMaxDowntime domainMigrateGetMaxDowntime;
     virDrvDomainMigrateSetMaxDowntime domainMigrateSetMaxDowntime;
     virDrvDomainMigrateGetCompressionCache domainMigrateGetCompressionCache;
diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
index 07fb8119d9..1e1b378361 100644
--- a/src/libvirt-domain.c
+++ b/src/libvirt-domain.c
@@ -9459,6 +9459,51 @@ virDomainAbortJob(virDomainPtr domain)
 }
 
 
+/**
+ * virDomainAbortJobFlags:
+ * @domain: a domain object
+ * @flags: extra flags; not used yet, callers should always pass 0
+ *
+ * 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).
+ *
+ * Returns 0 in case of success and -1 in case of failure.
+ *
+ * Since: 8.4.0
+ */
+int
+virDomainAbortJobFlags(virDomainPtr domain,
+                       unsigned int flags)
+{
+    virConnectPtr conn;
+
+    VIR_DOMAIN_DEBUG(domain);
+
+    virResetLastError();
+
+    virCheckDomainReturn(domain, -1);
+    conn = domain->conn;
+
+    virCheckReadOnlyGoto(conn->flags, error);
+
+    if (conn->driver->domainAbortJobFlags) {
+        int ret;
+        ret = conn->driver->domainAbortJobFlags(domain, flags);
+        if (ret < 0)
+            goto error;
+        return ret;
+    }
+
+    virReportUnsupportedError();
+
+ error:
+    virDispatchError(conn);
+    return -1;
+}
+
+
 /**
  * virDomainMigrateSetMaxDowntime:
  * @domain: a domain object
diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms
index 9f58b52924..c68bbf3680 100644
--- a/src/libvirt_public.syms
+++ b/src/libvirt_public.syms
@@ -918,6 +918,7 @@ LIBVIRT_8.0.0 {
 
 LIBVIRT_8.4.0 {
     global:
+        virDomainAbortJobFlags;
         virDomainSaveParams;
         virDomainRestoreParams;
 } LIBVIRT_8.0.0;
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 423f5f9fb9..5ad517a387 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -8534,6 +8534,7 @@ static virHypervisorDriver hypervisor_driver = {
     .domainGetJobInfo = remoteDomainGetJobInfo, /* 0.7.7 */
     .domainGetJobStats = remoteDomainGetJobStats, /* 1.0.3 */
     .domainAbortJob = remoteDomainAbortJob, /* 0.7.7 */
+    .domainAbortJobFlags = remoteDomainAbortJobFlags, /* 8.2.0 */
     .domainMigrateGetMaxDowntime = remoteDomainMigrateGetMaxDowntime, /* 3.7.0 */
     .domainMigrateSetMaxDowntime = remoteDomainMigrateSetMaxDowntime, /* 0.8.0 */
     .domainMigrateGetCompressionCache = remoteDomainMigrateGetCompressionCache, /* 1.0.3 */
diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x
index 085631c11b..79ffc63f03 100644
--- a/src/remote/remote_protocol.x
+++ b/src/remote/remote_protocol.x
@@ -2492,6 +2492,12 @@ struct remote_domain_abort_job_args {
 };
 
 
+struct remote_domain_abort_job_flags_args {
+    remote_nonnull_domain dom;
+    unsigned int flags;
+};
+
+
 struct remote_domain_migrate_get_max_downtime_args {
     remote_nonnull_domain dom;
     unsigned int flags;
@@ -6947,5 +6953,11 @@ enum remote_procedure {
      * @acl: domain:start
      * @acl: domain:write
      */
-    REMOTE_PROC_DOMAIN_RESTORE_PARAMS = 441
+    REMOTE_PROC_DOMAIN_RESTORE_PARAMS = 441,
+
+    /**
+     * @generate: both
+     * @acl: domain:write
+     */
+    REMOTE_PROC_DOMAIN_ABORT_JOB_FLAGS = 442
 };
diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs
index 4ffdce5679..ca5222439d 100644
--- a/src/remote_protocol-structs
+++ b/src/remote_protocol-structs
@@ -1869,6 +1869,10 @@ struct remote_domain_get_job_stats_ret {
 struct remote_domain_abort_job_args {
         remote_nonnull_domain      dom;
 };
+struct remote_domain_abort_job_flags_args {
+        remote_nonnull_domain      dom;
+        u_int                      flags;
+};
 struct remote_domain_migrate_get_max_downtime_args {
         remote_nonnull_domain      dom;
         u_int                      flags;
@@ -3706,4 +3710,5 @@ enum remote_procedure {
         REMOTE_PROC_DOMAIN_SET_LAUNCH_SECURITY_STATE = 439,
         REMOTE_PROC_DOMAIN_SAVE_PARAMS = 440,
         REMOTE_PROC_DOMAIN_RESTORE_PARAMS = 441,
+        REMOTE_PROC_DOMAIN_ABORT_JOB_FLAGS = 442,
 };
-- 
2.35.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux