[lxc-devel] [lxd/master] lxd: Fix snapshot expiry for scheduled snapshots
monstermunchkin on Github
lxc-bot at linuxcontainers.org
Mon Feb 11 08:34:59 UTC 2019
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 355 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20190211/e1471946/attachment.bin>
-------------- next part --------------
From 3b96180082594fbcdf9d66658b9ed31e00de972a Mon Sep 17 00:00:00 2001
From: Thomas Hipp <thomas.hipp at canonical.com>
Date: Mon, 11 Feb 2019 09:33:52 +0100
Subject: [PATCH] lxd: Fix snapshot expiry for scheduled snapshots
Signed-off-by: Thomas Hipp <thomas.hipp at canonical.com>
---
lxd/container.go | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/lxd/container.go b/lxd/container.go
index 066d959169..1a04aa1874 100644
--- a/lxd/container.go
+++ b/lxd/container.go
@@ -1635,6 +1635,12 @@ 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"])
+ if err != nil {
+ logger.Error("Error getting expiry date", log.Ctx{"err": err, "container": c})
+ return
+ }
+
args := db.ContainerArgs{
Architecture: c.Architecture(),
Config: c.LocalConfig(),
@@ -1645,6 +1651,7 @@ func autoCreateContainerSnapshots(ctx context.Context, d *Daemon, containers []c
Profiles: c.Profiles(),
Project: c.Project(),
Stateful: false,
+ ExpiryDate: expiry,
}
_, err = containerCreateAsSnapshot(d.State(), args, c)
More information about the lxc-devel
mailing list