[lxc-devel] [lxd/master] Add missing refresh code for instance types

stgraber on Github lxc-bot at linuxcontainers.org
Fri Jul 28 02:36:21 UTC 2017


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 480 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170728/2d20a94f/attachment.bin>
-------------- next part --------------
From 3fbce7a73bc47085e3655f4a80551aa6e8b297f5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Thu, 27 Jul 2017 22:35:35 -0400
Subject: [PATCH] Add missing refresh code for instance types
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Since cloud instance type definitions change pretty regularly (new ones
added), lets try to refresh our cache once a day.

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

diff --git a/lxd/daemon.go b/lxd/daemon.go
index ba7156fef..0e5c3e306 100644
--- a/lxd/daemon.go
+++ b/lxd/daemon.go
@@ -1108,7 +1108,13 @@ func (d *Daemon) Ready() error {
 	}()
 
 	/* Auto-update instance types */
-	go instanceRefreshTypes(d)
+	go func() {
+		// Background update
+		for {
+			instanceRefreshTypes(d)
+			time.Sleep(24 * time.Hour)
+		}
+	}()
 
 	/* Restore containers */
 	containersRestart(d)


More information about the lxc-devel mailing list