mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-30 16:35:24 +00:00
migration/dirtyrate: Introduce virDomainStartDirtyRateCalc API
Introduce virDomainStartDirtyRateCalc API for start calculation of a domain's memory dirty rate with a specified time. Signed-off-by: Hao Wang <wanghao232@huawei.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
f07ae0fcbd
commit
df5c5c3e60
@ -5128,4 +5128,8 @@ int virDomainGetMessages(virDomainPtr domain,
|
||||
char ***msgs,
|
||||
unsigned int flags);
|
||||
|
||||
int virDomainStartDirtyRateCalc(virDomainPtr domain,
|
||||
int seconds,
|
||||
unsigned int flags);
|
||||
|
||||
#endif /* LIBVIRT_DOMAIN_H */
|
||||
|
@ -1405,6 +1405,11 @@ typedef int
|
||||
char ***msgs,
|
||||
unsigned int flags);
|
||||
|
||||
typedef int
|
||||
(*virDrvDomainStartDirtyRateCalc)(virDomainPtr domain,
|
||||
int seconds,
|
||||
unsigned int flags);
|
||||
|
||||
typedef struct _virHypervisorDriver virHypervisorDriver;
|
||||
typedef virHypervisorDriver *virHypervisorDriverPtr;
|
||||
|
||||
@ -1671,4 +1676,5 @@ struct _virHypervisorDriver {
|
||||
virDrvDomainAuthorizedSSHKeysGet domainAuthorizedSSHKeysGet;
|
||||
virDrvDomainAuthorizedSSHKeysSet domainAuthorizedSSHKeysSet;
|
||||
virDrvDomainGetMessages domainGetMessages;
|
||||
virDrvDomainStartDirtyRateCalc domainStartDirtyRateCalc;
|
||||
};
|
||||
|
@ -13158,3 +13158,47 @@ virDomainGetMessages(virDomainPtr domain,
|
||||
virDispatchError(conn);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* virDomainStartDirtyRateCalc:
|
||||
* @domain: a domain object
|
||||
* @seconds: specified calculating time in seconds
|
||||
* @flags: extra flags; not used yet, so callers should always pass 0
|
||||
*
|
||||
* Calculate the current domain's memory dirty rate in next @seconds.
|
||||
* The calculated dirty rate information is available by calling
|
||||
* virConnectGetAllDomainStats.
|
||||
*
|
||||
* Returns 0 in case of success, -1 otherwise.
|
||||
*/
|
||||
int
|
||||
virDomainStartDirtyRateCalc(virDomainPtr domain,
|
||||
int seconds,
|
||||
unsigned int flags)
|
||||
{
|
||||
virConnectPtr conn;
|
||||
|
||||
VIR_DOMAIN_DEBUG(domain, "seconds=%d, flags=0x%x", seconds, flags);
|
||||
|
||||
virResetLastError();
|
||||
|
||||
virCheckDomainReturn(domain, -1);
|
||||
conn = domain->conn;
|
||||
|
||||
virCheckReadOnlyGoto(conn->flags, error);
|
||||
|
||||
if (conn->driver->domainStartDirtyRateCalc) {
|
||||
int ret;
|
||||
ret = conn->driver->domainStartDirtyRateCalc(domain, seconds, flags);
|
||||
if (ret < 0)
|
||||
goto error;
|
||||
return ret;
|
||||
}
|
||||
|
||||
virReportUnsupportedError();
|
||||
|
||||
error:
|
||||
virDispatchError(conn);
|
||||
return -1;
|
||||
}
|
||||
|
@ -884,4 +884,9 @@ LIBVIRT_7.1.0 {
|
||||
virDomainGetMessages;
|
||||
} LIBVIRT_6.10.0;
|
||||
|
||||
LIBVIRT_7.2.0 {
|
||||
global:
|
||||
virDomainStartDirtyRateCalc;
|
||||
} LIBVIRT_7.1.0;
|
||||
|
||||
# .... define new API here using predicted next version number ....
|
||||
|
@ -8571,6 +8571,7 @@ static virHypervisorDriver hypervisor_driver = {
|
||||
.domainAuthorizedSSHKeysGet = remoteDomainAuthorizedSSHKeysGet, /* 6.10.0 */
|
||||
.domainAuthorizedSSHKeysSet = remoteDomainAuthorizedSSHKeysSet, /* 6.10.0 */
|
||||
.domainGetMessages = remoteDomainGetMessages, /* 7.1.0 */
|
||||
.domainStartDirtyRateCalc = remoteDomainStartDirtyRateCalc, /* 7.2.0 */
|
||||
};
|
||||
|
||||
static virNetworkDriver network_driver = {
|
||||
|
@ -3811,6 +3811,12 @@ struct remote_domain_get_messages_ret {
|
||||
remote_nonnull_string msgs<REMOTE_DOMAIN_MESSAGES_MAX>;
|
||||
};
|
||||
|
||||
struct remote_domain_start_dirty_rate_calc_args {
|
||||
remote_nonnull_domain dom;
|
||||
int seconds;
|
||||
unsigned int flags;
|
||||
};
|
||||
|
||||
|
||||
/*----- Protocol. -----*/
|
||||
|
||||
@ -6733,5 +6739,11 @@ enum remote_procedure {
|
||||
* @generate: none
|
||||
* @acl: domain:read
|
||||
*/
|
||||
REMOTE_PROC_DOMAIN_GET_MESSAGES = 426
|
||||
REMOTE_PROC_DOMAIN_GET_MESSAGES = 426,
|
||||
|
||||
/**
|
||||
* @generate: both
|
||||
* @acl: domain:read
|
||||
*/
|
||||
REMOTE_PROC_DOMAIN_START_DIRTY_RATE_CALC = 427
|
||||
};
|
||||
|
@ -3172,6 +3172,11 @@ struct remote_domain_get_messages_ret {
|
||||
remote_nonnull_string * msgs_val;
|
||||
} msgs;
|
||||
};
|
||||
struct remote_domain_start_dirty_rate_calc_args {
|
||||
remote_nonnull_domain dom;
|
||||
int seconds;
|
||||
u_int flags;
|
||||
};
|
||||
enum remote_procedure {
|
||||
REMOTE_PROC_CONNECT_OPEN = 1,
|
||||
REMOTE_PROC_CONNECT_CLOSE = 2,
|
||||
@ -3599,4 +3604,5 @@ enum remote_procedure {
|
||||
REMOTE_PROC_DOMAIN_AUTHORIZED_SSH_KEYS_GET = 424,
|
||||
REMOTE_PROC_DOMAIN_AUTHORIZED_SSH_KEYS_SET = 425,
|
||||
REMOTE_PROC_DOMAIN_GET_MESSAGES = 426,
|
||||
REMOTE_PROC_DOMAIN_START_DIRTY_RATE_CALC = 427,
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user