From d2f70f9d6f9fdabbd5731c7eddb712cba96eed7e Mon Sep 17 00:00:00 2001 From: suzhengwei Date: Fri, 14 Jul 2017 14:30:48 +0800 Subject: [PATCH] change ram util metric Metric 'memory.usage' depends on balloon driver, and shows the memory usage inside guest-os, while 'memory.resident' represents volume of RAM used by the instance on the physical machine So, it is more reasonable to use 'memory.resident' when calculating node utilization by gathering instances utilization of the node. Change-Id: I12dff5176bcf6cb103aa44cafd54f9ecd7170864 --- doc/source/strategies/vm_workload_consolidation.rst | 4 ++-- .../notes/change-ram-util-metric-4a3e6984b9dd968d.yaml | 8 ++++++++ .../strategy/strategies/vm_workload_consolidation.py | 6 +++--- .../decision_engine/model/faker_cluster_and_metrics.py | 4 ++-- 4 files changed, 15 insertions(+), 7 deletions(-) create mode 100644 releasenotes/notes/change-ram-util-metric-4a3e6984b9dd968d.yaml mode change 100755 => 100644 watcher/decision_engine/strategy/strategies/vm_workload_consolidation.py diff --git a/doc/source/strategies/vm_workload_consolidation.rst b/doc/source/strategies/vm_workload_consolidation.rst index 5d30f9d0e..a3e6ef592 100644 --- a/doc/source/strategies/vm_workload_consolidation.rst +++ b/doc/source/strategies/vm_workload_consolidation.rst @@ -22,7 +22,7 @@ The *vm_workload_consolidation* strategy requires the following metrics: ============================ ============ ======= ======= metric service name plugins comment ============================ ============ ======= ======= -``memory`` ceilometer_ none +``memory`` ceilometer_ none ``disk.root.size`` ceilometer_ none ============================ ============ ======= ======= @@ -32,7 +32,7 @@ the strategy if available: ============================ ============ ======= ======= metric service name plugins comment ============================ ============ ======= ======= -``memory.usage`` ceilometer_ none +``memory.resident`` ceilometer_ none ``cpu_util`` ceilometer_ none ============================ ============ ======= ======= diff --git a/releasenotes/notes/change-ram-util-metric-4a3e6984b9dd968d.yaml b/releasenotes/notes/change-ram-util-metric-4a3e6984b9dd968d.yaml new file mode 100644 index 000000000..f30d0d730 --- /dev/null +++ b/releasenotes/notes/change-ram-util-metric-4a3e6984b9dd968d.yaml @@ -0,0 +1,8 @@ +--- +features: + - Enhancement of vm_workload_consolidation strategy + by using 'memory.resident' metric in place of + 'memory.usage', as memory.usage shows the memory + usage inside guest-os and memory.resident + represents volume of RAM used by instance + on host machine. diff --git a/watcher/decision_engine/strategy/strategies/vm_workload_consolidation.py b/watcher/decision_engine/strategy/strategies/vm_workload_consolidation.py old mode 100755 new mode 100644 index 681f34d36..2c906579f --- a/watcher/decision_engine/strategy/strategies/vm_workload_consolidation.py +++ b/watcher/decision_engine/strategy/strategies/vm_workload_consolidation.py @@ -77,12 +77,12 @@ class VMWorkloadConsolidation(base.ServerConsolidationBaseStrategy): METRIC_NAMES = dict( ceilometer=dict( cpu_util_metric='cpu_util', - ram_util_metric='memory.usage', + ram_util_metric='memory.resident', ram_alloc_metric='memory', disk_alloc_metric='disk.root.size'), gnocchi=dict( cpu_util_metric='cpu_util', - ram_util_metric='memory.usage', + ram_util_metric='memory.resident', ram_alloc_metric='memory', disk_alloc_metric='disk.root.size'), ) @@ -361,7 +361,7 @@ class VMWorkloadConsolidation(base.ServerConsolidationBaseStrategy): if not instance_ram_util: instance_ram_util = instance.memory - LOG.warning('No values returned by %s for memory.usage, ' + LOG.warning('No values returned by %s for memory.resident, ' 'use instance flavor ram value', instance.uuid) if not instance_disk_util: diff --git a/watcher/tests/decision_engine/model/faker_cluster_and_metrics.py b/watcher/tests/decision_engine/model/faker_cluster_and_metrics.py index 3c40d6657..472b3e9e9 100644 --- a/watcher/tests/decision_engine/model/faker_cluster_and_metrics.py +++ b/watcher/tests/decision_engine/model/faker_cluster_and_metrics.py @@ -87,7 +87,7 @@ class FakeCeilometerMetrics(object): return self.get_node_cpu_util(resource_id) elif meter_name == "cpu_util": return self.get_instance_cpu_util(resource_id) - elif meter_name == "memory.usage": + elif meter_name == "memory.resident": return self.get_instance_ram_util(resource_id) elif meter_name == "disk.root.size": return self.get_instance_disk_root_size(resource_id) @@ -169,7 +169,7 @@ class FakeGnocchiMetrics(object): return self.get_node_cpu_util(resource_id) elif metric == "cpu_util": return self.get_instance_cpu_util(resource_id) - elif metric == "memory.usage": + elif metric == "memory.resident": return self.get_instance_ram_util(resource_id) elif metric == "disk.root.size": return self.get_instance_disk_root_size(resource_id)