On Thu, Aug 19, 2021 at 06:04:30PM +0800, Luke Yue wrote:
Signed-off-by: Luke Yue <lukedyue(a)gmail.com>
---
src/test/meson.build | 1 +
src/test/test_driver.c | 49 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 50 insertions(+)
diff --git a/src/test/meson.build b/src/test/meson.build
index f54585adfd..c0174ad856 100644
--- a/src/test/meson.build
+++ b/src/test/meson.build
@@ -17,6 +17,7 @@ if conf.has('WITH_TEST')
],
include_directories: [
conf_inc_dir,
+ hypervisor_inc_dir,
],
)
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 23176000b6..3aab8377c5 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -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,53 @@ 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 = 0;
+
Pointless line, but I can remove it before pushing.
Reviewed-by: Martin Kletzander <mkletzan(a)redhat.com>
+ ret = virDomainDriverSetupPersistentDefBlkioParams(def,
+ params,
+ nparams);
+
+ cleanup:
+ virDomainObjEndAPI(&vm);
+ return ret;
+}
+
+
static int
testDomainGetBlkioParameters(virDomainPtr dom,
virTypedParameterPtr params,
@@ -9568,6 +9616,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 */
--
2.33.0