Commit 7ad13c91 by Tycho Andersen

c/r: check state before doing a checkpoint/restore

This would already fail, but with a not-as-good error message. Let's make the error better. Signed-off-by: 's avatarTycho Andersen <tycho.andersen@canonical.com>
parent 293eeeac
...@@ -3994,12 +3994,24 @@ static int do_lxcapi_migrate(struct lxc_container *c, unsigned int cmd, ...@@ -3994,12 +3994,24 @@ static int do_lxcapi_migrate(struct lxc_container *c, unsigned int cmd,
switch (cmd) { switch (cmd) {
case MIGRATE_PRE_DUMP: case MIGRATE_PRE_DUMP:
if (!do_lxcapi_is_running(c)) {
ERROR("container is not running");
return false;
}
ret = !__criu_pre_dump(c, valid_opts); ret = !__criu_pre_dump(c, valid_opts);
break; break;
case MIGRATE_DUMP: case MIGRATE_DUMP:
if (!do_lxcapi_is_running(c)) {
ERROR("container is not running");
return false;
}
ret = !__criu_dump(c, valid_opts); ret = !__criu_dump(c, valid_opts);
break; break;
case MIGRATE_RESTORE: case MIGRATE_RESTORE:
if (do_lxcapi_is_running(c)) {
ERROR("container is already running");
return false;
}
ret = !__criu_restore(c, valid_opts); ret = !__criu_restore(c, valid_opts);
break; break;
default: default:
......
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