lxccontainer: use cgroup_freeze() and cgroup_unfreeze()

parent 4639029c
...@@ -507,32 +507,41 @@ WRAP_API(bool, lxcapi_is_running) ...@@ -507,32 +507,41 @@ WRAP_API(bool, lxcapi_is_running)
static bool do_lxcapi_freeze(struct lxc_container *c) static bool do_lxcapi_freeze(struct lxc_container *c)
{ {
bool bret = true;
lxc_state_t s; lxc_state_t s;
if (!c || !c->lxc_conf) if (!c || !c->lxc_conf)
return false; return false;
s = lxc_getstate(c->name, c->config_path); s = lxc_getstate(c->name, c->config_path);
if (s != FROZEN) if (s != FROZEN) {
return lxc_freeze(c->lxc_conf, c->name, c->config_path) == 0; bret = cgroup_freeze(c->lxc_conf, c->name, c->config_path, -1);
if (!bret && errno == ENOCGROUP2)
bret = lxc_freeze(c->lxc_conf, c->name, c->config_path);
}
return true; return bret;
} }
WRAP_API(bool, lxcapi_freeze) WRAP_API(bool, lxcapi_freeze)
static bool do_lxcapi_unfreeze(struct lxc_container *c) static bool do_lxcapi_unfreeze(struct lxc_container *c)
{ {
bool bret = true;
lxc_state_t s; lxc_state_t s;
if (!c || !c->lxc_conf) if (!c || !c->lxc_conf)
return false; return false;
s = lxc_getstate(c->name, c->config_path); s = lxc_getstate(c->name, c->config_path);
if (s == FROZEN) if (s == FROZEN) {
return lxc_unfreeze(c->lxc_conf, c->name, c->config_path) == 0; bret = cgroup_unfreeze(c->lxc_conf, c->name, c->config_path, -1);
if (!bret && errno == ENOCGROUP2)
bret = lxc_unfreeze(c->lxc_conf, c->name, c->config_path);
}
return true;
return bret;
} }
WRAP_API(bool, lxcapi_unfreeze) WRAP_API(bool, lxcapi_unfreeze)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment