mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
test_driver: Implement virDomainSetBlkioParameters
Signed-off-by: Luke Yue <lukedyue@gmail.com> Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
68eca8ad71
commit
2dfc2ab48a
@ -17,6 +17,7 @@ if conf.has('WITH_TEST')
|
||||
],
|
||||
include_directories: [
|
||||
conf_inc_dir,
|
||||
hypervisor_inc_dir,
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include "interface_conf.h"
|
||||
#include "checkpoint_conf.h"
|
||||
#include "domain_conf.h"
|
||||
#include "domain_driver.h"
|
||||
#include "domain_event.h"
|
||||
#include "network_event.h"
|
||||
#include "snapshot_conf.h"
|
||||
@ -3290,6 +3291,51 @@ static char *testDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
testDomainSetBlkioParameters(virDomainPtr dom,
|
||||
virTypedParameterPtr params,
|
||||
int nparams,
|
||||
unsigned int flags)
|
||||
{
|
||||
virDomainObj *vm = NULL;
|
||||
virDomainDef *def;
|
||||
int ret = -1;
|
||||
|
||||
virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
|
||||
VIR_DOMAIN_AFFECT_CONFIG, -1);
|
||||
|
||||
if (virTypedParamsValidate(params, nparams,
|
||||
VIR_DOMAIN_BLKIO_WEIGHT,
|
||||
VIR_TYPED_PARAM_UINT,
|
||||
VIR_DOMAIN_BLKIO_DEVICE_WEIGHT,
|
||||
VIR_TYPED_PARAM_STRING,
|
||||
VIR_DOMAIN_BLKIO_DEVICE_READ_IOPS,
|
||||
VIR_TYPED_PARAM_STRING,
|
||||
VIR_DOMAIN_BLKIO_DEVICE_WRITE_IOPS,
|
||||
VIR_TYPED_PARAM_STRING,
|
||||
VIR_DOMAIN_BLKIO_DEVICE_READ_BPS,
|
||||
VIR_TYPED_PARAM_STRING,
|
||||
VIR_DOMAIN_BLKIO_DEVICE_WRITE_BPS,
|
||||
VIR_TYPED_PARAM_STRING,
|
||||
NULL) < 0)
|
||||
return -1;
|
||||
|
||||
if (!(vm = testDomObjFromDomain(dom)))
|
||||
return -1;
|
||||
|
||||
if (!(def = virDomainObjGetOneDef(vm, flags)))
|
||||
goto cleanup;
|
||||
|
||||
ret = virDomainDriverSetupPersistentDefBlkioParams(def,
|
||||
params,
|
||||
nparams);
|
||||
|
||||
cleanup:
|
||||
virDomainObjEndAPI(&vm);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
testDomainGetBlkioParameters(virDomainPtr dom,
|
||||
virTypedParameterPtr params,
|
||||
@ -9568,6 +9614,7 @@ static virHypervisorDriver testHypervisorDriver = {
|
||||
.domainGetInterfaceParameters = testDomainGetInterfaceParameters, /* 5.6.0 */
|
||||
.domainSetBlockIoTune = testDomainSetBlockIoTune, /* 5.7.0 */
|
||||
.domainGetBlockIoTune = testDomainGetBlockIoTune, /* 5.7.0 */
|
||||
.domainSetBlkioParameters = testDomainSetBlkioParameters, /* 7.7.0 */
|
||||
.domainGetBlkioParameters = testDomainGetBlkioParameters, /* 7.7.0 */
|
||||
.connectListDefinedDomains = testConnectListDefinedDomains, /* 0.1.11 */
|
||||
.connectNumOfDefinedDomains = testConnectNumOfDefinedDomains, /* 0.1.11 */
|
||||
|
Loading…
Reference in New Issue
Block a user