mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +00:00
vircgroup: introduce virCgroupValidatePlacement helper
Signed-off-by: Pavel Hrdina <phrdina@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
30f3516053
commit
20da059e18
@ -393,6 +393,23 @@ virCgroupDetectPlacement(virCgroupPtr group,
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
virCgroupValidatePlacement(virCgroupPtr group,
|
||||
pid_t pid)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < VIR_CGROUP_BACKEND_TYPE_LAST; i++) {
|
||||
if (group->backends[i] &&
|
||||
group->backends[i]->validatePlacement(group, pid) < 0) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
virCgroupDetect(virCgroupPtr group,
|
||||
pid_t pid,
|
||||
@ -430,12 +447,8 @@ virCgroupDetect(virCgroupPtr group,
|
||||
return -1;
|
||||
|
||||
/* Check that for every mounted controller, we found our placement */
|
||||
for (i = 0; i < VIR_CGROUP_BACKEND_TYPE_LAST; i++) {
|
||||
if (group->backends[i] &&
|
||||
group->backends[i]->validatePlacement(group, pid) < 0) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if (virCgroupValidatePlacement(group, pid) < 0)
|
||||
return -1;
|
||||
|
||||
for (i = 0; i < VIR_CGROUP_BACKEND_TYPE_LAST; i++) {
|
||||
if (group->backends[i]) {
|
||||
|
Loading…
Reference in New Issue
Block a user