From: Chen Hanxiao <chenhanxiao(a)gmail.com>
Use macro virCheckControllerGoto
to simplify cgroup controller check codes.
Signed-off-by: Chen Hanxiao <chenhanxiao(a)gmail.com>
---
src/qemu/qemu_process.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 1b67aee..4033de0 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -2330,12 +2330,9 @@ qemuProcessSetupPid(virDomainObjPtr vm,
char *mem_mask = NULL;
int ret = -1;
- if ((period || quota) &&
- !virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_CPU)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("cgroup cpu is required for scheduler tuning"));
- goto cleanup;
- }
+ if (period || quota)
+ virCheckControllerGoto(priv->cgroup,
+ VIR_CGROUP_CONTROLLER_CPU, cleanup);
/* Infer which cpumask shall be used. */
if (cpumask)
--
1.8.3.1