[lxc-devel] [lxd/master] Return an error on "restart" without force of a paused container

stgraber on Github lxc-bot at linuxcontainers.org
Wed Aug 24 16:15:39 UTC 2016


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 370 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20160824/0fa2e6e7/attachment.bin>
-------------- next part --------------
From a7a344b5258fbae25db143a569184049a286f407 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Wed, 24 Aug 2016 12:15:02 -0400
Subject: [PATCH] Return an error on "restart" without force of a paused
 container
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Closes #2311

Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 lxd/container_state.go | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lxd/container_state.go b/lxd/container_state.go
index fb0f815..2b73320 100644
--- a/lxd/container_state.go
+++ b/lxd/container_state.go
@@ -115,11 +115,16 @@ func containerStatePut(d *Daemon, r *http.Request) Response {
 					return err
 				}
 			} else {
+				if c.IsFrozen() {
+					return fmt.Errorf("container is not running")
+				}
+
 				err = c.Shutdown(time.Duration(raw.Timeout) * time.Second)
 				if err != nil {
 					return err
 				}
 			}
+
 			err = c.Start(false)
 			if err != nil {
 				return err


More information about the lxc-devel mailing list