fix: service config changes not effective

This commit is contained in:
Qiu Jian
2020-04-06 15:43:29 +08:00
parent 1f1e6240f9
commit adeda57082
8 changed files with 34 additions and 19 deletions
+3 -2
View File
@@ -40,9 +40,10 @@ func OnOptionsChange(oldO, newO interface{}) bool {
oldOpts := oldO.(*GatewayOptions)
newOpts := newO.(*GatewayOptions)
changed := false
if common_options.OnCommonOptionsChange(&oldOpts.CommonOptions, &newOpts.CommonOptions) {
return true
changed = true
}
return false
return changed
}
+3
View File
@@ -16,6 +16,8 @@ package consts
import (
"time"
"yunion.io/x/log"
)
var (
@@ -60,6 +62,7 @@ func GetTenantCacheExpireSeconds() time.Duration {
}
func SetNonDefaultDomainProjects(val bool) {
log.Infof("set non_default_domain_projects to %v", val)
nonDefaultDomainProjects = val
}
+11 -6
View File
@@ -22,30 +22,35 @@ func OnBaseOptionsChange(oOpts, nOpts interface{}) bool {
oldOpts := oOpts.(*BaseOptions)
newOpts := nOpts.(*BaseOptions)
changed := false
if oldOpts.RequestWorkerCount != newOpts.RequestWorkerCount {
return true
changed = true
}
if oldOpts.TimeZone != newOpts.TimeZone {
return true
changed = true
}
if oldOpts.EnableRbac != newOpts.EnableRbac {
return true
changed = true
}
if oldOpts.NonDefaultDomainProjects != newOpts.NonDefaultDomainProjects {
consts.SetNonDefaultDomainProjects(newOpts.NonDefaultDomainProjects)
changed = true
}
if oldOpts.DomainizedNamespace != newOpts.DomainizedNamespace {
consts.SetDomainizedNamespace(newOpts.DomainizedNamespace)
changed = true
}
return false
return changed
}
func OnCommonOptionsChange(oOpts, nOpts interface{}) bool {
oldOpts := oOpts.(*CommonOptions)
newOpts := nOpts.(*CommonOptions)
changed := false
if OnBaseOptionsChange(&oldOpts.BaseOptions, &newOpts.BaseOptions) {
return true
changed = true
}
return false
return changed
}
+3 -2
View File
@@ -158,8 +158,9 @@ func OnOptionsChange(oldO, newO interface{}) bool {
oldOpts := oldO.(*ComputeOptions)
newOpts := newO.(*ComputeOptions)
changed := false
if common_options.OnCommonOptionsChange(&oldOpts.CommonOptions, &newOpts.CommonOptions) {
return true
changed = true
}
return false
return changed
}
+3 -2
View File
@@ -51,9 +51,10 @@ func OnOptionsChange(oldO, newO interface{}) bool {
oldOpts := oldO.(*SImageOptions)
newOpts := newO.(*SImageOptions)
changed := false
if common_options.OnCommonOptionsChange(&oldOpts.CommonOptions, &newOpts.CommonOptions) {
return true
changed = true
}
return false
return changed
}
+3 -2
View File
@@ -59,9 +59,10 @@ func OnOptionsChange(oldOptions, newOptions interface{}) bool {
oldOpts := oldOptions.(*SKeystoneOptions)
newOpts := newOptions.(*SKeystoneOptions)
changed := false
if options.OnBaseOptionsChange(&oldOpts.BaseOptions, &newOpts.BaseOptions) {
return true
changed = true
}
return false
return changed
}
+5 -3
View File
@@ -41,13 +41,15 @@ func OnOptionsChange(oldO, newO interface{}) bool {
oldOpts := oldO.(*NotifyOption)
newOpts := newO.(*NotifyOption)
changed := false
if common_options.OnCommonOptionsChange(&oldOpts.CommonOptions, &newOpts.CommonOptions) {
return true
changed = true
}
if oldOpts.SocketFileDir != newOpts.SocketFileDir {
return true
changed = true
}
return false
return changed
}
+3 -2
View File
@@ -36,9 +36,10 @@ func OnOptionsChange(oldO, newO interface{}) bool {
oldOpts := oldO.(*WebConsoleOptions)
newOpts := newO.(*WebConsoleOptions)
changed := false
if common_options.OnCommonOptionsChange(&oldOpts.CommonOptions, &newOpts.CommonOptions) {
return true
changed = true
}
return false
return changed
}