From 828aff671d7dea6b7af4c4cee82b45c81634624e Mon Sep 17 00:00:00 2001 From: PanFengyun Date: Thu, 28 Jul 2016 16:25:30 +0800 Subject: [PATCH] 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 --- doc/source/install-guide-from-source.rst | 4 ++-- install-guide/source/common/prerequisites.rst | 4 ++-- magnum/conductor/k8s_monitor.py | 2 +- magnum/conductor/mesos_monitor.py | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/source/install-guide-from-source.rst b/doc/source/install-guide-from-source.rst index 065403d303..321e75ed1b 100644 --- a/doc/source/install-guide-from-source.rst +++ b/doc/source/install-guide-from-source.rst @@ -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 | diff --git a/install-guide/source/common/prerequisites.rst b/install-guide/source/common/prerequisites.rst index 6902033e95..38dc92d120 100644 --- a/install-guide/source/common/prerequisites.rst +++ b/install-guide/source/common/prerequisites.rst @@ -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 | diff --git a/magnum/conductor/k8s_monitor.py b/magnum/conductor/k8s_monitor.py index fdfa7075e2..eb2617db5d 100644 --- a/magnum/conductor/k8s_monitor.py +++ b/magnum/conductor/k8s_monitor.py @@ -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': [{ diff --git a/magnum/conductor/mesos_monitor.py b/magnum/conductor/mesos_monitor.py index 158f7fc019..63ee1b8c9b 100644 --- a/magnum/conductor/mesos_monitor.py +++ b/magnum/conductor/mesos_monitor.py @@ -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']