mirror of https://gitee.com/openkylin/libvirt.git
sched: introduce virDomainGetSchedulerParametersFlags
If we can choose live or config when setting, then we need to be able to choose which one we are querying. Also, make the documentation clear that set must use a non-empty subset (some of the hypervisors fail if params is NULL). * include/libvirt/libvirt.h.in (virDomainGetSchedulerParametersFlags): New prototype. * src/libvirt.c (virDomainGetSchedulerParametersFlags): Implement it. * src/libvirt_public.syms: Export it. * python/generator.py (skip_impl): Don't auto-generate. * src/driver.h (virDrvDomainGetSchedulerParametersFlags): New callback.
This commit is contained in:
parent
8a47ed2981
commit
bc4ee58972
|
@ -350,6 +350,10 @@ typedef enum {
|
|||
int virDomainGetSchedulerParameters (virDomainPtr domain,
|
||||
virTypedParameterPtr params,
|
||||
int *nparams);
|
||||
int virDomainGetSchedulerParametersFlags (virDomainPtr domain,
|
||||
virTypedParameterPtr params,
|
||||
int *nparams,
|
||||
unsigned int flags);
|
||||
|
||||
/*
|
||||
* Change scheduler parameters
|
||||
|
@ -357,10 +361,6 @@ int virDomainGetSchedulerParameters (virDomainPtr domain,
|
|||
int virDomainSetSchedulerParameters (virDomainPtr domain,
|
||||
virTypedParameterPtr params,
|
||||
int nparams);
|
||||
|
||||
/*
|
||||
* Change scheduler parameters
|
||||
*/
|
||||
int virDomainSetSchedulerParametersFlags (virDomainPtr domain,
|
||||
virTypedParameterPtr params,
|
||||
int nparams,
|
||||
|
|
|
@ -323,6 +323,7 @@ skip_impl = (
|
|||
'virNodeGetCellsFreeMemory',
|
||||
'virDomainGetSchedulerType',
|
||||
'virDomainGetSchedulerParameters',
|
||||
'virDomainGetSchedulerParametersFlags',
|
||||
'virDomainSetSchedulerParameters',
|
||||
'virDomainSetSchedulerParametersFlags',
|
||||
'virDomainSetBlkioParameters',
|
||||
|
|
|
@ -279,6 +279,13 @@ typedef int
|
|||
virTypedParameterPtr params,
|
||||
int *nparams);
|
||||
|
||||
typedef int
|
||||
(*virDrvDomainGetSchedulerParametersFlags)
|
||||
(virDomainPtr domain,
|
||||
virTypedParameterPtr params,
|
||||
int *nparams,
|
||||
unsigned int flags);
|
||||
|
||||
typedef int
|
||||
(*virDrvDomainSetSchedulerParameters)
|
||||
(virDomainPtr domain,
|
||||
|
@ -686,6 +693,7 @@ struct _virDriver {
|
|||
virDrvDomainSetAutostart domainSetAutostart;
|
||||
virDrvDomainGetSchedulerType domainGetSchedulerType;
|
||||
virDrvDomainGetSchedulerParameters domainGetSchedulerParameters;
|
||||
virDrvDomainGetSchedulerParametersFlags domainGetSchedulerParametersFlags;
|
||||
virDrvDomainSetSchedulerParameters domainSetSchedulerParameters;
|
||||
virDrvDomainSetSchedulerParametersFlags domainSetSchedulerParametersFlags;
|
||||
virDrvDomainMigratePrepare domainMigratePrepare;
|
||||
|
|
|
@ -5428,7 +5428,9 @@ error:
|
|||
*
|
||||
* Get all scheduler parameters, the @params array will be filled with the
|
||||
* values and @nparams will be updated to the number of valid elements in
|
||||
* @params.
|
||||
* @params. It is hypervisor specific whether this returns the live or
|
||||
* persistent state; for more control, use
|
||||
* virDomainGetSchedulerParametersFlags.
|
||||
*
|
||||
* Returns -1 in case of error, 0 in case of success.
|
||||
*/
|
||||
|
@ -5470,6 +5472,65 @@ error:
|
|||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* virDomainGetSchedulerParametersFlags:
|
||||
* @domain: pointer to domain object
|
||||
* @params: pointer to scheduler parameter object
|
||||
* (return value)
|
||||
* @nparams: pointer to number of scheduler parameter
|
||||
* (this value should be same than the returned value
|
||||
* nparams of virDomainGetSchedulerType)
|
||||
* @flags: virDomainSchedParameterFlags
|
||||
*
|
||||
* Get the scheduler parameters, the @params array will be filled with the
|
||||
* values.
|
||||
*
|
||||
* The value of @flags can be exactly VIR_DOMAIN_SCHEDPARAM_CURRENT,
|
||||
* VIR_DOMAIN_SCHEDPARAM_LIVE, or VIR_DOMAIN_SCHEDPARAM_CONFIG.
|
||||
*
|
||||
* Returns -1 in case of error, 0 in case of success.
|
||||
*/
|
||||
int
|
||||
virDomainGetSchedulerParametersFlags(virDomainPtr domain,
|
||||
virTypedParameterPtr params, int *nparams,
|
||||
unsigned int flags)
|
||||
{
|
||||
virConnectPtr conn;
|
||||
|
||||
VIR_DOMAIN_DEBUG(domain, "params=%p, nparams=%p, flags=%u",
|
||||
params, nparams, flags);
|
||||
|
||||
virResetLastError();
|
||||
|
||||
if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
|
||||
virLibDomainError(VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
|
||||
virDispatchError(NULL);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (params == NULL || nparams == NULL || *nparams <= 0) {
|
||||
virLibDomainError(VIR_ERR_INVALID_ARG, __FUNCTION__);
|
||||
goto error;
|
||||
}
|
||||
|
||||
conn = domain->conn;
|
||||
|
||||
if (conn->driver->domainGetSchedulerParametersFlags) {
|
||||
int ret;
|
||||
ret = conn->driver->domainGetSchedulerParametersFlags (domain, params,
|
||||
nparams, flags);
|
||||
if (ret < 0)
|
||||
goto error;
|
||||
return ret;
|
||||
}
|
||||
|
||||
virLibConnError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
|
||||
|
||||
error:
|
||||
virDispatchError(domain->conn);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* virDomainSetSchedulerParameters:
|
||||
* @domain: pointer to domain object
|
||||
|
@ -5478,7 +5539,10 @@ error:
|
|||
* (this value can be the same or less than the returned value
|
||||
* nparams of virDomainGetSchedulerType)
|
||||
*
|
||||
* Change all or a subset or the scheduler parameters.
|
||||
* Change all or a subset or the scheduler parameters. It is
|
||||
* hypervisor-specific whether this sets live, persistent, or both
|
||||
* settings; for more control, use
|
||||
* virDomainSetSchedulerParametersFlags.
|
||||
*
|
||||
* Returns -1 in case of error, 0 in case of success.
|
||||
*/
|
||||
|
@ -5534,7 +5598,11 @@ error:
|
|||
* nparams of virDomainGetSchedulerType)
|
||||
* @flags: virDomainSchedParameterFlags
|
||||
*
|
||||
* Change a subset or all scheduler parameters.
|
||||
* Change a subset or all scheduler parameters. The value of @flags
|
||||
* should be either VIR_DOMAIN_SCHEDPARAM_CURRENT, or a bitwise-or of
|
||||
* values from VIR_DOMAIN_SCHEDPARAM_LIVE and
|
||||
* VIR_DOMAIN_SCHEDPARAM_CURRENT, although hypervisors vary in which
|
||||
* flags are supported.
|
||||
*
|
||||
* Returns -1 in case of error, 0 in case of success.
|
||||
*/
|
||||
|
|
|
@ -438,12 +438,13 @@ LIBVIRT_0.9.0 {
|
|||
|
||||
LIBVIRT_0.9.2 {
|
||||
global:
|
||||
virDomainGetSchedulerParametersFlags;
|
||||
virDomainGetState;
|
||||
virDomainInjectNMI;
|
||||
virDomainMigrate2;
|
||||
virDomainMigrateToURI2;
|
||||
virDomainScreenshot;
|
||||
virDomainSetSchedulerParametersFlags;
|
||||
virDomainMigrate2;
|
||||
virDomainMigrateToURI2;
|
||||
virInterfaceChangeBegin;
|
||||
virInterfaceChangeCommit;
|
||||
virInterfaceChangeRollback;
|
||||
|
|
Loading…
Reference in New Issue