Skip to content

Commit

Permalink
criu: handle new cgroup layout
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
  • Loading branch information
Christian Brauner committed Feb 10, 2021
1 parent b41a802 commit d9fc9be
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/lxc/criu.c
Expand Up @@ -887,6 +887,7 @@ static void do_restore(struct lxc_container *c, int status_pipe, struct migrate_
struct lxc_handler *handler;
int status = 0;
int pipes[2] = {-1, -1};
struct cgroup_ops *cgroup_ops;

/* Try to detach from the current controlling tty if it exists.
* Otherwise, lxc_init (via lxc_console) will attach the container's
Expand All @@ -907,9 +908,25 @@ static void do_restore(struct lxc_container *c, int status_pipe, struct migrate_

if (lxc_init(c->name, handler) < 0)
goto out;
cgroup_ops = handler->cgroup_ops;

if (!handler->cgroup_ops->payload_create(handler->cgroup_ops, handler)) {
ERROR("failed creating groups");
if (!cgroup_ops->monitor_create(cgroup_ops, handler)) {
ERROR("Failed to create monitor cgroup");
goto out_fini_handler;
}

if (!cgroup_ops->monitor_enter(cgroup_ops, handler)) {
ERROR("Failed to enter monitor cgroup");
goto out_fini_handler;
}

if (!cgroup_ops->monitor_delegate_controllers(cgroup_ops)) {
ERROR("Failed to delegate controllers to monitor cgroup");
goto out_fini_handler;
}

if (!cgroup_ops->payload_create(cgroup_ops, handler)) {
ERROR("Failed creating cgroups");
goto out_fini_handler;
}

Expand Down

0 comments on commit d9fc9be

Please sign in to comment.