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

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) ===
This fixes the expiry check for instances. Like with backups, it checks
the unix timestamp instead of `IsZero()` as zero time has caused issues
in the past due to timezones.

Signed-off-by: Thomas Hipp <thomas.h...@canonical.com>
From a473c9ef2adf6aba315ff646de4820e236472baa Mon Sep 17 00:00:00 2001
From: Thomas Hipp <thomas.h...@canonical.com>
Date: Fri, 13 Mar 2020 17:17:14 +0100
Subject: [PATCH] lxd/instance: Fix expiry check

This fixes the expiry check for instances. Like with backups, it checks
the unix timestamp instead of `IsZero()` as zero time has caused issues
in the past due to timezones.

Signed-off-by: Thomas Hipp <thomas.h...@canonical.com>
---
 lxd/instance.go | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lxd/instance.go b/lxd/instance.go
index 00a8c77abf..85a02f2eb3 100644
--- a/lxd/instance.go
+++ b/lxd/instance.go
@@ -883,7 +883,9 @@ func pruneExpiredContainerSnapshotsTask(d *Daemon) 
(task.Func, task.Schedule) {
                        }
 
                        for _, snapshot := range snapshots {
-                               if snapshot.ExpiryDate().IsZero() {
+                               // Since zero time causes some issues due to 
timezones, we check the
+                               // unix timestamp instead of IsZero().
+                               if snapshot.ExpiryDate().Unix() <= 0 {
                                        // Snapshot doesn't expire
                                        continue
                                }
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to