mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-01 17:35:17 +00:00
Introduce virDomainMigrate*CompressionCache APIs
Introduce virDomainMigrateGetCompressionCache and virDomainMigrateSetCompressionCache APIs.
This commit is contained in:
parent
8def32916d
commit
34f44e911f
@ -1215,6 +1215,13 @@ int virDomainMigrateSetMaxDowntime (virDomainPtr domain,
|
||||
unsigned long long downtime,
|
||||
unsigned int flags);
|
||||
|
||||
int virDomainMigrateGetCompressionCache(virDomainPtr domain,
|
||||
unsigned long long *cacheSize,
|
||||
unsigned int flags);
|
||||
int virDomainMigrateSetCompressionCache(virDomainPtr domain,
|
||||
unsigned long long cacheSize,
|
||||
unsigned int flags);
|
||||
|
||||
int virDomainMigrateSetMaxSpeed(virDomainPtr domain,
|
||||
unsigned long bandwidth,
|
||||
unsigned int flags);
|
||||
|
@ -444,6 +444,7 @@ skip_impl = (
|
||||
'virNodeGetCPUStats',
|
||||
'virNodeGetMemoryStats',
|
||||
'virDomainGetBlockJobInfo',
|
||||
'virDomainMigrateGetCompressionCache',
|
||||
'virDomainMigrateGetMaxSpeed',
|
||||
'virDomainBlockStatsFlags',
|
||||
'virDomainSetBlockIoTune',
|
||||
|
11
src/driver.h
11
src/driver.h
@ -604,6 +604,15 @@ typedef int
|
||||
(*virDrvDomainMigrateSetMaxDowntime)(virDomainPtr domain,
|
||||
unsigned long long downtime,
|
||||
unsigned int flags);
|
||||
typedef int
|
||||
(*virDrvDomainMigrateGetCompressionCache)(virDomainPtr domain,
|
||||
unsigned long long *cacheSize,
|
||||
unsigned int flags);
|
||||
typedef int
|
||||
(*virDrvDomainMigrateSetCompressionCache)(virDomainPtr domain,
|
||||
unsigned long long cacheSize,
|
||||
unsigned int flags);
|
||||
|
||||
typedef int
|
||||
(*virDrvDomainMigrateSetMaxSpeed)(virDomainPtr domain,
|
||||
unsigned long bandwidth,
|
||||
@ -1069,6 +1078,8 @@ struct _virDriver {
|
||||
virDrvDomainGetJobStats domainGetJobStats;
|
||||
virDrvDomainAbortJob domainAbortJob;
|
||||
virDrvDomainMigrateSetMaxDowntime domainMigrateSetMaxDowntime;
|
||||
virDrvDomainMigrateGetCompressionCache domainMigrateGetCompressionCache;
|
||||
virDrvDomainMigrateSetCompressionCache domainMigrateSetCompressionCache;
|
||||
virDrvDomainMigrateGetMaxSpeed domainMigrateGetMaxSpeed;
|
||||
virDrvDomainMigrateSetMaxSpeed domainMigrateSetMaxSpeed;
|
||||
virDrvDomainEventRegisterAny domainEventRegisterAny;
|
||||
|
@ -17551,6 +17551,101 @@ error:
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* virDomainMigrateGetCompressionCache:
|
||||
* @domain: a domain object
|
||||
* @cacheSize: return value of current size of the cache (in bytes)
|
||||
* @flags: extra flags; not used yet, so callers should always pass 0
|
||||
*
|
||||
* Gets current size of the cache (in bytes) used for compressing repeatedly
|
||||
* transferred memory pages during live migration.
|
||||
*
|
||||
* Returns 0 in case of success, -1 otherwise.
|
||||
*/
|
||||
int
|
||||
virDomainMigrateGetCompressionCache(virDomainPtr domain,
|
||||
unsigned long long *cacheSize,
|
||||
unsigned int flags)
|
||||
{
|
||||
virConnectPtr conn;
|
||||
|
||||
VIR_DOMAIN_DEBUG(domain, "cacheSize=%p, flags=%x", cacheSize, flags);
|
||||
|
||||
virResetLastError();
|
||||
|
||||
if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
|
||||
virLibDomainError(VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
|
||||
virDispatchError(NULL);
|
||||
return -1;
|
||||
}
|
||||
|
||||
conn = domain->conn;
|
||||
|
||||
virCheckNonNullArgGoto(cacheSize, error);
|
||||
|
||||
if (conn->driver->domainMigrateGetCompressionCache) {
|
||||
if (conn->driver->domainMigrateGetCompressionCache(domain, cacheSize,
|
||||
flags) < 0)
|
||||
goto error;
|
||||
return 0;
|
||||
}
|
||||
|
||||
virLibConnError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
|
||||
error:
|
||||
virDispatchError(conn);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* virDomainMigrateSetCompressionCache:
|
||||
* @domain: a domain object
|
||||
* @cacheSize: size of the cache (in bytes) used for compression
|
||||
* @flags: extra flags; not used yet, so callers should always pass 0
|
||||
*
|
||||
* Sets size of the cache (in bytes) used for compressing repeatedly
|
||||
* transferred memory pages during live migration. It's supposed to be called
|
||||
* while the domain is being live-migrated as a reaction to migration progress
|
||||
* and increasing number of compression cache misses obtained from
|
||||
* virDomainGetJobStats.
|
||||
*
|
||||
* Returns 0 in case of success, -1 otherwise.
|
||||
*/
|
||||
int
|
||||
virDomainMigrateSetCompressionCache(virDomainPtr domain,
|
||||
unsigned long long cacheSize,
|
||||
unsigned int flags)
|
||||
{
|
||||
virConnectPtr conn;
|
||||
|
||||
VIR_DOMAIN_DEBUG(domain, "cacheSize=%llu, flags=%x", cacheSize, flags);
|
||||
|
||||
virResetLastError();
|
||||
|
||||
if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
|
||||
virLibDomainError(VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
|
||||
virDispatchError(NULL);
|
||||
return -1;
|
||||
}
|
||||
|
||||
conn = domain->conn;
|
||||
if (conn->flags & VIR_CONNECT_RO) {
|
||||
virLibDomainError(VIR_ERR_OPERATION_DENIED, __FUNCTION__);
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (conn->driver->domainMigrateSetCompressionCache) {
|
||||
if (conn->driver->domainMigrateSetCompressionCache(domain, cacheSize,
|
||||
flags) < 0)
|
||||
goto error;
|
||||
return 0;
|
||||
}
|
||||
|
||||
virLibConnError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
|
||||
error:
|
||||
virDispatchError(conn);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* virDomainMigrateSetMaxSpeed:
|
||||
* @domain: a domain object
|
||||
|
@ -606,6 +606,8 @@ LIBVIRT_1.0.2 {
|
||||
LIBVIRT_1.0.3 {
|
||||
global:
|
||||
virDomainGetJobStats;
|
||||
virDomainMigrateGetCompressionCache;
|
||||
virDomainMigrateSetCompressionCache;
|
||||
virNodeDeviceLookupSCSIHostByWWN;
|
||||
} LIBVIRT_1.0.2;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user