[lxc-devel] [lxc/master] c/r: check state before doing a checkpoint/restore
tych0 on Github
lxc-bot at linuxcontainers.org
Thu Nov 3 18:15:29 UTC 2016
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 457 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20161103/d573e5b8/attachment.bin>
-------------- next part --------------
From 7ad13c91236f5af2a57fd583ffbf3d39eb4b7bde Mon Sep 17 00:00:00 2001
From: Tycho Andersen <tycho.andersen at canonical.com>
Date: Thu, 3 Nov 2016 12:01:09 -0600
Subject: [PATCH] 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: Tycho Andersen <tycho.andersen at canonical.com>
---
src/lxc/lxccontainer.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c
index a1c94a1..3a9e1e3 100644
--- a/src/lxc/lxccontainer.c
+++ b/src/lxc/lxccontainer.c
@@ -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:
More information about the lxc-devel
mailing list