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

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 a bug where changing the auto-update images interval with
the API would not take effect unless the daemon is restarted.

See also the comments to:

https://github.com/stgraber/lxd/commit/28e7d344175097877af7747fd5f2926e9965b17

Signed-off-by: Free Ekanayaka <[email protected]>
From d9a463628cc226bcdec5c482951574bb248588a1 Mon Sep 17 00:00:00 2001
From: Free Ekanayaka <[email protected]>
Date: Mon, 4 Sep 2017 12:18:41 +0000
Subject: [PATCH] Reset the images auto-update loop when configuration changes

This fixes a bug where changing the auto-update images interval with
the API would not take effect unless the daemon is restarted.

See also the comments to:

https://github.com/stgraber/lxd/commit/28e7d344175097877af7747fd5f2926e9965b17

Signed-off-by: Free Ekanayaka <[email protected]>
---
 lxd/daemon_config.go | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lxd/daemon_config.go b/lxd/daemon_config.go
index b41f6a405..c74214e50 100644
--- a/lxd/daemon_config.go
+++ b/lxd/daemon_config.go
@@ -186,7 +186,7 @@ func daemonConfigInit(db *sql.DB) error {
                "core.trust_password":            {valueType: "string", 
hiddenValue: true, setter: daemonConfigSetPassword},
 
                "images.auto_update_cached":    {valueType: "bool", 
defaultValue: "true"},
-               "images.auto_update_interval":  {valueType: "int", 
defaultValue: "6"},
+               "images.auto_update_interval":  {valueType: "int", 
defaultValue: "6", trigger: daemonConfigTriggerAutoUpdateInterval},
                "images.compression_algorithm": {valueType: "string", 
validator: daemonConfigValidateCompression, defaultValue: "gzip"},
                "images.remote_cache_expiry":   {valueType: "int", 
defaultValue: "10", trigger: daemonConfigTriggerExpiry},
 
@@ -306,6 +306,11 @@ func daemonConfigTriggerExpiry(d *Daemon, key string, 
value string) {
        d.pruneChan <- true
 }
 
+func daemonConfigTriggerAutoUpdateInterval(d *Daemon, key string, value 
string) {
+       // Reset the auto-update interval loop
+       d.resetAutoUpdateChan <- true
+}
+
 func daemonConfigValidateCompression(d *Daemon, key string, value string) 
error {
        if value == "none" {
                return nil
_______________________________________________
lxc-devel mailing list
[email protected]
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to