mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-31 21:17:54 +03:00
test_driver: Implement virDomainGetBlkioParameters
Signed-off-by: Luke Yue <lukedyue@gmail.com> Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
d080338594
commit
68eca8ad71
@ -3290,6 +3290,52 @@ static char *testDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
testDomainGetBlkioParameters(virDomainPtr dom,
|
||||
virTypedParameterPtr params,
|
||||
int *nparams,
|
||||
unsigned int flags)
|
||||
{
|
||||
virDomainObj *vm = NULL;
|
||||
virDomainDef *def = NULL;
|
||||
int maxparams = 6;
|
||||
int ret = -1;
|
||||
|
||||
virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
|
||||
VIR_DOMAIN_AFFECT_CONFIG |
|
||||
VIR_TYPED_PARAM_STRING_OKAY, -1);
|
||||
|
||||
if ((*nparams) == 0) {
|
||||
*nparams = 6;
|
||||
return 0;
|
||||
} else if (*nparams < maxparams) {
|
||||
maxparams = *nparams;
|
||||
}
|
||||
|
||||
*nparams = 0;
|
||||
|
||||
if (!(vm = testDomObjFromDomain(dom)))
|
||||
return -1;
|
||||
|
||||
if (!(def = virDomainObjGetOneDef(vm, flags)))
|
||||
goto cleanup;
|
||||
|
||||
if (virTypedParameterAssign(&(params[(*nparams)++]),
|
||||
VIR_DOMAIN_BLKIO_WEIGHT,
|
||||
VIR_TYPED_PARAM_UINT,
|
||||
def->blkio.weight) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (virDomainGetBlkioParametersAssignFromDef(def, params, nparams,
|
||||
maxparams) < 0)
|
||||
goto cleanup;
|
||||
|
||||
ret = 0;
|
||||
|
||||
cleanup:
|
||||
virDomainObjEndAPI(&vm);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#define TEST_SET_PARAM(index, name, type, value) \
|
||||
if (index < *nparams && \
|
||||
@ -9522,6 +9568,7 @@ static virHypervisorDriver testHypervisorDriver = {
|
||||
.domainGetInterfaceParameters = testDomainGetInterfaceParameters, /* 5.6.0 */
|
||||
.domainSetBlockIoTune = testDomainSetBlockIoTune, /* 5.7.0 */
|
||||
.domainGetBlockIoTune = testDomainGetBlockIoTune, /* 5.7.0 */
|
||||
.domainGetBlkioParameters = testDomainGetBlkioParameters, /* 7.7.0 */
|
||||
.connectListDefinedDomains = testConnectListDefinedDomains, /* 0.1.11 */
|
||||
.connectNumOfDefinedDomains = testConnectNumOfDefinedDomains, /* 0.1.11 */
|
||||
.domainCreate = testDomainCreate, /* 0.1.11 */
|
||||
|
Loading…
Reference in New Issue
Block a user