return rc;
}
-static int virCgroupAppRoot(bool privileged,
- virCgroupPtr *group,
+static int virCgroupAppRoot(virCgroupPtr *group,
bool create,
int controllers)
{
if (rc != 0)
return rc;
- if (privileged) {
- rc = virCgroupNew("libvirt", selfgrp, controllers, group);
- } else {
- char *rootname;
- char *username;
- username = virGetUserName(getuid());
- if (!username) {
- rc = -ENOMEM;
- goto cleanup;
- }
- rc = virAsprintf(&rootname, "libvirt-%s", username);
- VIR_FREE(username);
- if (rc < 0) {
- rc = -ENOMEM;
- goto cleanup;
- }
-
- rc = virCgroupNew(rootname, selfgrp, controllers, group);
- VIR_FREE(rootname);
- }
+ rc = virCgroupNew("libvirt", selfgrp, controllers, group);
if (rc != 0)
goto cleanup;
*/
#if defined HAVE_MNTENT_H && defined HAVE_GETMNTENT_R
int virCgroupNewDriver(const char *name,
- bool privileged,
bool create,
int controllers,
virCgroupPtr *group)
int rc;
virCgroupPtr rootgrp = NULL;
- rc = virCgroupAppRoot(privileged, &rootgrp,
+ rc = virCgroupAppRoot(&rootgrp,
create, controllers);
if (rc != 0)
goto out;
}
#else
int virCgroupNewDriver(const char *name ATTRIBUTE_UNUSED,
- bool privileged ATTRIBUTE_UNUSED,
bool create ATTRIBUTE_UNUSED,
int controllers ATTRIBUTE_UNUSED,
virCgroupPtr *group ATTRIBUTE_UNUSED)
[VIR_CGROUP_CONTROLLER_BLKIO] = "/libvirt/lxc",
};
- if ((rv = virCgroupNewDriver("lxc", true, false, -1, &cgroup)) != -ENOENT) {
+ if ((rv = virCgroupNewDriver("lxc", false, -1, &cgroup)) != -ENOENT) {
fprintf(stderr, "Unexpected found LXC cgroup: %d\n", -rv);
goto cleanup;
}
/* Asking for impossible combination since CPU is co-mounted */
- if ((rv = virCgroupNewDriver("lxc", true, true,
+ if ((rv = virCgroupNewDriver("lxc", true,
(1 << VIR_CGROUP_CONTROLLER_CPU),
&cgroup)) != -EINVAL) {
fprintf(stderr, "Should not have created LXC cgroup: %d\n", -rv);
}
/* Asking for impossible combination since devices is not mounted */
- if ((rv = virCgroupNewDriver("lxc", true, true,
+ if ((rv = virCgroupNewDriver("lxc", true,
(1 << VIR_CGROUP_CONTROLLER_DEVICES),
&cgroup)) != -ENOENT) {
fprintf(stderr, "Should not have created LXC cgroup: %d\n", -rv);
}
/* Asking for small combination since devices is not mounted */
- if ((rv = virCgroupNewDriver("lxc", true, true,
+ if ((rv = virCgroupNewDriver("lxc", true,
(1 << VIR_CGROUP_CONTROLLER_CPU) |
(1 << VIR_CGROUP_CONTROLLER_CPUACCT) |
(1 << VIR_CGROUP_CONTROLLER_MEMORY),
ret = validateCgroup(cgroup, "libvirt/lxc", mountsSmall, placementSmall);
virCgroupFree(&cgroup);
- if ((rv = virCgroupNewDriver("lxc", true, true, -1, &cgroup)) != 0) {
+ if ((rv = virCgroupNewDriver("lxc", true, -1, &cgroup)) != 0) {
fprintf(stderr, "Cannot create LXC cgroup: %d\n", -rv);
goto cleanup;
}
[VIR_CGROUP_CONTROLLER_BLKIO] = "/libvirt/lxc/wibble",
};
- if ((rv = virCgroupNewDriver("lxc", true, false, -1, &drivercgroup)) != 0) {
+ if ((rv = virCgroupNewDriver("lxc", false, -1, &drivercgroup)) != 0) {
fprintf(stderr, "Cannot find LXC cgroup: %d\n", -rv);
goto cleanup;
}