Commit ce5c226f authored by Daniele Venzano's avatar Daniele Venzano

Record in use memory, not free

parent 4bf272be
...@@ -139,7 +139,7 @@ ...@@ -139,7 +139,7 @@
data = { data = {
datasets: [{ datasets: [{
label: 'Used memory', 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)'] backgroundColor: ['rgba(0, 169, 225, 1.0)', 'rgba(145, 192, 46, 1.0)']
}], }],
'labels': ['In-use', 'Free'] 'labels': ['In-use', 'Free']
...@@ -186,7 +186,7 @@ ...@@ -186,7 +186,7 @@
data = { data = {
datasets: [{ datasets: [{
label: 'Used memory', 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)'] backgroundColor: ['rgba(0, 169, 225, 1.0)', 'rgba(145, 192, 46, 1.0)']
}], }],
'labels': ['In-use', 'Free'] 'labels': ['In-use', 'Free']
......
...@@ -71,6 +71,6 @@ class KubernetesBackend(zoe_master.backends.base.BaseBackend): ...@@ -71,6 +71,6 @@ class KubernetesBackend(zoe_master.backends.base.BaseBackend):
"""Get the platform state.""" """Get the platform state."""
info = self.kube.info() info = self.kube.info()
for node in info.nodes: # type: NodeStats for node in info.nodes: # type: NodeStats
node.memory_free = node.memory_total - node.memory_reserved node.memory_in_use = node.memory_reserved
node.cores_free = node.cores_total - node.cores_reserved node.cores_in_use = node.cores_reserved
return info return info
...@@ -68,8 +68,8 @@ class SwarmBackend(zoe_master.backends.base.BaseBackend): ...@@ -68,8 +68,8 @@ class SwarmBackend(zoe_master.backends.base.BaseBackend):
"""Get the platform state.""" """Get the platform state."""
info = self.swarm.info() info = self.swarm.info()
for node in info.nodes: # type: NodeStats for node in info.nodes: # type: NodeStats
node.memory_free = node.memory_total - node.memory_reserved node.memory_in_use = node.memory_reserved
node.cores_free = node.cores_total - node.cores_reserved node.cores_in_use = node.cores_reserved
return info return info
def service_log(self, service: Service): def service_log(self, service: Service):
......
...@@ -16,8 +16,8 @@ class SimulatedNode: ...@@ -16,8 +16,8 @@ class SimulatedNode:
"cores": real_node.cores_reserved "cores": real_node.cores_reserved
} }
self.real_free_resources = { self.real_free_resources = {
"memory": real_node.memory_free, "memory": real_node.memory_total - real_node.memory_reserved,
"cores": real_node.cores_free "cores": real_node.cores_total - real_node.cores_reserved
} }
self.real_active_containers = real_node.container_count self.real_active_containers = real_node.container_count
self.services = [] self.services = []
......
...@@ -35,10 +35,10 @@ class NodeStats(Stats): ...@@ -35,10 +35,10 @@ class NodeStats(Stats):
self.container_count = 0 self.container_count = 0
self.cores_total = 0 self.cores_total = 0
self.cores_reserved = 0 self.cores_reserved = 0
self.cores_free = 0 self.cores_in_use = 0
self.memory_total = 0 self.memory_total = 0
self.memory_reserved = 0 self.memory_reserved = 0
self.memory_free = 0 self.memory_in_use = 0
self.labels = {} self.labels = {}
self.status = None self.status = None
self.error = '' self.error = ''
...@@ -51,10 +51,10 @@ class NodeStats(Stats): ...@@ -51,10 +51,10 @@ class NodeStats(Stats):
'container_count': self.container_count, 'container_count': self.container_count,
'cores_total': self.cores_total, 'cores_total': self.cores_total,
'cores_reserved': self.cores_reserved, 'cores_reserved': self.cores_reserved,
'cores_free': self.cores_free, 'cores_in_use': self.cores_in_use,
'memory_total': self.memory_total, 'memory_total': self.memory_total,
'memory_reserved': self.memory_reserved, 'memory_reserved': self.memory_reserved,
'memory_free': self.memory_free, 'memory_in_use': self.memory_in_use,
'labels': self.labels, 'labels': self.labels,
'status': self.status, 'status': self.status,
'error': self.error, '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