Unverified Commit f87c3a22 by Christian Brauner Committed by GitHub

Merge pull request #2802 from Rachid-Koucha/patch-3

Avoid double lxc-freeze/unfreeze
parents 81f22990 2341916a
...@@ -525,13 +525,17 @@ WRAP_API(bool, lxcapi_is_running) ...@@ -525,13 +525,17 @@ WRAP_API(bool, lxcapi_is_running)
static bool do_lxcapi_freeze(struct lxc_container *c) static bool do_lxcapi_freeze(struct lxc_container *c)
{ {
int ret; int ret;
lxc_state_t s;
if (!c) if (!c)
return false; return false;
ret = lxc_freeze(c->lxc_conf, c->name, c->config_path); s = lxc_getstate(c->name, c->config_path);
if (ret < 0) if (s != FROZEN) {
return false; ret = lxc_freeze(c->lxc_conf, c->name, c->config_path);
if (ret < 0)
return false;
}
return true; return true;
} }
...@@ -541,13 +545,17 @@ WRAP_API(bool, lxcapi_freeze) ...@@ -541,13 +545,17 @@ WRAP_API(bool, lxcapi_freeze)
static bool do_lxcapi_unfreeze(struct lxc_container *c) static bool do_lxcapi_unfreeze(struct lxc_container *c)
{ {
int ret; int ret;
lxc_state_t s;
if (!c) if (!c)
return false; return false;
ret = lxc_unfreeze(c->lxc_conf, c->name, c->config_path); s = lxc_getstate(c->name, c->config_path);
if (ret < 0) if (s == FROZEN) {
return false; ret = lxc_unfreeze(c->lxc_conf, c->name, c->config_path);
if (ret < 0)
return false;
}
return true; return true;
} }
......
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