mirror of https://gitee.com/openkylin/libvirt.git
introduce virDomainSetSchedulerParametersFlags
This new function allows aditional flags to be passed into from the virsh command line.
This commit is contained in:
parent
d4982b86d2
commit
d4b8a35755
|
@ -295,6 +295,12 @@ typedef enum {
|
|||
VIR_DOMAIN_SCHED_FIELD_BOOLEAN = 6 /* boolean(character) case */
|
||||
} virSchedParameterType;
|
||||
|
||||
typedef enum {
|
||||
VIR_DOMAIN_SCHEDPARAM_CURRENT = (1 << 0), /* affect current domain state */
|
||||
VIR_DOMAIN_SCHEDPARAM_LIVE = (1 << 1), /* Affect active domain */
|
||||
VIR_DOMAIN_SCHEDPARAM_CONFIG = (1 << 2), /* Affect next boot */
|
||||
} virDomainSchedParameterFlags;
|
||||
|
||||
/**
|
||||
* VIR_DOMAIN_SCHED_FIELD_LENGTH:
|
||||
*
|
||||
|
@ -346,6 +352,14 @@ int virDomainSetSchedulerParameters (virDomainPtr domain,
|
|||
virSchedParameterPtr params,
|
||||
int nparams);
|
||||
|
||||
/*
|
||||
* Change scheduler parameters
|
||||
*/
|
||||
int virDomainSetSchedulerParametersFlags (virDomainPtr domain,
|
||||
virSchedParameterPtr params,
|
||||
int nparams,
|
||||
unsigned int flags);
|
||||
|
||||
/**
|
||||
* virDomainBlockStats:
|
||||
*
|
||||
|
|
|
@ -312,6 +312,7 @@ skip_impl = (
|
|||
'virDomainGetSchedulerType',
|
||||
'virDomainGetSchedulerParameters',
|
||||
'virDomainSetSchedulerParameters',
|
||||
'virDomainSetSchedulerParametersFlags',
|
||||
'virDomainSetBlkioParameters',
|
||||
'virDomainGetBlkioParameters',
|
||||
'virDomainSetMemoryParameters',
|
||||
|
|
|
@ -285,6 +285,13 @@ typedef int
|
|||
virSchedParameterPtr params,
|
||||
int nparams);
|
||||
|
||||
typedef int
|
||||
(*virDrvDomainSetSchedulerParametersFlags)
|
||||
(virDomainPtr domain,
|
||||
virSchedParameterPtr params,
|
||||
int nparams,
|
||||
unsigned int flags);
|
||||
|
||||
typedef int
|
||||
(*virDrvDomainBlockStats)
|
||||
(virDomainPtr domain,
|
||||
|
@ -677,6 +684,7 @@ struct _virDriver {
|
|||
virDrvDomainGetSchedulerType domainGetSchedulerType;
|
||||
virDrvDomainGetSchedulerParameters domainGetSchedulerParameters;
|
||||
virDrvDomainSetSchedulerParameters domainSetSchedulerParameters;
|
||||
virDrvDomainSetSchedulerParametersFlags domainSetSchedulerParametersFlags;
|
||||
virDrvDomainMigratePrepare domainMigratePrepare;
|
||||
virDrvDomainMigratePerform domainMigratePerform;
|
||||
virDrvDomainMigrateFinish domainMigrateFinish;
|
||||
|
|
|
@ -5106,6 +5106,70 @@ error:
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* virDomainSetSchedulerParametersFlags:
|
||||
* @domain: pointer to domain object
|
||||
* @params: pointer to scheduler parameter objects
|
||||
* @nparams: number of scheduler parameter
|
||||
* (this value should be same or less than the returned value
|
||||
* nparams of virDomainGetSchedulerType)
|
||||
* @flags: virDomainSchedParameterFlags
|
||||
*
|
||||
* Change the scheduler parameters
|
||||
*
|
||||
* Returns -1 in case of error, 0 in case of success.
|
||||
*/
|
||||
int
|
||||
virDomainSetSchedulerParametersFlags(virDomainPtr domain,
|
||||
virSchedParameterPtr params,
|
||||
int nparams,
|
||||
unsigned int flags)
|
||||
{
|
||||
virConnectPtr conn;
|
||||
|
||||
VIR_DOMAIN_DEBUG(domain, "params=%p, nparams=%d, flags=%u",
|
||||
params, nparams, flags);
|
||||
|
||||
virResetLastError();
|
||||
|
||||
if (!(flags & (VIR_DOMAIN_SCHEDPARAM_LIVE |
|
||||
VIR_DOMAIN_SCHEDPARAM_CONFIG |
|
||||
VIR_DOMAIN_SCHEDPARAM_CURRENT))) {
|
||||
virLibDomainError(VIR_ERR_INVALID_ARG, __FUNCTION__);
|
||||
virDispatchError(NULL);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
|
||||
virLibDomainError(VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
|
||||
virDispatchError(NULL);
|
||||
return -1;
|
||||
}
|
||||
if (domain->conn->flags & VIR_CONNECT_RO) {
|
||||
virLibDomainError(VIR_ERR_OPERATION_DENIED, __FUNCTION__);
|
||||
goto error;
|
||||
}
|
||||
conn = domain->conn;
|
||||
|
||||
if (conn->driver->domainSetSchedulerParametersFlags) {
|
||||
int ret;
|
||||
ret = conn->driver->domainSetSchedulerParametersFlags(domain,
|
||||
params,
|
||||
nparams,
|
||||
flags);
|
||||
if (ret < 0)
|
||||
goto error;
|
||||
return ret;
|
||||
}
|
||||
|
||||
virLibConnError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
|
||||
|
||||
error:
|
||||
virDispatchError(domain->conn);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* virDomainBlockStats:
|
||||
* @dom: pointer to the domain object
|
||||
|
|
|
@ -441,6 +441,7 @@ LIBVIRT_0.9.2 {
|
|||
virDomainGetState;
|
||||
virDomainInjectNMI;
|
||||
virDomainScreenshot;
|
||||
virDomainSetSchedulerParametersFlags;
|
||||
} LIBVIRT_0.9.0;
|
||||
|
||||
# .... define new API here using predicted next version number ....
|
||||
|
|
Loading…
Reference in New Issue