Commit ce5c226f authored by Daniele Venzano's avatar Daniele Venzano

Record in use memory, not free

parent 4bf272be
......@@ -139,7 +139,7 @@
data = {
datasets: [{
label: 'Used memory',
data: [{{ node['memory_total'] - node['memory_free'] }}, {{ node['memory_free'] }}],
data: [{{ node['memory_in_use'] }}, {{ node['memory_total'] - node['memory_in_use'] }}],
backgroundColor: ['rgba(0, 169, 225, 1.0)', 'rgba(145, 192, 46, 1.0)']
}],
'labels': ['In-use', 'Free']
......@@ -186,7 +186,7 @@
data = {
datasets: [{
label: 'Used memory',
data: [{{ node['cores_total'] - node['cores_free'] }}, {{ node['cores_free'] }}],
data: [{{ node['cores_in_use'] }}, {{ node['cores_total'] - node['cores_in_use'] }}],
backgroundColor: ['rgba(0, 169, 225, 1.0)', 'rgba(145, 192, 46, 1.0)']
}],
'labels': ['In-use', 'Free']
......
......@@ -71,6 +71,6 @@ class KubernetesBackend(zoe_master.backends.base.BaseBackend):
"""Get the platform state."""
info = self.kube.info()
for node in info.nodes: # type: NodeStats
node.memory_free = node.memory_total - node.memory_reserved
node.cores_free = node.cores_total - node.cores_reserved
node.memory_in_use = node.memory_reserved
node.cores_in_use = node.cores_reserved
return info
......@@ -68,8 +68,8 @@ class SwarmBackend(zoe_master.backends.base.BaseBackend):
"""Get the platform state."""
info = self.swarm.info()
for node in info.nodes: # type: NodeStats
node.memory_free = node.memory_total - node.memory_reserved
node.cores_free = node.cores_total - node.cores_reserved
node.memory_in_use = node.memory_reserved
node.cores_in_use = node.cores_reserved
return info
def service_log(self, service: Service):
......
......@@ -16,8 +16,8 @@ class SimulatedNode:
"cores": real_node.cores_reserved
}
self.real_free_resources = {
"memory": real_node.memory_free,
"cores": real_node.cores_free
"memory": real_node.memory_total - real_node.memory_reserved,
"cores": real_node.cores_total - real_node.cores_reserved
}
self.real_active_containers = real_node.container_count
self.services = []
......
......@@ -35,10 +35,10 @@ class NodeStats(Stats):
self.container_count = 0
self.cores_total = 0
self.cores_reserved = 0
self.cores_free = 0
self.cores_in_use = 0
self.memory_total = 0
self.memory_reserved = 0
self.memory_free = 0
self.memory_in_use = 0
self.labels = {}
self.status = None
self.error = ''
......@@ -51,10 +51,10 @@ class NodeStats(Stats):
'container_count': self.container_count,
'cores_total': self.cores_total,
'cores_reserved': self.cores_reserved,
'cores_free': self.cores_free,
'cores_in_use': self.cores_in_use,
'memory_total': self.memory_total,
'memory_reserved': self.memory_reserved,
'memory_free': self.memory_free,
'memory_in_use': self.memory_in_use,
'labels': self.labels,
'status': self.status,
'error': self.error,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment