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

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) ===
Now that we're dending on this file to exist in all cases when execing,
let's always write it.

Signed-off-by: Tycho Andersen <tycho.ander...@canonical.com>
From 068313ad07d8971cd148a345463310227fcdad39 Mon Sep 17 00:00:00 2001
From: Tycho Andersen <tycho.ander...@canonical.com>
Date: Thu, 14 Apr 2016 15:10:54 -0600
Subject: [PATCH] write the container's config file on start to the log path
 directly

Now that we're dending on this file to exist in all cases when execing,
let's always write it.

Signed-off-by: Tycho Andersen <tycho.ander...@canonical.com>
---
 lxd/container_lxc.go | 14 +-------------
 lxd/containers.go    |  3 ---
 2 files changed, 1 insertion(+), 16 deletions(-)

diff --git a/lxd/container_lxc.go b/lxd/container_lxc.go
index e5adcfc..4cd1524 100644
--- a/lxd/container_lxc.go
+++ b/lxd/container_lxc.go
@@ -1084,19 +1084,7 @@ func (c *containerLXC) startCommon() (string, error) {
        }
 
        // Generate the LXC config
-       f, err := ioutil.TempFile("", "lxd_lxc_startconfig_")
-       if err != nil {
-               return "", err
-       }
-
-       configPath := f.Name()
-       if err = f.Chmod(0600); err != nil {
-               f.Close()
-               os.Remove(configPath)
-               return "", err
-       }
-       f.Close()
-
+       configPath := filepath.Join(c.LogPath(), "lxc.conf")
        err = c.c.SaveConfigFile(configPath)
        if err != nil {
                os.Remove(configPath)
diff --git a/lxd/containers.go b/lxd/containers.go
index 4231399..b125768 100644
--- a/lxd/containers.go
+++ b/lxd/containers.go
@@ -240,9 +240,6 @@ func startContainer(args []string) error {
                syscall.Dup3(int(logFile.Fd()), 2, 0)
        }
 
-       // Move the config so we can inspect it on failure
-       shared.FileMove(configPath, shared.LogPath(name, "lxc.conf"))
-
        return c.Start()
 }
 
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to