Coverage for watcher/decision_engine/goal/goals.py: 92%
133 statements
« prev ^ index » next coverage.py v7.8.2, created at 2025-06-17 12:22 +0000
« prev ^ index » next coverage.py v7.8.2, created at 2025-06-17 12:22 +0000
1# -*- encoding: utf-8 -*-
2# Copyright (c) 2016 b<>com
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13# implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
17from watcher._i18n import _
18from watcher.decision_engine.goal import base
19from watcher.decision_engine.goal.efficacy import specs
22class Dummy(base.Goal):
23 """Dummy
25 Reserved goal that is used for testing purposes.
26 """
28 @classmethod
29 def get_name(cls):
30 return "dummy"
32 @classmethod
33 def get_display_name(cls):
34 return _("Dummy goal")
36 @classmethod
37 def get_translatable_display_name(cls):
38 return "Dummy goal"
40 @classmethod
41 def get_efficacy_specification(cls):
42 """The efficacy spec for the current goal"""
43 return specs.Unclassified()
46class Unclassified(base.Goal):
47 """Unclassified
49 This goal is used to ease the development process of a strategy. Containing
50 no actual indicator specification, this goal can be used whenever a
51 strategy has yet to be formally associated with an existing goal. If the
52 goal achieve has been identified but there is no available implementation,
53 this Goal can also be used as a transitional stage.
54 """
56 @classmethod
57 def get_name(cls):
58 return "unclassified"
60 @classmethod
61 def get_display_name(cls):
62 return _("Unclassified")
64 @classmethod
65 def get_translatable_display_name(cls):
66 return "Unclassified"
68 @classmethod
69 def get_efficacy_specification(cls):
70 """The efficacy spec for the current goal"""
71 return specs.Unclassified()
74class ServerConsolidation(base.Goal):
75 """ServerConsolidation
77 This goal is for efficient usage of compute server resources in order to
78 reduce the total number of servers.
79 """
81 @classmethod
82 def get_name(cls):
83 return "server_consolidation"
85 @classmethod
86 def get_display_name(cls):
87 return _("Server Consolidation")
89 @classmethod
90 def get_translatable_display_name(cls):
91 return "Server Consolidation"
93 @classmethod
94 def get_efficacy_specification(cls):
95 """The efficacy spec for the current goal"""
96 return specs.ServerConsolidation()
99class ThermalOptimization(base.Goal):
100 """ThermalOptimization
102 This goal is used to balance the temperature across different servers.
103 """
105 @classmethod
106 def get_name(cls):
107 return "thermal_optimization"
109 @classmethod
110 def get_display_name(cls):
111 return _("Thermal Optimization")
113 @classmethod
114 def get_translatable_display_name(cls):
115 return "Thermal Optimization"
117 @classmethod
118 def get_efficacy_specification(cls):
119 """The efficacy spec for the current goal"""
120 return specs.Unclassified()
123class WorkloadBalancing(base.Goal):
124 """WorkloadBalancing
126 This goal is used to evenly distribute workloads across different servers.
127 """
129 @classmethod
130 def get_name(cls):
131 return "workload_balancing"
133 @classmethod
134 def get_display_name(cls):
135 return _("Workload Balancing")
137 @classmethod
138 def get_translatable_display_name(cls):
139 return "Workload Balancing"
141 @classmethod
142 def get_efficacy_specification(cls):
143 """The efficacy spec for the current goal"""
144 return specs.WorkloadBalancing()
147class AirflowOptimization(base.Goal):
148 """AirflowOptimization
150 This goal is used to optimize the airflow within a cloud infrastructure.
151 """
153 @classmethod
154 def get_name(cls):
155 return "airflow_optimization"
157 @classmethod
158 def get_display_name(cls):
159 return _("Airflow Optimization")
161 @classmethod
162 def get_translatable_display_name(cls):
163 return "Airflow Optimization"
165 @classmethod
166 def get_efficacy_specification(cls):
167 """The efficacy spec for the current goal"""
168 return specs.Unclassified()
171class NoisyNeighborOptimization(base.Goal):
172 """NoisyNeighborOptimization
174 This goal is used to identify and migrate a Noisy Neighbor -
175 a low priority VM that negatively affects performance of a high priority VM
176 in terms of IPC by over utilizing Last Level Cache.
177 """
179 @classmethod
180 def get_name(cls):
181 return "noisy_neighbor"
183 @classmethod
184 def get_display_name(cls):
185 return _("Noisy Neighbor")
187 @classmethod
188 def get_translatable_display_name(cls):
189 return "Noisy Neighbor"
191 @classmethod
192 def get_efficacy_specification(cls):
193 """The efficacy spec for the current goal"""
194 return specs.Unclassified()
197class SavingEnergy(base.Goal):
198 """SavingEnergy
200 This goal is used to reduce power consumption within a data center.
201 """
203 @classmethod
204 def get_name(cls):
205 return "saving_energy"
207 @classmethod
208 def get_display_name(cls):
209 return _("Saving Energy")
211 @classmethod
212 def get_translatable_display_name(cls):
213 return "Saving Energy"
215 @classmethod
216 def get_efficacy_specification(cls):
217 """The efficacy spec for the current goal"""
218 return specs.Unclassified()
221class HardwareMaintenance(base.Goal):
222 """HardwareMaintenance
224 This goal is to migrate instances and volumes on a set of compute nodes
225 and storage from nodes under maintenance
226 """
228 @classmethod
229 def get_name(cls):
230 return "hardware_maintenance"
232 @classmethod
233 def get_display_name(cls):
234 return _("Hardware Maintenance")
236 @classmethod
237 def get_translatable_display_name(cls):
238 return "Hardware Maintenance"
240 @classmethod
241 def get_efficacy_specification(cls):
242 """The efficacy spec for the current goal"""
243 return specs.HardwareMaintenance()
246class ClusterMaintaining(base.Goal):
247 """ClusterMaintenance
249 This goal is used to maintain compute nodes
250 without having the user's application being interrupted.
251 """
253 @classmethod
254 def get_name(cls):
255 return "cluster_maintaining"
257 @classmethod
258 def get_display_name(cls):
259 return _("Cluster Maintaining")
261 @classmethod
262 def get_translatable_display_name(cls):
263 return "Cluster Maintaining"
265 @classmethod
266 def get_efficacy_specification(cls):
267 """The efficacy spec for the current goal"""
268 return specs.Unclassified()