The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/1777

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
We deleted the snapshot contents on failure, but not the db state. Let's do
that too.

Signed-off-by: Tycho Andersen <tycho.ander...@canonical.com>
From 32bd1c02186cba9227851394a5b65671618ef73e Mon Sep 17 00:00:00 2001
From: Tycho Andersen <tycho.ander...@canonical.com>
Date: Fri, 18 Mar 2016 13:38:04 -0600
Subject: [PATCH] stateful stop: remove snapshot from db on failure too

We deleted the snapshot contents on failure, but not the db state. Let's do
that too.

Signed-off-by: Tycho Andersen <tycho.ander...@canonical.com>
---
 lxd/container_lxc.go | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/lxd/container_lxc.go b/lxd/container_lxc.go
index f6e80b7..c2b1f05 100644
--- a/lxd/container_lxc.go
+++ b/lxd/container_lxc.go
@@ -1101,22 +1101,24 @@ func (c *containerLXC) Start(stateful bool) error {
                        return fmt.Errorf("Container has no existing state to 
restore.")
                }
 
+
                err := c.c.Restore(lxc.RestoreOptions{
                        Directory: c.StatePath(),
                        Verbose:   true,
                })
 
                err2 := os.RemoveAll(c.StatePath())
-               if err2 != nil {
-                       return err2
+
+               c.stateful = false
+               err3 := dbContainerSetStateful(c.daemon.db, c.id, false)
+               if err3 != nil {
+                       return err3
                }
 
-               if err != nil {
-                       return err
+               if err2 != nil {
+                       return err2
                }
 
-               c.stateful = false
-               err = dbContainerSetStateful(c.daemon.db, c.id, false)
                if err != nil {
                        return err
                }
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to