Skip to content
Browse files

Monitor thread fixes

* stop using flex_min and flex_max for scaler slaves: the default
values are fine. Set flex_target instead.

* format a path-indexed data structure for scaler slaves create

* fix the get_agg_services() saving a filtered version where it
is expected to save a full version
  • Loading branch information...
cvaroqui committed Jul 9, 2019
1 parent 4f009da commit 2e406cb2e618c7effaa2095a34d182e61d6683e8
Showing with 15 additions and 9 deletions.
  1. +15 −9 lib/
@@ -624,15 +624,19 @@ def service_set_flex_instances(self, path, instances):
def service_create_scaler_slave(self, path, svc, data, instances=None):
data["DEFAULT"]["scaler_slave"] = "true"
if svc.topology == "flex" and instances is not None:
data["DEFAULT"]["flex_min"] = instances
data["DEFAULT"]["flex_max"] = instances
data["DEFAULT"]["flex_target"] = instances
del data["metadata"]
except KeyError:
for kw in ("scale", "id"):
del data["DEFAULT"][kw]
except KeyError:
cmd = ["create", "--config=-"]
proc = self.service_command(path, cmd, stdin=json.dumps(data))
data = {path: data}
cmd = ["create", "--config=-", "--namespace=%s" % svc.namespace]
proc = self.service_command(None, cmd, stdin=json.dumps(data))
out, err = proc.communicate()
if proc.returncode != 0:
self.set_smon(path, "create failed")
@@ -936,7 +940,10 @@ def service_orchestrator(self, path, svc):
elif smon.status not in ORCHESTRATE_STATES:"service %s orchestrator out (mon status %s)", svc.path, smon.status)
status = shared.AGG[svc.path].avail
status = shared.AGG[svc.path].avail
except KeyError:
self.set_smon_g_expect_from_status(svc.path, smon, status)
if shared.NMON_DATA.status == "shutting":
self.service_orchestrator_shutting(svc, smon, status)
@@ -3430,9 +3437,8 @@ def get_all_paths(self):

def get_agg_services(self, paths=None):
data = {}
if paths is None:
paths = self.get_all_paths()
for path in paths:
all_paths = self.get_all_paths()
for path in all_paths:
if self.get_service(path).topology == "span":
data[path] = Storage()
@@ -3444,7 +3450,7 @@ def get_agg_services(self, paths=None):
with shared.AGG_LOCK:
shared.AGG = data
if paths is not None:
return dict((path, data[path]) for path in paths if path in paths)
return dict((path, data[path]) for path in paths if path in data)
return data

def update_completions(self):

0 comments on commit 2e406cb

Please sign in to comment.
You can’t perform that action at this time.