mirror of https://gitee.com/openkylin/libvirt.git
Add virDomainMigrateGetMaxDowntime public API
Add virDomainMigrateGetMaxDowntime to support querying maximum allowable downtime during live migration.
This commit is contained in:
parent
ed9db36b42
commit
4601a546b7
|
@ -1039,6 +1039,10 @@ int virDomainMigrateToURI3(virDomainPtr domain,
|
|||
unsigned int nparams,
|
||||
unsigned int flags);
|
||||
|
||||
int virDomainMigrateGetMaxDowntime(virDomainPtr domain,
|
||||
unsigned long long *downtime,
|
||||
unsigned int flags);
|
||||
|
||||
int virDomainMigrateSetMaxDowntime (virDomainPtr domain,
|
||||
unsigned long long downtime,
|
||||
unsigned int flags);
|
||||
|
|
|
@ -696,6 +696,11 @@ typedef int
|
|||
typedef int
|
||||
(*virDrvDomainAbortJob)(virDomainPtr domain);
|
||||
|
||||
typedef int
|
||||
(*virDrvDomainMigrateGetMaxDowntime)(virDomainPtr domain,
|
||||
unsigned long long *downtime,
|
||||
unsigned int flags);
|
||||
|
||||
typedef int
|
||||
(*virDrvDomainMigrateSetMaxDowntime)(virDomainPtr domain,
|
||||
unsigned long long downtime,
|
||||
|
@ -1412,6 +1417,7 @@ struct _virHypervisorDriver {
|
|||
virDrvDomainGetJobInfo domainGetJobInfo;
|
||||
virDrvDomainGetJobStats domainGetJobStats;
|
||||
virDrvDomainAbortJob domainAbortJob;
|
||||
virDrvDomainMigrateGetMaxDowntime domainMigrateGetMaxDowntime;
|
||||
virDrvDomainMigrateSetMaxDowntime domainMigrateSetMaxDowntime;
|
||||
virDrvDomainMigrateGetCompressionCache domainMigrateGetCompressionCache;
|
||||
virDrvDomainMigrateSetCompressionCache domainMigrateSetCompressionCache;
|
||||
|
|
|
@ -8776,6 +8776,47 @@ virDomainMigrateSetMaxDowntime(virDomainPtr domain,
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* virDomainMigrateGetMaxDowntime:
|
||||
* @domain: a domain object
|
||||
* @downtime: return value of the maximum tolerable downtime for live
|
||||
* migration, in milliseconds
|
||||
* @flags: extra flags; not used yet, so callers should always pass 0
|
||||
*
|
||||
* Gets current maximum tolerable time for which the domain may be paused
|
||||
* at the end of live migration.
|
||||
*
|
||||
* Returns 0 in case of success, -1 otherwise.
|
||||
*/
|
||||
int
|
||||
virDomainMigrateGetMaxDowntime(virDomainPtr domain,
|
||||
unsigned long long *downtime,
|
||||
unsigned int flags)
|
||||
{
|
||||
virConnectPtr conn;
|
||||
|
||||
VIR_DOMAIN_DEBUG(domain, "downtime = %p, flags=%x", downtime, flags);
|
||||
|
||||
virResetLastError();
|
||||
|
||||
virCheckDomainReturn(domain, -1);
|
||||
conn = domain->conn;
|
||||
|
||||
virCheckNonNullArgGoto(downtime, error);
|
||||
|
||||
if (conn->driver->domainMigrateGetMaxDowntime) {
|
||||
if (conn->driver->domainMigrateGetMaxDowntime(domain, downtime, flags) < 0)
|
||||
goto error;
|
||||
return 0;
|
||||
}
|
||||
|
||||
virReportUnsupportedError();
|
||||
error:
|
||||
virDispatchError(conn);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* virDomainMigrateGetCompressionCache:
|
||||
* @domain: a domain object
|
||||
|
|
|
@ -768,4 +768,8 @@ LIBVIRT_3.4.0 {
|
|||
virStreamSparseSendAll;
|
||||
} LIBVIRT_3.1.0;
|
||||
|
||||
LIBVIRT_3.7.0 {
|
||||
global:
|
||||
virDomainMigrateGetMaxDowntime;
|
||||
} LIBVIRT_3.4.0;
|
||||
# .... define new API here using predicted next version number ....
|
||||
|
|
Loading…
Reference in New Issue