Fix some simple mistake

1.The configure is different to the output in install guide.
2.k8s_api has list_namespaced_pod() rather than list_namespaced_pods().
3.Before division, we should check whether the divisor is zero.

Change-Id: I9ca676eac4e3dcba4dcc5553bb5502896d73960e
This commit is contained in:
PanFengyun 2016-07-28 16:25:30 +08:00
parent 4b4d4b0f84
commit 828aff671d
4 changed files with 6 additions and 6 deletions

View File

@ -111,12 +111,12 @@ service, you must create a database, service credentials, and API endpoints.
.. code-block:: console
$ openstack service create --name magnum \
--description "Container Infrastructure Management Service" \
--description "OpenStack Container Infrastructure Management Service" \
container-infra
+-------------+-------------------------------------------------------+
| Field | Value |
+-------------+-------------------------------------------------------+
| description | OpenStack Container Infrastructure Management service |
| description | OpenStack Container Infrastructure Management Service |
| enabled | True |
| id | 194faf83e8fd4e028e5ff75d3d8d0df2 |
| name | magnum |

View File

@ -74,12 +74,12 @@ service, you must create a database, service credentials, and API endpoints.
.. code-block:: console
$ openstack service create --name magnum \
--description "Container Infrastructure Management Service" \
--description "OpenStack Container Infrastructure Management Service" \
container-infra
+-------------+-------------------------------------------------------+
| Field | Value |
+-------------+-------------------------------------------------------+
| description | OpenStack Container Infrastructure Management service |
| description | OpenStack Container Infrastructure Management Service |
| enabled | True |
| id | 194faf83e8fd4e028e5ff75d3d8d0df2 |
| name | magnum |

View File

@ -68,7 +68,7 @@ class K8sMonitor(MonitorBase):
def _parse_pod_info(self, pods):
"""Parse pods and retrieve memory and cpu details about each pod
:param pods: The output of k8s_api.list_namespaced_pods()
:param pods: The output of k8s_api.list_namespaced_pod()
For example:
{
'items': [{

View File

@ -65,7 +65,7 @@ class MesosMonitor(MonitorBase):
return self.data['mem_used'] * 100 / self.data['mem_total']
def compute_cpu_util(self):
if self.data['cpu_used'] == 0:
if self.data['cpu_total'] == 0 or self.data['cpu_used'] == 0:
return 0
else:
return self.data['cpu_used'] * 100 / self.data['cpu_total']