diff options
author | Scott Garfinkle <scottgar@linux.vnet.ibm.com> | 2017-08-17 17:17:19 -0500 |
---|---|---|
committer | John Ferlan <jferlan@redhat.com> | 2017-08-26 07:55:17 -0400 |
commit | 4601a546b7b2b09b591a92930aa62873d5dc2583 (patch) | |
tree | 36e7d99dbc26d9fa30316d7ae3d8f9974330416f | |
parent | ed9db36b426dcf9e4c34f2126379c339773f6db8 (diff) | |
download | libvirt-4601a546b7b2b09b591a92930aa62873d5dc2583.tar.gz |
Add virDomainMigrateGetMaxDowntime public API
Add virDomainMigrateGetMaxDowntime to support querying maximum allowable
downtime during live migration.
-rw-r--r-- | include/libvirt/libvirt-domain.h | 4 | ||||
-rw-r--r-- | src/driver-hypervisor.h | 6 | ||||
-rw-r--r-- | src/libvirt-domain.c | 41 | ||||
-rw-r--r-- | src/libvirt_public.syms | 4 |
4 files changed, 55 insertions, 0 deletions
diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h index a3bb9cbe9c..fae24ac93e 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -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); diff --git a/src/driver-hypervisor.h b/src/driver-hypervisor.h index 3053d7ae8c..7b35e9e68d 100644 --- a/src/driver-hypervisor.h +++ b/src/driver-hypervisor.h @@ -697,6 +697,11 @@ 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, unsigned int flags); @@ -1412,6 +1417,7 @@ struct _virHypervisorDriver { virDrvDomainGetJobInfo domainGetJobInfo; virDrvDomainGetJobStats domainGetJobStats; virDrvDomainAbortJob domainAbortJob; + virDrvDomainMigrateGetMaxDowntime domainMigrateGetMaxDowntime; virDrvDomainMigrateSetMaxDowntime domainMigrateSetMaxDowntime; virDrvDomainMigrateGetCompressionCache domainMigrateGetCompressionCache; virDrvDomainMigrateSetCompressionCache domainMigrateSetCompressionCache; diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index 87fca29c4d..4d0ac30d59 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -8777,6 +8777,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 * @cacheSize: return value of current size of the cache (in bytes) diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms index fac77fbea8..b55ca4b553 100644 --- a/src/libvirt_public.syms +++ b/src/libvirt_public.syms @@ -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 .... |