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

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) ===
The user may not have actually started LXD or imported any containers, so
let's not fail in this case.

Launchpad #1602025

Signed-off-by: Tycho Andersen <tycho.ander...@canonical.com>
From c3c749cb78fe2c13a12dececdddd9eb7fd68aac0 Mon Sep 17 00:00:00 2001
From: Tycho Andersen <tycho.ander...@canonical.com>
Date: Tue, 12 Jul 2016 08:38:31 -0600
Subject: [PATCH] don't fail db upgrade if $LXD_DIR/containers doesn't exist

The user may not have actually started LXD or imported any containers, so
let's not fail in this case.

Launchpad #1602025

Signed-off-by: Tycho Andersen <tycho.ander...@canonical.com>
---
 lxd/db_update.go | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/lxd/db_update.go b/lxd/db_update.go
index db5c913..b3c6894 100644
--- a/lxd/db_update.go
+++ b/lxd/db_update.go
@@ -136,6 +136,13 @@ func dbUpdateFromV30(currentVersion int, version int, d 
*Daemon) error {
 
        entries, err := ioutil.ReadDir(shared.VarPath("containers"))
        if err != nil {
+               /* If the directory didn't exist before, the user had never
+                * started containers, so we don't need to fix up permissions
+                * on anything.
+                */
+               if os.IsNotExist(err) {
+                       return nil
+               }
                return err
        }
 
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to