mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-02 01:45:17 +00:00
vircgroup: introduce virCgroupV2Remove
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
parent
89f52abd07
commit
4fe4847438
@ -412,6 +412,25 @@ virCgroupV2MakeGroup(virCgroupPtr parent ATTRIBUTE_UNUSED,
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
virCgroupV2Remove(virCgroupPtr group)
|
||||
{
|
||||
VIR_AUTOFREE(char *) grppath = NULL;
|
||||
int controller;
|
||||
|
||||
/* Don't delete the root group, if we accidentally
|
||||
ended up in it for some reason */
|
||||
if (STREQ(group->unified.placement, "/"))
|
||||
return 0;
|
||||
|
||||
controller = virCgroupV2GetAnyController(group);
|
||||
if (virCgroupV2PathOfController(group, controller, "", &grppath) < 0)
|
||||
return 0;
|
||||
|
||||
return virCgroupRemoveRecursively(grppath);
|
||||
}
|
||||
|
||||
|
||||
virCgroupBackend virCgroupV2Backend = {
|
||||
.type = VIR_CGROUP_BACKEND_TYPE_V2,
|
||||
|
||||
@ -428,6 +447,7 @@ virCgroupBackend virCgroupV2Backend = {
|
||||
.getAnyController = virCgroupV2GetAnyController,
|
||||
.pathOfController = virCgroupV2PathOfController,
|
||||
.makeGroup = virCgroupV2MakeGroup,
|
||||
.remove = virCgroupV2Remove,
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user