[lxc-devel] [lxd/master] Invalidate the simplestreams cache on proxy change
stgraber on Github
lxc-bot at linuxcontainers.org
Wed Apr 13 22:53:41 UTC 2016
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 425 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20160413/bec40389/attachment.bin>
-------------- next part --------------
From 0083e9ad28c8b79e07a2d18d106e4c1de8849332 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Wed, 13 Apr 2016 18:53:08 -0400
Subject: [PATCH] Invalidate the simplestreams cache on proxy change
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This is needed to make a proxy config change immediately effective.
Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
lxd/api_1.0.go | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/lxd/api_1.0.go b/lxd/api_1.0.go
index ba653db..db3a8fb 100644
--- a/lxd/api_1.0.go
+++ b/lxd/api_1.0.go
@@ -240,7 +240,16 @@ func api10Put(d *Daemon, r *http.Request) Response {
return InternalError(err)
}
+ // Update the cached proxy function
d.updateProxy()
+
+ // Clear the simplestreams cache as it's tied to the old proxy config
+ imageStreamCacheLock.Lock()
+ for k, _ := range imageStreamCache {
+ delete(imageStreamCache, k)
+ }
+ imageStreamCacheLock.Unlock()
+
} else {
err := d.ConfigValueSet(key, value.(string))
if err != nil {
More information about the lxc-devel
mailing list