Skip to content

Commit

Permalink
Encap enhancements
Browse files Browse the repository at this point in the history
* merge the encap instances overall status with the master
instance, so encap alerts propagate up to the service level

* display encap instances notices in the print status output

Example:

centoslxc                             up         warn
`- instances
   `- rhel71.opensvc.com              up         warn, frozen, idle, started
      `- container#0           ..../. up         centoslxc
         |                                       warn, frozen, idle, started
         |- ip#1               ...E.. up         centoslxc@eth0
         `- app#0              ...E/. down       false
  • Loading branch information
cvaroqui committed Oct 26, 2017
1 parent ab94d7a commit 42fc978
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions lib/svc.py
Expand Up @@ -1409,9 +1409,9 @@ def print_status_data_eval(self, refresh=False):
continue
try:
data['encap'][container.rid] = self.encap_json_status(container, refresh=refresh)
# merge container group status
for group in ("ip", "disk", "fs", "share", "container", "app", "sync", "avail", "overall"):
group_status[group] += rcStatus.Status(data["encap"][container.rid][group] if group in data["encap"][container.rid] else "n/a")
# merge container overall status, so we propagate encap alerts
# up to instance and service level.
group_status["overall"] += rcStatus.Status(data["encap"][container.rid]["overall"] if "overall" in data["encap"][container.rid] else "n/a")
except:
data["encap"][container.rid] = {"resources": {}}
if hasattr(container, "vm_hostname"):
Expand Down Expand Up @@ -1723,8 +1723,16 @@ def add_res_node(resource, parent, rid=None):
node_res.add_column(resource["status"],
STATUS_COLOR[resource["status"]])
col = node_res.add_column(resource["label"])
if rid in ers and data["encap"].get(rid).get("frozen"):
col.add_text(colorize("frozen", color.BLUE))
if rid in ers:
edata = Storage(data["encap"].get(rid))
encap_notice = instance_notice(
overall=edata.overall,
frozen=edata.frozen,
constraints=edata.constraints,
provisioned=edata.provisioned,
monitor=edata.monitor,
)
col.add_text(encap_notice, color.LIGHTBLUE)
for line in resource["log"].split("\n"):
if line.startswith("warn:"):
scolor = STATUS_COLOR["warn"]
Expand Down

0 comments on commit 42fc978

Please sign in to comment.