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

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) ===
So far we've been using the go-lxc SetLogFile() function. The problem is that
the go-lxc shared library might have been linked against an older liblxc than
LXD. In that case SetLogFile() will check:

if VersionAtLeast(2, 1, 0) {
        err = c.setConfigItem("lxc.log.file", filename)
} else {
        err = c.setConfigItem("lxc.logfile", filename)
}

but VersionAtLeast() will not check the runtime but the linked liblxc version
and thus set the wrong config item.
Fix this by using lxcSetConfigItem() which will check against the runtime
liblxc version.

Closes #4713.

Signed-off-by: Christian Brauner <[email protected]>
From 0011d2b5d05797b91df6d302c53f3a80f82364f0 Mon Sep 17 00:00:00 2001
From: Christian Brauner <[email protected]>
Date: Mon, 2 Jul 2018 14:55:51 +0200
Subject: [PATCH] container: use lxcSetConfigItem() for lxc.log.file

So far we've been using the go-lxc SetLogFile() function. The problem is that
the go-lxc shared library might have been linked against an older liblxc than
LXD. In that case SetLogFile() will check:

if VersionAtLeast(2, 1, 0) {
        err = c.setConfigItem("lxc.log.file", filename)
} else {
        err = c.setConfigItem("lxc.logfile", filename)
}

but VersionAtLeast() will not check the runtime but the linked liblxc version
and thus set the wrong config item.
Fix this by using lxcSetConfigItem() which will check against the runtime
liblxc version.

Closes #4713.

Signed-off-by: Christian Brauner <[email protected]>
---
 lxd/container_lxc.go | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lxd/container_lxc.go b/lxd/container_lxc.go
index f5c4db983..77b53cb36 100644
--- a/lxd/container_lxc.go
+++ b/lxd/container_lxc.go
@@ -909,8 +909,7 @@ func (c *containerLXC) initLXC(config bool) error {
 
        // Setup logging
        logfile := c.LogFilePath()
-
-       err = cc.SetLogFile(logfile)
+       err = lxcSetConfigItem(cc, "lxc.log.file", logfile)
        if err != nil {
                return err
        }
_______________________________________________
lxc-devel mailing list
[email protected]
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to