Add virDomainAbortJobFlags public API

The original virDomainAbortJob did not support flags.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
Jiri Denemark 2022-05-10 15:20:25 +02:00
parent cf3842ef08
commit 57762f8527
7 changed files with 77 additions and 1 deletions

View File

@ -4099,6 +4099,9 @@ int virDomainGetJobStats(virDomainPtr domain,
unsigned int flags);
int virDomainAbortJob(virDomainPtr dom);
int virDomainAbortJobFlags(virDomainPtr dom,
unsigned int flags);
/**
* virDomainJobOperation:
*

View File

@ -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;

View File

@ -9470,6 +9470,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.5.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

View File

@ -922,4 +922,9 @@ LIBVIRT_8.4.0 {
virDomainRestoreParams;
} LIBVIRT_8.0.0;
LIBVIRT_8.5.0 {
global:
virDomainAbortJobFlags;
} LIBVIRT_8.4.0;
# .... define new API here using predicted next version number ....

View File

@ -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.5.0 */
.domainMigrateGetMaxDowntime = remoteDomainMigrateGetMaxDowntime, /* 3.7.0 */
.domainMigrateSetMaxDowntime = remoteDomainMigrateSetMaxDowntime, /* 0.8.0 */
.domainMigrateGetCompressionCache = remoteDomainMigrateGetCompressionCache, /* 1.0.3 */

View File

@ -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
};

View File

@ -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,
};