From 9aa8226d866f7a274179bfe900d441cbd2f5ae12 Mon Sep 17 00:00:00 2001 From: Pavel Hrdina Date: Tue, 18 Sep 2018 09:17:24 +0200 Subject: [PATCH] vircgroup: introduce virCgroupV2ValidatePlacement Signed-off-by: Pavel Hrdina --- src/util/vircgroupv2.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c index 84c29cac5a..c8f8e99e41 100644 --- a/src/util/vircgroupv2.c +++ b/src/util/vircgroupv2.c @@ -205,6 +205,20 @@ virCgroupV2DetectPlacement(virCgroupPtr group, } +static int +virCgroupV2ValidatePlacement(virCgroupPtr group, + pid_t pid ATTRIBUTE_UNUSED) +{ + if (!group->unified.placement) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not find placement for v2 controller")); + return -1; + } + + return 0; +} + + virCgroupBackend virCgroupV2Backend = { .type = VIR_CGROUP_BACKEND_TYPE_V2, @@ -214,6 +228,7 @@ virCgroupBackend virCgroupV2Backend = { .copyPlacement = virCgroupV2CopyPlacement, .detectMounts = virCgroupV2DetectMounts, .detectPlacement = virCgroupV2DetectPlacement, + .validatePlacement = virCgroupV2ValidatePlacement, }; -- 2.47.2