Skip to content

Commit

Permalink
c/r: check state before doing a checkpoint/restore
Browse files Browse the repository at this point in the history
This would already fail, but with a not-as-good error message. Let's make
the error better.

Signed-off-by: Tycho Andersen <tycho.andersen@canonical.com>
  • Loading branch information
Tycho Andersen authored and stgraber committed Nov 17, 2016
1 parent 87a06d9 commit 5048aba
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/lxc/lxccontainer.c
Expand Up @@ -3994,12 +3994,24 @@ static int do_lxcapi_migrate(struct lxc_container *c, unsigned int cmd,

switch (cmd) {
case MIGRATE_PRE_DUMP:
if (!do_lxcapi_is_running(c)) {
ERROR("container is not running");
return false;
}
ret = !__criu_pre_dump(c, valid_opts);
break;
case MIGRATE_DUMP:
if (!do_lxcapi_is_running(c)) {
ERROR("container is not running");
return false;
}
ret = !__criu_dump(c, valid_opts);
break;
case MIGRATE_RESTORE:
if (do_lxcapi_is_running(c)) {
ERROR("container is already running");
return false;
}
ret = !__criu_restore(c, valid_opts);
break;
default:
Expand Down

0 comments on commit 5048aba

Please sign in to comment.