The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/5770
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) === Fixes #5761 Signed-off-by: Thomas Parrott <thomas.parr...@canonical.com>
From 71fe696be005e2e96363f46129ace145d60a7911 Mon Sep 17 00:00:00 2001 From: Thomas Parrott <thomas.parr...@canonical.com> Date: Fri, 17 May 2019 09:24:21 +0100 Subject: [PATCH] lxc/container: Fixes minute rollover issue in scheduled snapshots Fixes #5761 Signed-off-by: Thomas Parrott <thomas.parr...@canonical.com> --- lxd/container.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lxd/container.go b/lxd/container.go index 7295d06917..e935dde899 100644 --- a/lxd/container.go +++ b/lxd/container.go @@ -1635,10 +1635,18 @@ func autoCreateContainerSnapshotsTask(d *Daemon) (task.Func, task.Schedule) { // Check if it's time to snapshot now := time.Now() + + // Truncate the time now back to the start of the minute, before passing to + // the cron scheduler, as it will add 1s to the scheduled time and we don't + // want the next scheduled time to roll over to the next minute and break + // the time comparison below. + now = now.Truncate(time.Minute) + + // Calculate the next scheduled time based on the snapshots.schedule + // pattern and the time now. next := sched.Next(now) // Ignore everything that is more precise than minutes. - now = now.Truncate(time.Minute) next = next.Truncate(time.Minute) if !now.Equal(next) {
_______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel