libvirt: add virDomain{Get,Set}BlkioParameters

Add virDomainSetBlkioParameters virDomainGetBlkioParameters

Signed-off-by: Gui Jianfeng <guijianfeng@cn.fujitsu.com>
This commit is contained in:
Gui Jianfeng 2011-02-22 13:30:33 +08:00 committed by Eric Blake
parent 2d70a46911
commit 13c5282122
4 changed files with 101 additions and 1 deletions

View File

@ -676,6 +676,73 @@ int virDomainGetInfo (virDomainPtr domain,
*/
char * virDomainGetSchedulerType(virDomainPtr domain,
int *nparams);
/**
* virDomainBlkioParameterType:
*
* A blkio parameter field type
*/
typedef enum {
VIR_DOMAIN_BLKIO_PARAM_INT = 1, /* integer case */
VIR_DOMAIN_BLKIO_PARAM_UINT = 2, /* unsigned integer case */
VIR_DOMAIN_BLKIO_PARAM_LLONG = 3, /* long long case */
VIR_DOMAIN_BLKIO_PARAM_ULLONG = 4, /* unsigned long long case */
VIR_DOMAIN_BLKIO_PARAM_DOUBLE = 5, /* double case */
VIR_DOMAIN_BLKIO_PARAM_BOOLEAN = 6 /* boolean(character) case */
} virBlkioParameterType;
/**
* VIR_DOMAIN_BLKIO_FIELD_LENGTH:
*
* Macro providing the field length of virBlkioParameter
*/
#define VIR_DOMAIN_BLKIO_FIELD_LENGTH 80
/**
* VIR_DOMAIN_BLKIO_WEIGHT:
*
* Macro for the Blkio tunable weight: it represents the io weight
* the guest can use.
*/
#define VIR_DOMAIN_BLKIO_WEIGHT "weight"
/**
* virDomainBlkioParameter:
*
* a virDomainBlkioParameter is the set of blkio parameters
*/
typedef struct _virBlkioParameter virBlkioParameter;
struct _virBlkioParameter {
char field[VIR_DOMAIN_BLKIO_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 */
};
/**
* virBlkioParameterPtr:
*
* a virBlkioParameterPtr is a pointer to a virBlkioParameter structure.
*/
typedef virBlkioParameter *virBlkioParameterPtr;
/* Set Blkio tunables for the domain*/
int virDomainSetBlkioParameters(virDomainPtr domain,
virBlkioParameterPtr params,
int nparams, unsigned int flags);
int virDomainGetBlkioParameters(virDomainPtr domain,
virBlkioParameterPtr params,
int *nparams, unsigned int flags);
/**
* virDomainMemoryParameterType:

View File

@ -306,6 +306,8 @@ skip_impl = (
'virDomainGetSchedulerType',
'virDomainGetSchedulerParameters',
'virDomainSetSchedulerParameters',
'virDomainSetBlkioParameters',
'virDomainGetBlkioParameters',
'virDomainSetMemoryParameters',
'virDomainGetMemoryParameters',
'virDomainGetVcpus',

View File

@ -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='virDomainSetBlkioParameters' file='python'>
<info>Change the blkio 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='virBlkioParameterPtr' info='pointer to blkio tunable objects'/>
</function>
<function name='virDomainGetBlkioParameters' file='python'>
<info>Get the blkio 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='virBlkioParameterPtr' info='pointer to blkio tunable 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.'/>

View File

@ -4,7 +4,7 @@
* entry points where an automatically generated stub is
* unpractical
*
* Copyright (C) 2005, 2007-2010 Red Hat, Inc.
* Copyright (C) 2005, 2007-2011 Red Hat, Inc.
*
* Daniel Veillard <veillard@redhat.com>
*/
@ -371,6 +371,23 @@ libvirt_virDomainSetSchedulerParameters(PyObject *self ATTRIBUTE_UNUSED,
return VIR_PY_INT_SUCCESS;
}
/* FIXME: This is a place holder for the implementation. */
static PyObject *
libvirt_virDomainSetBlkioParameters(PyObject *self ATTRIBUTE_UNUSED,
PyObject *args ATTRIBUTE_UNUSED) {
return VIR_PY_INT_FAIL;
}
/* FIXME: This is a place holder for the implementation. */
static PyObject *
libvirt_virDomainGetBlkioParameters(PyObject *self ATTRIBUTE_UNUSED,
PyObject *args ATTRIBUTE_UNUSED) {
return VIR_PY_INT_FAIL;
}
/* FIXME: This is a place holder for the implementation. */
static PyObject *
libvirt_virDomainSetMemoryParameters(PyObject *self ATTRIBUTE_UNUSED,
@ -3532,6 +3549,8 @@ static PyMethodDef libvirtMethods[] = {
{(char *) "virDomainGetSchedulerType", libvirt_virDomainGetSchedulerType, METH_VARARGS, NULL},
{(char *) "virDomainGetSchedulerParameters", libvirt_virDomainGetSchedulerParameters, METH_VARARGS, NULL},
{(char *) "virDomainSetSchedulerParameters", libvirt_virDomainSetSchedulerParameters, METH_VARARGS, NULL},
{(char *) "virDomainSetBlkioParameters", libvirt_virDomainSetBlkioParameters, METH_VARARGS, NULL},
{(char *) "virDomainGetBlkioParameters", libvirt_virDomainGetBlkioParameters, METH_VARARGS, NULL},
{(char *) "virDomainSetMemoryParameters", libvirt_virDomainSetMemoryParameters, METH_VARARGS, NULL},
{(char *) "virDomainGetMemoryParameters", libvirt_virDomainGetMemoryParameters, METH_VARARGS, NULL},
{(char *) "virDomainGetVcpus", libvirt_virDomainGetVcpus, METH_VARARGS, NULL},