Merge "Remove log translations"
This commit is contained in:
@@ -17,7 +17,6 @@
|
||||
# limitations under the License.
|
||||
|
||||
from oslo_log import log
|
||||
from watcher._i18n import _LI, _LW
|
||||
from watcher.common import exception
|
||||
from watcher.common import nova_helper
|
||||
from watcher.decision_engine.model import element
|
||||
@@ -44,8 +43,8 @@ class NovaNotification(base.NotificationEndpoint):
|
||||
if node_uuid:
|
||||
self.get_or_create_node(node_uuid)
|
||||
except exception.ComputeNodeNotFound:
|
||||
LOG.warning(_LW("Could not find compute node %(node)s for "
|
||||
"instance %(instance)s"),
|
||||
LOG.warning("Could not find compute node %(node)s for "
|
||||
"instance %(instance)s",
|
||||
dict(node=node_uuid, instance=instance_uuid))
|
||||
try:
|
||||
instance = self.cluster_data_model.get_instance_by_uuid(
|
||||
@@ -201,7 +200,7 @@ class NovaNotification(base.NotificationEndpoint):
|
||||
try:
|
||||
self.cluster_data_model.delete_instance(instance, node)
|
||||
except Exception:
|
||||
LOG.info(_LI("Instance %s already deleted"), instance.uuid)
|
||||
LOG.info("Instance %s already deleted", instance.uuid)
|
||||
|
||||
|
||||
class VersionedNotificationEndpoint(NovaNotification):
|
||||
@@ -225,8 +224,8 @@ class ServiceUpdated(VersionedNotificationEndpoint):
|
||||
def info(self, ctxt, publisher_id, event_type, payload, metadata):
|
||||
ctxt.request_id = metadata['message_id']
|
||||
ctxt.project_domain = event_type
|
||||
LOG.info(_LI("Event '%(event)s' received from %(publisher)s "
|
||||
"with metadata %(metadata)s") %
|
||||
LOG.info("Event '%(event)s' received from %(publisher)s "
|
||||
"with metadata %(metadata)s" %
|
||||
dict(event=event_type,
|
||||
publisher=publisher_id,
|
||||
metadata=metadata))
|
||||
@@ -269,8 +268,8 @@ class InstanceCreated(VersionedNotificationEndpoint):
|
||||
def info(self, ctxt, publisher_id, event_type, payload, metadata):
|
||||
ctxt.request_id = metadata['message_id']
|
||||
ctxt.project_domain = event_type
|
||||
LOG.info(_LI("Event '%(event)s' received from %(publisher)s "
|
||||
"with metadata %(metadata)s") %
|
||||
LOG.info("Event '%(event)s' received from %(publisher)s "
|
||||
"with metadata %(metadata)s" %
|
||||
dict(event=event_type,
|
||||
publisher=publisher_id,
|
||||
metadata=metadata))
|
||||
@@ -304,8 +303,8 @@ class InstanceUpdated(VersionedNotificationEndpoint):
|
||||
def info(self, ctxt, publisher_id, event_type, payload, metadata):
|
||||
ctxt.request_id = metadata['message_id']
|
||||
ctxt.project_domain = event_type
|
||||
LOG.info(_LI("Event '%(event)s' received from %(publisher)s "
|
||||
"with metadata %(metadata)s") %
|
||||
LOG.info("Event '%(event)s' received from %(publisher)s "
|
||||
"with metadata %(metadata)s" %
|
||||
dict(event=event_type,
|
||||
publisher=publisher_id,
|
||||
metadata=metadata))
|
||||
@@ -331,8 +330,8 @@ class InstanceDeletedEnd(VersionedNotificationEndpoint):
|
||||
def info(self, ctxt, publisher_id, event_type, payload, metadata):
|
||||
ctxt.request_id = metadata['message_id']
|
||||
ctxt.project_domain = event_type
|
||||
LOG.info(_LI("Event '%(event)s' received from %(publisher)s "
|
||||
"with metadata %(metadata)s") %
|
||||
LOG.info("Event '%(event)s' received from %(publisher)s "
|
||||
"with metadata %(metadata)s" %
|
||||
dict(event=event_type,
|
||||
publisher=publisher_id,
|
||||
metadata=metadata))
|
||||
@@ -366,8 +365,8 @@ class LegacyInstanceUpdated(UnversionedNotificationEndpoint):
|
||||
def info(self, ctxt, publisher_id, event_type, payload, metadata):
|
||||
ctxt.request_id = metadata['message_id']
|
||||
ctxt.project_domain = event_type
|
||||
LOG.info(_LI("Event '%(event)s' received from %(publisher)s "
|
||||
"with metadata %(metadata)s") %
|
||||
LOG.info("Event '%(event)s' received from %(publisher)s "
|
||||
"with metadata %(metadata)s" %
|
||||
dict(event=event_type,
|
||||
publisher=publisher_id,
|
||||
metadata=metadata))
|
||||
@@ -393,8 +392,8 @@ class LegacyInstanceCreatedEnd(UnversionedNotificationEndpoint):
|
||||
def info(self, ctxt, publisher_id, event_type, payload, metadata):
|
||||
ctxt.request_id = metadata['message_id']
|
||||
ctxt.project_domain = event_type
|
||||
LOG.info(_LI("Event '%(event)s' received from %(publisher)s "
|
||||
"with metadata %(metadata)s") %
|
||||
LOG.info("Event '%(event)s' received from %(publisher)s "
|
||||
"with metadata %(metadata)s" %
|
||||
dict(event=event_type,
|
||||
publisher=publisher_id,
|
||||
metadata=metadata))
|
||||
@@ -420,8 +419,8 @@ class LegacyInstanceDeletedEnd(UnversionedNotificationEndpoint):
|
||||
def info(self, ctxt, publisher_id, event_type, payload, metadata):
|
||||
ctxt.request_id = metadata['message_id']
|
||||
ctxt.project_domain = event_type
|
||||
LOG.info(_LI("Event '%(event)s' received from %(publisher)s "
|
||||
"with metadata %(metadata)s") %
|
||||
LOG.info("Event '%(event)s' received from %(publisher)s "
|
||||
"with metadata %(metadata)s" %
|
||||
dict(event=event_type,
|
||||
publisher=publisher_id,
|
||||
metadata=metadata))
|
||||
@@ -453,8 +452,8 @@ class LegacyLiveMigratedEnd(UnversionedNotificationEndpoint):
|
||||
def info(self, ctxt, publisher_id, event_type, payload, metadata):
|
||||
ctxt.request_id = metadata['message_id']
|
||||
ctxt.project_domain = event_type
|
||||
LOG.info(_LI("Event '%(event)s' received from %(publisher)s "
|
||||
"with metadata %(metadata)s") %
|
||||
LOG.info("Event '%(event)s' received from %(publisher)s "
|
||||
"with metadata %(metadata)s" %
|
||||
dict(event=event_type,
|
||||
publisher=publisher_id,
|
||||
metadata=metadata))
|
||||
|
||||
@@ -22,7 +22,6 @@ from oslo_config import cfg
|
||||
from oslo_config import types
|
||||
from oslo_log import log
|
||||
|
||||
from watcher._i18n import _LW
|
||||
from watcher.common import utils
|
||||
from watcher.decision_engine.planner import base
|
||||
from watcher import objects
|
||||
@@ -152,7 +151,7 @@ class WeightPlanner(base.BasePlanner):
|
||||
context, action_plan.id, solution.efficacy_indicators)
|
||||
|
||||
if len(action_graph.nodes()) == 0:
|
||||
LOG.warning(_LW("The action plan is empty"))
|
||||
LOG.warning("The action plan is empty")
|
||||
action_plan.state = objects.action_plan.State.SUCCEEDED
|
||||
action_plan.save()
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ from oslo_config import cfg
|
||||
from oslo_config import types
|
||||
from oslo_log import log
|
||||
|
||||
from watcher._i18n import _LW
|
||||
from watcher.common import clients
|
||||
from watcher.common import exception
|
||||
from watcher.common import nova_helper
|
||||
@@ -117,7 +116,7 @@ class WorkloadStabilizationPlanner(base.BasePlanner):
|
||||
scheduled = sorted(to_schedule, key=lambda weight: (weight[0]),
|
||||
reverse=True)
|
||||
if len(scheduled) == 0:
|
||||
LOG.warning(_LW("The action plan is empty"))
|
||||
LOG.warning("The action plan is empty")
|
||||
action_plan.state = objects.action_plan.State.SUCCEEDED
|
||||
action_plan.save()
|
||||
else:
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
from oslo_log import log
|
||||
|
||||
from watcher._i18n import _LW
|
||||
from watcher.common import exception
|
||||
from watcher.common import nova_helper
|
||||
from watcher.decision_engine.scope import base
|
||||
@@ -170,9 +169,9 @@ class DefaultScope(base.BaseScope):
|
||||
node_name = cluster_model.get_node_by_instance_uuid(
|
||||
instance_uuid).uuid
|
||||
except exception.ComputeResourceNotFound:
|
||||
LOG.warning(_LW("The following instance %s cannot be found. "
|
||||
"It might be deleted from CDM along with node"
|
||||
" instance was hosted on."),
|
||||
LOG.warning("The following instance %s cannot be found. "
|
||||
"It might be deleted from CDM along with node"
|
||||
" instance was hosted on.",
|
||||
instance_uuid)
|
||||
continue
|
||||
self.remove_instance(
|
||||
|
||||
@@ -40,7 +40,7 @@ import datetime
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log
|
||||
|
||||
from watcher._i18n import _, _LE, _LI, _LW
|
||||
from watcher._i18n import _
|
||||
from watcher.common import exception
|
||||
from watcher.datasource import ceilometer as ceil
|
||||
from watcher.datasource import gnocchi as gnoc
|
||||
@@ -371,11 +371,11 @@ class BasicConsolidation(base.ServerConsolidationBaseStrategy):
|
||||
if host_avg_cpu_util is None:
|
||||
resource_id = "%s_%s" % (node.uuid, node.hostname)
|
||||
LOG.error(
|
||||
_LE("No values returned by %(resource_id)s "
|
||||
"for %(metric_name)s") % dict(
|
||||
resource_id=resource_id,
|
||||
metric_name=self.METRIC_NAMES[
|
||||
self.config.datasource]['host_cpu_usage']))
|
||||
"No values returned by %(resource_id)s "
|
||||
"for %(metric_name)s" % dict(
|
||||
resource_id=resource_id,
|
||||
metric_name=self.METRIC_NAMES[
|
||||
self.config.datasource]['host_cpu_usage']))
|
||||
host_avg_cpu_util = 100
|
||||
|
||||
total_cores_used = node.vcpus * (host_avg_cpu_util / 100.0)
|
||||
@@ -391,11 +391,11 @@ class BasicConsolidation(base.ServerConsolidationBaseStrategy):
|
||||
instance_cpu_utilization = self.get_instance_cpu_usage(instance)
|
||||
if instance_cpu_utilization is None:
|
||||
LOG.error(
|
||||
_LE("No values returned by %(resource_id)s "
|
||||
"for %(metric_name)s") % dict(
|
||||
resource_id=instance.uuid,
|
||||
metric_name=self.METRIC_NAMES[
|
||||
self.config.datasource]['instance_cpu_usage']))
|
||||
"No values returned by %(resource_id)s "
|
||||
"for %(metric_name)s" % dict(
|
||||
resource_id=instance.uuid,
|
||||
metric_name=self.METRIC_NAMES[
|
||||
self.config.datasource]['instance_cpu_usage']))
|
||||
instance_cpu_utilization = 100
|
||||
|
||||
total_cores_used = instance.vcpus * (instance_cpu_utilization / 100.0)
|
||||
@@ -491,7 +491,7 @@ class BasicConsolidation(base.ServerConsolidationBaseStrategy):
|
||||
return unsuccessful_migration + 1
|
||||
|
||||
def pre_execute(self):
|
||||
LOG.info(_LI("Initializing Server Consolidation"))
|
||||
LOG.info("Initializing Server Consolidation")
|
||||
|
||||
if not self.compute_model:
|
||||
raise exception.ClusterStateNotDefined()
|
||||
@@ -513,9 +513,9 @@ class BasicConsolidation(base.ServerConsolidationBaseStrategy):
|
||||
LOG.debug("Compute node(s) BFD %s", sorted_scores)
|
||||
# Get Node to be released
|
||||
if len(scores) == 0:
|
||||
LOG.warning(_LW(
|
||||
LOG.warning(
|
||||
"The workloads of the compute nodes"
|
||||
" of the cluster is zero"))
|
||||
" of the cluster is zero")
|
||||
return
|
||||
|
||||
while sorted_scores and (
|
||||
|
||||
@@ -30,7 +30,7 @@ telemetries to measure thermal/workload status of server.
|
||||
|
||||
from oslo_log import log
|
||||
|
||||
from watcher._i18n import _, _LW, _LI
|
||||
from watcher._i18n import _
|
||||
from watcher.common import exception as wexc
|
||||
from watcher.datasource import ceilometer as ceil
|
||||
from watcher.decision_engine.model import element
|
||||
@@ -153,7 +153,7 @@ class OutletTempControl(base.ThermalOptimizationBaseStrategy):
|
||||
aggregate='avg')
|
||||
# some hosts may not have outlet temp meters, remove from target
|
||||
if outlet_temp is None:
|
||||
LOG.warning(_LW("%s: no outlet temp data"), resource_id)
|
||||
LOG.warning("%s: no outlet temp data", resource_id)
|
||||
continue
|
||||
|
||||
LOG.debug("%s: outlet temperature %f" % (resource_id, outlet_temp))
|
||||
@@ -176,13 +176,13 @@ class OutletTempControl(base.ThermalOptimizationBaseStrategy):
|
||||
# select the first active instance to migrate
|
||||
if (instance.state !=
|
||||
element.InstanceState.ACTIVE.value):
|
||||
LOG.info(_LI("Instance not active, skipped: %s"),
|
||||
LOG.info("Instance not active, skipped: %s",
|
||||
instance.uuid)
|
||||
continue
|
||||
return mig_source_node, instance
|
||||
except wexc.InstanceNotFound as e:
|
||||
LOG.exception(e)
|
||||
LOG.info(_LI("Instance not found"))
|
||||
LOG.info("Instance not found")
|
||||
|
||||
return None
|
||||
|
||||
@@ -233,7 +233,7 @@ class OutletTempControl(base.ThermalOptimizationBaseStrategy):
|
||||
return self.solution
|
||||
|
||||
if len(hosts_target) == 0:
|
||||
LOG.warning(_LW("No hosts under outlet temp threshold found"))
|
||||
LOG.warning("No hosts under outlet temp threshold found")
|
||||
return self.solution
|
||||
|
||||
# choose the server with highest outlet t
|
||||
@@ -254,7 +254,7 @@ class OutletTempControl(base.ThermalOptimizationBaseStrategy):
|
||||
if len(dest_servers) == 0:
|
||||
# TODO(zhenzanz): maybe to warn that there's no resource
|
||||
# for instance.
|
||||
LOG.info(_LI("No proper target host could be found"))
|
||||
LOG.info("No proper target host could be found")
|
||||
return self.solution
|
||||
|
||||
dest_servers = sorted(dest_servers, key=lambda x: (x["outlet_temp"]))
|
||||
|
||||
@@ -45,7 +45,7 @@ airflow is higher than the specified threshold.
|
||||
|
||||
from oslo_log import log
|
||||
|
||||
from watcher._i18n import _, _LI, _LW
|
||||
from watcher._i18n import _
|
||||
from watcher.common import exception as wexc
|
||||
from watcher.datasource import ceilometer as ceil
|
||||
from watcher.decision_engine.model import element
|
||||
@@ -210,13 +210,13 @@ class UniformAirflow(base.BaseStrategy):
|
||||
if (instance.state !=
|
||||
element.InstanceState.ACTIVE.value):
|
||||
LOG.info(
|
||||
_LI("Instance not active, skipped: %s"),
|
||||
"Instance not active, skipped: %s",
|
||||
instance.uuid)
|
||||
continue
|
||||
instances_tobe_migrate.append(instance)
|
||||
return source_node, instances_tobe_migrate
|
||||
else:
|
||||
LOG.info(_LI("Instance not found on node: %s"),
|
||||
LOG.info("Instance not found on node: %s",
|
||||
source_node.uuid)
|
||||
|
||||
def filter_destination_hosts(self, hosts, instances_to_migrate):
|
||||
@@ -257,8 +257,8 @@ class UniformAirflow(base.BaseStrategy):
|
||||
break
|
||||
# check if all instances have target hosts
|
||||
if len(destination_hosts) != len(instances_to_migrate):
|
||||
LOG.warning(_LW("Not all target hosts could be found; it might "
|
||||
"be because there is not enough resource"))
|
||||
LOG.warning("Not all target hosts could be found; it might "
|
||||
"be because there is not enough resource")
|
||||
return None
|
||||
return destination_hosts
|
||||
|
||||
@@ -281,7 +281,7 @@ class UniformAirflow(base.BaseStrategy):
|
||||
aggregate='avg')
|
||||
# some hosts may not have airflow meter, remove from target
|
||||
if airflow is None:
|
||||
LOG.warning(_LW("%s: no airflow data"), resource_id)
|
||||
LOG.warning("%s: no airflow data", resource_id)
|
||||
continue
|
||||
|
||||
LOG.debug("%s: airflow %f" % (resource_id, airflow))
|
||||
@@ -316,9 +316,9 @@ class UniformAirflow(base.BaseStrategy):
|
||||
return self.solution
|
||||
|
||||
if not target_nodes:
|
||||
LOG.warning(_LW("No hosts currently have airflow under %s, "
|
||||
"therefore there are no possible target "
|
||||
"hosts for any migration"),
|
||||
LOG.warning("No hosts currently have airflow under %s, "
|
||||
"therefore there are no possible target "
|
||||
"hosts for any migration",
|
||||
self.threshold_airflow)
|
||||
return self.solution
|
||||
|
||||
@@ -337,8 +337,8 @@ class UniformAirflow(base.BaseStrategy):
|
||||
destination_hosts = self.filter_destination_hosts(
|
||||
target_nodes, instances_src)
|
||||
if not destination_hosts:
|
||||
LOG.warning(_LW("No target host could be found; it might "
|
||||
"be because there is not enough resources"))
|
||||
LOG.warning("No target host could be found; it might "
|
||||
"be because there is not enough resources")
|
||||
return self.solution
|
||||
# generate solution to migrate the instance to the dest server,
|
||||
for info in destination_hosts:
|
||||
|
||||
@@ -56,7 +56,7 @@ an active compute node to any other active compute node.
|
||||
from oslo_log import log
|
||||
import six
|
||||
|
||||
from watcher._i18n import _, _LE, _LI
|
||||
from watcher._i18n import _
|
||||
from watcher.common import exception
|
||||
from watcher.datasource import ceilometer as ceil
|
||||
from watcher.decision_engine.model import element
|
||||
@@ -107,10 +107,10 @@ class VMWorkloadConsolidation(base.ServerConsolidationBaseStrategy):
|
||||
elif isinstance(state, (element.InstanceState, element.ServiceState)):
|
||||
return state.value
|
||||
else:
|
||||
LOG.error(_LE('Unexpexted resource state type, '
|
||||
'state=%(state)s, state_type=%(st)s.') % dict(
|
||||
state=state,
|
||||
st=type(state)))
|
||||
LOG.error('Unexpected resource state type, '
|
||||
'state=%(state)s, state_type=%(st)s.' %
|
||||
dict(state=state,
|
||||
st=type(state)))
|
||||
raise exception.WatcherException
|
||||
|
||||
def add_action_enable_compute_node(self, node):
|
||||
@@ -154,10 +154,10 @@ class VMWorkloadConsolidation(base.ServerConsolidationBaseStrategy):
|
||||
# When supported, the cold migration may be used as a fallback
|
||||
# migration mechanism to move non active VMs.
|
||||
LOG.error(
|
||||
_LE('Cannot live migrate: instance_uuid=%(instance_uuid)s, '
|
||||
'state=%(instance_state)s.') % dict(
|
||||
instance_uuid=instance.uuid,
|
||||
instance_state=instance_state_str))
|
||||
'Cannot live migrate: instance_uuid=%(instance_uuid)s, '
|
||||
'state=%(instance_state)s.' % dict(
|
||||
instance_uuid=instance.uuid,
|
||||
instance_state=instance_state_str))
|
||||
return
|
||||
|
||||
migration_type = 'live'
|
||||
@@ -229,8 +229,8 @@ class VMWorkloadConsolidation(base.ServerConsolidationBaseStrategy):
|
||||
|
||||
if not instance_ram_util or not instance_disk_util:
|
||||
LOG.error(
|
||||
_LE('No values returned by %s for memory.usage '
|
||||
'or disk.root.size'), instance.uuid)
|
||||
'No values returned by %s for memory.usage '
|
||||
'or disk.root.size', instance.uuid)
|
||||
raise exception.NoDataFound
|
||||
|
||||
self.ceilometer_instance_data_cache[instance.uuid] = dict(
|
||||
@@ -475,7 +475,7 @@ class VMWorkloadConsolidation(base.ServerConsolidationBaseStrategy):
|
||||
|
||||
:param original_model: root_model object
|
||||
"""
|
||||
LOG.info(_LI('Executing Smart Strategy'))
|
||||
LOG.info('Executing Smart Strategy')
|
||||
rcu = self.get_relative_cluster_utilization()
|
||||
|
||||
cc = {'cpu': 1.0, 'ram': 1.0, 'disk': 1.0}
|
||||
|
||||
@@ -49,7 +49,7 @@ hosts nodes.
|
||||
|
||||
from oslo_log import log
|
||||
|
||||
from watcher._i18n import _, _LE, _LI, _LW
|
||||
from watcher._i18n import _
|
||||
from watcher.common import exception as wexc
|
||||
from watcher.datasource import ceilometer as ceil
|
||||
from watcher.decision_engine.model import element
|
||||
@@ -187,14 +187,14 @@ class WorkloadBalance(base.WorkloadStabilizationBaseStrategy):
|
||||
min_delta = current_delta
|
||||
instance_id = instance.uuid
|
||||
except wexc.InstanceNotFound:
|
||||
LOG.error(_LE("Instance not found; error: %s"),
|
||||
LOG.error("Instance not found; error: %s",
|
||||
instance_id)
|
||||
if instance_id:
|
||||
return (source_node,
|
||||
self.compute_model.get_instance_by_uuid(
|
||||
instance_id))
|
||||
else:
|
||||
LOG.info(_LI("VM not found from node: %s"),
|
||||
LOG.info("VM not found from node: %s",
|
||||
source_node.uuid)
|
||||
|
||||
def filter_destination_hosts(self, hosts, instance_to_migrate,
|
||||
@@ -259,7 +259,7 @@ class WorkloadBalance(base.WorkloadStabilizationBaseStrategy):
|
||||
aggregate='avg')
|
||||
except Exception as exc:
|
||||
LOG.exception(exc)
|
||||
LOG.error(_LE("Can not get cpu_util from Ceilometer"))
|
||||
LOG.error("Can not get cpu_util from Ceilometer")
|
||||
continue
|
||||
if cpu_util is None:
|
||||
LOG.debug("Instance (%s): cpu_util is None", instance.uuid)
|
||||
@@ -289,7 +289,7 @@ class WorkloadBalance(base.WorkloadStabilizationBaseStrategy):
|
||||
|
||||
This can be used to fetch some pre-requisites or data.
|
||||
"""
|
||||
LOG.info(_LI("Initializing Workload Balance Strategy"))
|
||||
LOG.info("Initializing Workload Balance Strategy")
|
||||
|
||||
if not self.compute_model:
|
||||
raise wexc.ClusterStateNotDefined()
|
||||
@@ -314,9 +314,9 @@ class WorkloadBalance(base.WorkloadStabilizationBaseStrategy):
|
||||
return self.solution
|
||||
|
||||
if not target_nodes:
|
||||
LOG.warning(_LW("No hosts current have CPU utilization under %s "
|
||||
"percent, therefore there are no possible target "
|
||||
"hosts for any migration"),
|
||||
LOG.warning("No hosts current have CPU utilization under %s "
|
||||
"percent, therefore there are no possible target "
|
||||
"hosts for any migration",
|
||||
self.threshold)
|
||||
return self.solution
|
||||
|
||||
@@ -337,8 +337,8 @@ class WorkloadBalance(base.WorkloadStabilizationBaseStrategy):
|
||||
# pick up the lowest one as dest server
|
||||
if not destination_hosts:
|
||||
# for instance.
|
||||
LOG.warning(_LW("No proper target host could be found, it might "
|
||||
"be because of there's no enough CPU/Memory/DISK"))
|
||||
LOG.warning("No proper target host could be found, it might "
|
||||
"be because of there's no enough CPU/Memory/DISK")
|
||||
return self.solution
|
||||
destination_hosts = sorted(destination_hosts,
|
||||
key=lambda x: (x["cpu_util"]))
|
||||
|
||||
@@ -38,7 +38,7 @@ from oslo_config import cfg
|
||||
from oslo_log import log
|
||||
import oslo_utils
|
||||
|
||||
from watcher._i18n import _LI, _LW, _
|
||||
from watcher._i18n import _
|
||||
from watcher.common import exception
|
||||
from watcher.datasource import ceilometer as ceil
|
||||
from watcher.decision_engine.model import element
|
||||
@@ -202,10 +202,9 @@ class WorkloadStabilization(base.WorkloadStabilizationBaseStrategy):
|
||||
)
|
||||
if avg_meter is None:
|
||||
LOG.warning(
|
||||
_LW("No values returned by %(resource_id)s "
|
||||
"for %(metric_name)s") % dict(
|
||||
resource_id=instance.uuid,
|
||||
metric_name=meter))
|
||||
"No values returned by %(resource_id)s "
|
||||
"for %(metric_name)s" % dict(
|
||||
resource_id=instance.uuid, metric_name=meter))
|
||||
avg_meter = 0
|
||||
if meter == 'cpu_util':
|
||||
avg_meter /= float(100)
|
||||
@@ -399,7 +398,7 @@ class WorkloadStabilization(base.WorkloadStabilizationBaseStrategy):
|
||||
return self.solution
|
||||
|
||||
def pre_execute(self):
|
||||
LOG.info(_LI("Initializing Workload Stabilization"))
|
||||
LOG.info("Initializing Workload Stabilization")
|
||||
|
||||
if not self.compute_model:
|
||||
raise exception.ClusterStateNotDefined()
|
||||
|
||||
@@ -19,7 +19,6 @@ import collections
|
||||
|
||||
from oslo_log import log
|
||||
|
||||
from watcher._i18n import _LI, _LW
|
||||
from watcher.common import context
|
||||
from watcher.decision_engine.loading import default
|
||||
from watcher.decision_engine.scoring import scoring_factory
|
||||
@@ -136,7 +135,7 @@ class Syncer(object):
|
||||
|
||||
for goal_name, goal_map in goals_map.items():
|
||||
if goal_map in self.available_goals_map:
|
||||
LOG.info(_LI("Goal %s already exists"), goal_name)
|
||||
LOG.info("Goal %s already exists", goal_name)
|
||||
continue
|
||||
|
||||
self.goal_mapping.update(self._sync_goal(goal_map))
|
||||
@@ -145,14 +144,14 @@ class Syncer(object):
|
||||
if (strategy_map in self.available_strategies_map and
|
||||
strategy_map.goal_name not in
|
||||
[g.name for g in self.goal_mapping.values()]):
|
||||
LOG.info(_LI("Strategy %s already exists"), strategy_name)
|
||||
LOG.info("Strategy %s already exists", strategy_name)
|
||||
continue
|
||||
|
||||
self.strategy_mapping.update(self._sync_strategy(strategy_map))
|
||||
|
||||
for se_name, se_map in scoringengines_map.items():
|
||||
if se_map in self.available_scoringengines_map:
|
||||
LOG.info(_LI("Scoring Engine %s already exists"),
|
||||
LOG.info("Scoring Engine %s already exists",
|
||||
se_name)
|
||||
continue
|
||||
|
||||
@@ -177,7 +176,7 @@ class Syncer(object):
|
||||
indicator._asdict()
|
||||
for indicator in goal_map.efficacy_specification]
|
||||
goal.create()
|
||||
LOG.info(_LI("Goal %s created"), goal_name)
|
||||
LOG.info("Goal %s created", goal_name)
|
||||
|
||||
# Updating the internal states
|
||||
self.available_goals_map[goal] = goal_map
|
||||
@@ -208,7 +207,7 @@ class Syncer(object):
|
||||
strategy.goal_id = objects.Goal.get_by_name(self.ctx, goal_name).id
|
||||
strategy.parameters_spec = parameters_spec
|
||||
strategy.create()
|
||||
LOG.info(_LI("Strategy %s created"), strategy_name)
|
||||
LOG.info("Strategy %s created", strategy_name)
|
||||
|
||||
# Updating the internal states
|
||||
self.available_strategies_map[strategy] = strategy_map
|
||||
@@ -233,7 +232,7 @@ class Syncer(object):
|
||||
scoringengine.description = scoringengine_map.description
|
||||
scoringengine.metainfo = scoringengine_map.metainfo
|
||||
scoringengine.create()
|
||||
LOG.info(_LI("Scoring Engine %s created"), scoringengine_name)
|
||||
LOG.info("Scoring Engine %s created", scoringengine_name)
|
||||
|
||||
# Updating the internal states
|
||||
self.available_scoringengines_map[scoringengine] = \
|
||||
@@ -270,17 +269,17 @@ class Syncer(object):
|
||||
# and soft delete stale audits and action plans
|
||||
for stale_audit_template in self.stale_audit_templates_map.values():
|
||||
stale_audit_template.save()
|
||||
LOG.info(_LI("Audit Template '%s' synced"),
|
||||
LOG.info("Audit Template '%s' synced",
|
||||
stale_audit_template.name)
|
||||
|
||||
for stale_audit in self.stale_audits_map.values():
|
||||
stale_audit.save()
|
||||
LOG.info(_LI("Stale audit '%s' synced and cancelled"),
|
||||
LOG.info("Stale audit '%s' synced and cancelled",
|
||||
stale_audit.uuid)
|
||||
|
||||
for stale_action_plan in self.stale_action_plans_map.values():
|
||||
stale_action_plan.save()
|
||||
LOG.info(_LI("Stale action plan '%s' synced and cancelled"),
|
||||
LOG.info("Stale action plan '%s' synced and cancelled",
|
||||
stale_action_plan.uuid)
|
||||
|
||||
def _find_stale_audit_templates_due_to_goal(self):
|
||||
@@ -395,15 +394,15 @@ class Syncer(object):
|
||||
invalid_ats = objects.AuditTemplate.list(self.ctx, filters=filters)
|
||||
for at in invalid_ats:
|
||||
LOG.warning(
|
||||
_LW("Audit Template '%(audit_template)s' references a "
|
||||
"goal that does not exist"), audit_template=at.uuid)
|
||||
"Audit Template '%(audit_template)s' references a "
|
||||
"goal that does not exist", audit_template=at.uuid)
|
||||
|
||||
stale_audits = objects.Audit.list(
|
||||
self.ctx, filters=filters, eager=True)
|
||||
for audit in stale_audits:
|
||||
LOG.warning(
|
||||
_LW("Audit '%(audit)s' references a "
|
||||
"goal that does not exist"), audit=audit.uuid)
|
||||
"Audit '%(audit)s' references a "
|
||||
"goal that does not exist", audit=audit.uuid)
|
||||
if audit.id not in self.stale_audits_map:
|
||||
audit.state = objects.audit.State.CANCELLED
|
||||
self.stale_audits_map[audit.id] = audit
|
||||
@@ -422,8 +421,8 @@ class Syncer(object):
|
||||
invalid_ats = objects.AuditTemplate.list(self.ctx, filters=filters)
|
||||
for at in invalid_ats:
|
||||
LOG.info(
|
||||
_LI("Audit Template '%(audit_template)s' references a "
|
||||
"strategy that does not exist"),
|
||||
"Audit Template '%(audit_template)s' references a "
|
||||
"strategy that does not exist",
|
||||
audit_template=at.uuid)
|
||||
# In this case we can reset the strategy ID to None
|
||||
# so the audit template can still achieve the same goal
|
||||
@@ -438,8 +437,8 @@ class Syncer(object):
|
||||
self.ctx, filters=filters, eager=True)
|
||||
for audit in stale_audits:
|
||||
LOG.warning(
|
||||
_LW("Audit '%(audit)s' references a "
|
||||
"strategy that does not exist"), audit=audit.uuid)
|
||||
"Audit '%(audit)s' references a "
|
||||
"strategy that does not exist", audit=audit.uuid)
|
||||
if audit.id not in self.stale_audits_map:
|
||||
audit.state = objects.audit.State.CANCELLED
|
||||
self.stale_audits_map[audit.id] = audit
|
||||
@@ -451,8 +450,8 @@ class Syncer(object):
|
||||
self.ctx, filters=filters, eager=True)
|
||||
for action_plan in stale_action_plans:
|
||||
LOG.warning(
|
||||
_LW("Action Plan '%(action_plan)s' references a "
|
||||
"strategy that does not exist"),
|
||||
"Action Plan '%(action_plan)s' references a "
|
||||
"strategy that does not exist",
|
||||
action_plan=action_plan.uuid)
|
||||
if action_plan.id not in self.stale_action_plans_map:
|
||||
action_plan.state = objects.action_plan.State.CANCELLED
|
||||
@@ -467,7 +466,7 @@ class Syncer(object):
|
||||
se for se in self.available_scoringengines
|
||||
if se.name not in self.discovered_map['scoringengines']]
|
||||
for se in removed_se:
|
||||
LOG.info(_LI("Scoring Engine %s removed"), se.name)
|
||||
LOG.info("Scoring Engine %s removed", se.name)
|
||||
se.soft_delete()
|
||||
|
||||
def _discover(self):
|
||||
@@ -526,9 +525,9 @@ class Syncer(object):
|
||||
for matching_goal in matching_goals:
|
||||
if (matching_goal.efficacy_specification == goal_efficacy_spec and
|
||||
matching_goal.display_name == goal_display_name):
|
||||
LOG.info(_LI("Goal %s unchanged"), goal_name)
|
||||
LOG.info("Goal %s unchanged", goal_name)
|
||||
else:
|
||||
LOG.info(_LI("Goal %s modified"), goal_name)
|
||||
LOG.info("Goal %s modified", goal_name)
|
||||
matching_goal.soft_delete()
|
||||
stale_goals.append(matching_goal)
|
||||
|
||||
@@ -545,9 +544,9 @@ class Syncer(object):
|
||||
matching_strategy.goal_id not in self.goal_mapping and
|
||||
matching_strategy.parameters_spec ==
|
||||
ast.literal_eval(parameters_spec)):
|
||||
LOG.info(_LI("Strategy %s unchanged"), strategy_name)
|
||||
LOG.info("Strategy %s unchanged", strategy_name)
|
||||
else:
|
||||
LOG.info(_LI("Strategy %s modified"), strategy_name)
|
||||
LOG.info("Strategy %s modified", strategy_name)
|
||||
matching_strategy.soft_delete()
|
||||
stale_strategies.append(matching_strategy)
|
||||
|
||||
@@ -563,9 +562,9 @@ class Syncer(object):
|
||||
for matching_scoringengine in matching_scoringengines:
|
||||
if (matching_scoringengine.description == se_description and
|
||||
matching_scoringengine.metainfo == se_metainfo):
|
||||
LOG.info(_LI("Scoring Engine %s unchanged"), se_name)
|
||||
LOG.info("Scoring Engine %s unchanged", se_name)
|
||||
else:
|
||||
LOG.info(_LI("Scoring Engine %s modified"), se_name)
|
||||
LOG.info("Scoring Engine %s modified", se_name)
|
||||
matching_scoringengine.soft_delete()
|
||||
stale_scoringengines.append(matching_scoringengine)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user