提交 bf1b76ff 编写于 作者: N Nikunj A. Dadhania 提交者: Daniel Veillard

Adding structure and defines for virDomainSet/GetMemoryParameters

This patch adds a structure virMemoryParameter, it contains the name of
the
parameter and the type of the parameter along with a union.

dv:
+ rename enums to VIR_DOMAIN_MEMORY_PARAM_*
+ remove some extraneous tabs

v4:
+ Add unsigned int flags to the public api for future extensions

v3:
+ Protoype for virDomainGetMemoryParameters and dummy python binding.

v2:
+ Includes dummy python bindings for the library to build cleanly.
+ Define string constants like "hard_limit", etc.
+ re-order this patch.
上级 a4deed4a
......@@ -674,6 +674,69 @@ int virDomainGetInfo (virDomainPtr domain,
char * virDomainGetSchedulerType(virDomainPtr domain,
int *nparams);
/**
* virDomainMemoryParameterType:
*
* A memory parameter field type
*/
typedef enum {
VIR_DOMAIN_MEMORY_PARAM_INT = 1, /* integer case */
VIR_DOMAIN_MEMORY_PARAM_UINT = 2, /* unsigned integer case */
VIR_DOMAIN_MEMORY_PARAM_LLONG = 3, /* long long case */
VIR_DOMAIN_MEMORY_PARAM_ULLONG = 4, /* unsigned long long case */
VIR_DOMAIN_MEMORY_PARAM_DOUBLE = 5, /* double case */
VIR_DOMAIN_MEMORY_PARAM_BOOLEAN = 6 /* boolean(character) case */
} virMemoryParameterType;
/**
* VIR_DOMAIN_MEMORY_FIELD_LENGTH:
*
* Macro providing the field length of virMemoryParameter
*/
#define VIR_DOMAIN_MEMORY_FIELD_LENGTH 80
#define VIR_DOMAIN_MEMORY_HARD_LIMIT "hard_limit"
#define VIR_DOMAIN_MEMORY_SOFT_LIMIT "soft_limit"
#define VIR_DOMAIN_MEMORY_MIN_GUARANTEE "min_guarantee"
#define VIR_DOMAIN_SWAP_HARD_LIMIT "swap_hard_limit"
/**
* virDomainMemoryParameter:
*
* a virDomainMemoryParameter is the set of scheduler parameters
*/
typedef struct _virMemoryParameter virMemoryParameter;
struct _virMemoryParameter {
char field[VIR_DOMAIN_MEMORY_FIELD_LENGTH]; /* parameter name */
int type; /* parameter type */
union {
int i; /* data for integer case */
unsigned int ui; /* data for unsigned integer case */
long long int l; /* data for long long integer case */
unsigned long long int ul; /* data for unsigned long long integer case */
double d; /* data for double case */
char b; /* data for char case */
} value; /* parameter value */
};
/**
* virMemoryParameterPtr:
*
* a virMemoryParameterPtr is a pointer to a virMemoryParameter structure.
*/
typedef virMemoryParameter *virMemoryParameterPtr;
/* Set memory tunables for the domain*/
int virDomainSetMemoryParameters(virDomainPtr domain,
virMemoryParameterPtr params,
int nparams, unsigned int flags);
int virDomainGetMemoryParameters(virDomainPtr domain,
virMemoryParameterPtr params,
int *nparams, unsigned int flags);
/*
* Dynamic control of domains
*/
......
......@@ -306,6 +306,8 @@ skip_impl = (
'virDomainGetSchedulerType',
'virDomainGetSchedulerParameters',
'virDomainSetSchedulerParameters',
'virDomainSetMemoryParameters',
'virDomainGetMemoryParameters',
'virDomainGetVcpus',
'virDomainPinVcpu',
'virSecretGetValue',
......
......@@ -162,6 +162,18 @@
<arg name='domain' type='virDomainPtr' info='pointer to domain object'/>
<arg name='params' type='virSchedParameterPtr' info='pointer to scheduler parameter objects'/>
</function>
<function name='virDomainSetMemoryParameters' file='python'>
<info>Change the memory tunables</info>
<return type='int' info='-1 in case of error, 0 in case of success.'/>
<arg name='domain' type='virDomainPtr' info='pointer to domain object'/>
<arg name='params' type='virMemoryParameterPtr' info='pointer to memory tunable objects'/>
</function>
<function name='virDomainGetMemoryParameters' file='python'>
<info>Get the memory parameters, the @params array will be filled with the values.</info>
<return type='int' info='-1 in case of error, 0 in case of success.'/>
<arg name='domain' type='virDomainPtr' info='pointer to domain object'/>
<arg name='params' type='virMemoryParameterPtr' info='pointer to memory tunable objects'/>
</function>
<function name='virConnectListStoragePools' file='python'>
<info>list the storage pools, stores the pointers to the names in @names</info>
<arg name='conn' type='virConnectPtr' info='pointer to the hypervisor connection'/>
......
......@@ -371,6 +371,20 @@ libvirt_virDomainSetSchedulerParameters(PyObject *self ATTRIBUTE_UNUSED,
return VIR_PY_INT_SUCCESS;
}
/* FIXME: This is a place holder for the implementation. */
static PyObject *
libvirt_virDomainSetMemoryParameters(PyObject *self ATTRIBUTE_UNUSED,
PyObject *args) {
return VIR_PY_INT_FAIL;
}
/* FIXME: This is a place holder for the implementation. */
static PyObject *
libvirt_virDomainGetMemoryParameters(PyObject *self ATTRIBUTE_UNUSED,
PyObject *args) {
return VIR_PY_INT_FAIL;
}
static PyObject *
libvirt_virDomainGetVcpus(PyObject *self ATTRIBUTE_UNUSED,
PyObject *args) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册