[lxc-devel] [lxd/master] lxd/containers: Fix profile snapshot settings

stgraber on Github lxc-bot at linuxcontainers.org
Mon Apr 29 20:13:59 UTC 2019


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 354 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20190429/e1f4524c/attachment.bin>
-------------- next part --------------
From 687cb53c88a78f1d2f3e6f7068d65e9cd68f8c46 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Mon, 29 Apr 2019 15:12:33 -0400
Subject: [PATCH] lxd/containers: Fix profile snapshot settings
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

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

diff --git a/lxd/container.go b/lxd/container.go
index 7346011e15..24da0f924d 100644
--- a/lxd/container.go
+++ b/lxd/container.go
@@ -1606,7 +1606,7 @@ func autoCreateContainerSnapshotsTask(d *Daemon) (task.Func, task.Schedule) {
 		// Figure out which need snapshotting (if any)
 		containers := []container{}
 		for _, c := range allContainers {
-			schedule := c.LocalConfig()["snapshots.schedule"]
+			schedule := c.ExpandedConfig()["snapshots.schedule"]
 
 			if schedule == "" {
 				continue
@@ -1631,7 +1631,7 @@ func autoCreateContainerSnapshotsTask(d *Daemon) (task.Func, task.Schedule) {
 			}
 
 			// Check if the container is running
-			if !shared.IsTrue(c.LocalConfig()["snapshots.schedule.stopped"]) && !c.IsRunning() {
+			if !shared.IsTrue(c.ExpandedConfig()["snapshots.schedule.stopped"]) && !c.IsRunning() {
 				continue
 			}
 
@@ -1691,7 +1691,7 @@ func autoCreateContainerSnapshots(ctx context.Context, d *Daemon, containers []c
 
 			snapshotName = fmt.Sprintf("%s%s%s", c.Name(), shared.SnapshotDelimiter, snapshotName)
 
-			expiry, err := shared.GetSnapshotExpiry(time.Now(), c.LocalConfig()["snapshots.expiry"])
+			expiry, err := shared.GetSnapshotExpiry(time.Now(), c.ExpandedConfig()["snapshots.expiry"])
 			if err != nil {
 				logger.Error("Error getting expiry date", log.Ctx{"err": err, "container": c})
 				ch <- nil
@@ -1812,7 +1812,7 @@ func pruneExpiredContainerSnapshots(ctx context.Context, d *Daemon, snapshots []
 func containerDetermineNextSnapshotName(d *Daemon, c container, defaultPattern string) (string, error) {
 	var err error
 
-	pattern := c.LocalConfig()["snapshots.pattern"]
+	pattern := c.ExpandedConfig()["snapshots.pattern"]
 	if pattern == "" {
 		pattern = defaultPattern
 	}


More information about the lxc-devel mailing list