i18n - Make string translatable

Since internationalization should be enabled in Watcher, this
patchset refactors the Watcher codebase to wrap previously
untranslatable strings with i18n translation functions so we can
import them for translation into the .pot template file.

Partially Implements: blueprint support-translation
Change-Id: I425967a60b5a7957f753894e5d2ba0d2c5009d1d
This commit is contained in:
Vincent Françoise
2015-12-14 17:27:55 +01:00
parent 3dd02ee895
commit ac07f35dc7
18 changed files with 743 additions and 541 deletions

View File

@@ -181,8 +181,9 @@ class MultiType(wtypes.UserType):
return value
else:
raise ValueError(
_("Wrong type. Expected '%(type)s', got '%(value)s'")
% {'type': self.types, 'value': type(value)})
_("Wrong type. Expected '%(type)s', got '%(value)s'"),
type=self.types, value=type(value)
)
class JsonPatchType(wtypes.Base):

View File

@@ -40,10 +40,9 @@ class AuthTokenMiddleware(auth_token.AuthProtocol):
self.public_api_routes = [re.compile(route_pattern_tpl % route_tpl)
for route_tpl in public_api_routes]
except re.error as e:
msg = _('Cannot compile public API routes: %s') % e
LOG.error(msg)
raise exception.ConfigInvalid(error_msg=msg)
LOG.exception(e)
raise exception.ConfigInvalid(
error_msg=_('Cannot compile public API routes'))
super(AuthTokenMiddleware, self).__init__(app, conf)

View File

@@ -89,5 +89,5 @@ class ApplierManager(MessagingCore):
LOG.debug("type_event => %s" % str(event_type))
LOG.debug("data => %s" % str(data))
except Exception as e:
LOG.error("evt %s" % e.message)
raise e
LOG.exception(e)
raise

View File

@@ -20,7 +20,7 @@
from oslo_config import cfg
from watcher._i18n import _
from watcher.applier.primitives.base import BasePrimitive
from watcher.applier.primitives.wrapper.nova_wrapper import NovaWrapper
from watcher.applier.promise import Promise
@@ -70,7 +70,8 @@ class ChangeNovaServiceState(BasePrimitive):
def nova_manage_service(self, state):
if state is None:
raise IllegalArgumentException("The target state is not defined")
raise IllegalArgumentException(
_("The target state is not defined"))
keystone = KeystoneClient()
wrapper = NovaWrapper(keystone.get_credentials(),

View File

@@ -20,7 +20,6 @@ from oslo_config import cfg
from oslo_log import log
import oslo_messaging as om
from watcher.applier.manager import APPLIER_MANAGER_OPTS
from watcher.applier.manager import opt_group
from watcher.common import exception
@@ -69,5 +68,5 @@ class ApplierAPI(MessagingCore):
try:
pass
except Exception as e:
LOG.error("evt %s" % e.message)
raise e
LOG.exception(e)
raise

View File

@@ -24,11 +24,9 @@ SHOULD include dedicated exception logging.
from oslo_config import cfg
from oslo_log import log as logging
import six
from watcher._i18n import _
from watcher._i18n import _LE
from watcher._i18n import _, _LE
LOG = logging.getLogger(__name__)
@@ -43,7 +41,7 @@ CONF.register_opts(exc_log_opts)
def _cleanse_dict(original):
"""Strip all admin_password, new_pass, rescue_pass keys from a dict."""
"""Strip all admin_password, new_pass, rescue_pass keys from a dict"""
return dict((k, v) for k, v in six.iteritems(original) if "_pass" not in k)
@@ -55,7 +53,7 @@ class WatcherException(Exception):
with the keyword arguments provided to the constructor.
"""
message = _("An unknown exception occurred.")
message = _("An unknown exception occurred")
code = 500
headers = {}
safe = False
@@ -78,7 +76,7 @@ class WatcherException(Exception):
# log the issue and the kwargs
LOG.exception(_LE('Exception in string format operation'))
for name, value in six.iteritems(kwargs):
LOG.error("%s: %s" % (name, value))
LOG.error("%s: %s", name, value)
if CONF.fatal_exception_format_errors:
raise e
@@ -89,7 +87,7 @@ class WatcherException(Exception):
super(WatcherException, self).__init__(message)
def __str__(self):
"""Encode to utf-8 then wsme api can consume it as well."""
"""Encode to utf-8 then wsme api can consume it as well"""
if not six.PY3:
return unicode(self.args[0]).encode('utf-8')
else:
@@ -106,39 +104,39 @@ class WatcherException(Exception):
class NotAuthorized(WatcherException):
message = _("Not authorized.")
message = _("Not authorized")
code = 403
class OperationNotPermitted(NotAuthorized):
message = _("Operation not permitted.")
message = _("Operation not permitted")
class Invalid(WatcherException):
message = _("Unacceptable parameters.")
message = _("Unacceptable parameters")
code = 400
class ObjectNotFound(WatcherException):
message = _("The %(name)s %(id)s could not be found.")
message = _("The %(name)s %(id)s could not be found")
class Conflict(WatcherException):
message = _('Conflict.')
message = _('Conflict')
code = 409
class ResourceNotFound(ObjectNotFound):
message = _("The %(name)s resource %(id)s could not be found.")
message = _("The %(name)s resource %(id)s could not be found")
code = 404
class InvalidIdentity(Invalid):
message = _("Expected an uuid or int but received %(identity)s.")
message = _("Expected an uuid or int but received %(identity)s")
class InvalidGoal(Invalid):
message = _("Goal %(goal)s is not defined in Watcher configuration file.")
message = _("Goal %(goal)s is not defined in Watcher configuration file")
# Cannot be templated as the error syntax varies.
@@ -148,73 +146,73 @@ class InvalidParameterValue(Invalid):
class InvalidUUID(Invalid):
message = _("Expected a uuid but received %(uuid)s.")
message = _("Expected a uuid but received %(uuid)s")
class InvalidName(Invalid):
message = _("Expected a logical name but received %(name)s.")
message = _("Expected a logical name but received %(name)s")
class InvalidUuidOrName(Invalid):
message = _("Expected a logical name or uuid but received %(name)s.")
message = _("Expected a logical name or uuid but received %(name)s")
class AuditTemplateNotFound(ResourceNotFound):
message = _("AuditTemplate %(audit_template)s could not be found.")
message = _("AuditTemplate %(audit_template)s could not be found")
class AuditTemplateAlreadyExists(Conflict):
message = _("An audit_template with UUID %(uuid)s or name %(name)s "
"already exists.")
"already exists")
class AuditTemplateReferenced(Invalid):
message = _("AuditTemplate %(audit_template)s is referenced by one or "
"multiple audit.")
"multiple audit")
class AuditNotFound(ResourceNotFound):
message = _("Audit %(audit)s could not be found.")
message = _("Audit %(audit)s could not be found")
class AuditAlreadyExists(Conflict):
message = _("An audit with UUID %(uuid)s already exists.")
message = _("An audit with UUID %(uuid)s already exists")
class AuditReferenced(Invalid):
message = _("Audit %(audit)s is referenced by one or multiple action "
"plans.")
"plans")
class ActionPlanNotFound(ResourceNotFound):
message = _("ActionPlan %(action plan)s could not be found.")
message = _("ActionPlan %(action plan)s could not be found")
class ActionPlanAlreadyExists(Conflict):
message = _("An action plan with UUID %(uuid)s already exists.")
message = _("An action plan with UUID %(uuid)s already exists")
class ActionPlanReferenced(Invalid):
message = _("Action Plan %(action_plan)s is referenced by one or "
"multiple actions.")
"multiple actions")
class ActionNotFound(ResourceNotFound):
message = _("Action %(action)s could not be found.")
message = _("Action %(action)s could not be found")
class ActionAlreadyExists(Conflict):
message = _("An action with UUID %(uuid)s already exists.")
message = _("An action with UUID %(uuid)s already exists")
class ActionReferenced(Invalid):
message = _("Action plan %(action_plan)s is referenced by one or "
"multiple goals.")
"multiple goals")
class ActionFilterCombinationProhibited(Invalid):
message = _("Filtering actions on both audit and action-plan is "
"prohibited.")
"prohibited")
class HTTPNotFound(ResourceNotFound):
@@ -232,8 +230,7 @@ class BaseException(Exception):
def __init__(self, desc=""):
if (not isinstance(desc, six.string_types)):
raise IllegalArgumentException(
"Description must be an instance of str")
raise ValueError(_("Description must be an instance of str"))
desc = desc.strip()
@@ -243,7 +240,7 @@ class BaseException(Exception):
return self._desc
def get_message(self):
return "An exception occurred without a description."
return _("An exception occurred without a description")
def __str__(self):
return self.get_message()
@@ -251,10 +248,8 @@ class BaseException(Exception):
class IllegalArgumentException(BaseException):
def __init__(self, desc):
BaseException.__init__(self, desc)
if self._desc == "":
raise IllegalArgumentException("Description cannot be empty")
desc = desc or _("Description cannot be empty")
super(IllegalArgumentException, self).__init__(desc)
def get_message(self):
return self._desc
@@ -262,10 +257,8 @@ class IllegalArgumentException(BaseException):
class NoSuchMetric(BaseException):
def __init__(self, desc):
BaseException.__init__(self, desc)
if self._desc == "":
raise NoSuchMetric("No such metric")
desc = desc or _("No such metric")
super(NoSuchMetric, self).__init__(desc)
def get_message(self):
return self._desc
@@ -273,10 +266,8 @@ class NoSuchMetric(BaseException):
class NoDataFound(BaseException):
def __init__(self, desc):
BaseException.__init__(self, desc)
if self._desc == "":
raise NoSuchMetric("no rows were returned")
desc = desc or _("No rows were returned")
super(NoDataFound, self).__init__(desc)
def get_message(self):
return self._desc
@@ -287,11 +278,11 @@ class KeystoneFailure(WatcherException):
class ClusterEmpty(WatcherException):
message = _("The list of hypervisor(s) in the cluster is empty.'")
message = _("The list of hypervisor(s) in the cluster is empty")
class MetricCollectorNotDefined(WatcherException):
message = _("The metrics resource collector is not defined.'")
message = _("The metrics resource collector is not defined")
class ClusterStateNotDefined(WatcherException):
@@ -301,12 +292,12 @@ class ClusterStateNotDefined(WatcherException):
# Model
class VMNotFound(WatcherException):
message = _("The VM could not be found.")
message = _("The VM could not be found")
class HypervisorNotFound(WatcherException):
message = _("The hypervisor could not be found.")
message = _("The hypervisor could not be found")
class MetaActionNotFound(WatcherException):
message = _("The Meta-Action could not be found.")
message = _("The Meta-Action could not be found")

View File

@@ -17,16 +17,15 @@
# limitations under the License.
#
from keystoneclient.auth.identity import generic
from keystoneclient import session as keystone_session
from oslo_config import cfg
from oslo_log import log
from six.moves.urllib.parse import urljoin
from six.moves.urllib.parse import urlparse
from keystoneclient.auth.identity import generic
from keystoneclient import session as keystone_session
from watcher.common.exception import KeystoneFailure
from watcher._i18n import _
from watcher.common import exception
LOG = log.getLogger(__name__)
@@ -56,8 +55,9 @@ class KeystoneClient(object):
def get_endpoint(self, **kwargs):
kc = self._get_ksclient()
if not kc.has_service_catalog():
raise KeystoneFailure('No Keystone service catalog '
'loaded')
raise exception.KeystoneFailure(
_('No Keystone service catalog loaded')
)
attr = None
filter_value = None
if kwargs.get('region_name'):

View File

@@ -15,14 +15,15 @@
# limitations under the License.
import socket
import threading
import eventlet
from oslo_config import cfg
from oslo_log import log
import oslo_messaging as om
from threading import Thread
from watcher.common.rpc import JsonPayloadSerializer
from watcher.common.rpc import RequestContextSerializer
from watcher.common import rpc
from watcher._i18n import _LE, _LW
# NOTE:
# Ubuntu 14.04 forces librabbitmq when kombu is used
@@ -35,7 +36,7 @@ LOG = log.getLogger(__name__)
CONF = cfg.CONF
class MessagingHandler(Thread):
class MessagingHandler(threading.Thread):
def __init__(self, publisher_id, topic_watcher, endpoint, version,
serializer=None):
@@ -67,7 +68,7 @@ class MessagingHandler(Thread):
return self.__transport
def build_notifier(self):
serializer = RequestContextSerializer(JsonPayloadSerializer())
serializer = rpc.RequestContextSerializer(rpc.JsonPayloadSerializer())
return om.Notifier(
self.__transport,
publisher_id=self.publisher_id,
@@ -93,11 +94,11 @@ class MessagingHandler(Thread):
)
self.__server = self.build_server(target)
else:
LOG.warn("you have no defined endpoint, "
"so you can only publish events")
LOG.warn(
_LW("No endpoint defined; can only publish events"))
except Exception as e:
LOG.exception(e)
LOG.error("configure : %s" % str(e.message))
LOG.error(_LE("Messaging configuration error"))
def run(self):
LOG.debug("configure MessagingHandler for %s" % self.topic_watcher)
@@ -107,7 +108,7 @@ class MessagingHandler(Thread):
self.__server.start()
def stop(self):
LOG.debug('Stop up server')
LOG.debug('Stopped server')
self.__server.wait()
self.__server.stop()

View File

@@ -22,15 +22,14 @@ from oslo_db import exception as db_exc
from oslo_db.sqlalchemy import session as db_session
from oslo_db.sqlalchemy import utils as db_utils
from oslo_log import log
from sqlalchemy.orm.exc import MultipleResultsFound
from sqlalchemy.orm.exc import NoResultFound
from sqlalchemy.orm import exc
from watcher import _i18n
from watcher.common import exception
from watcher.common import utils
from watcher.db import api
from watcher.db.sqlalchemy import models
from watcher.objects.audit import AuditStatus
from watcher.objects import audit as audit_objects
CONF = cfg.CONF
LOG = log.getLogger(__name__)
@@ -223,7 +222,7 @@ class Connection(api.BaseConnection):
raise exception.AuditTemplateNotFound(
audit_template=audit_template_id)
return audit_template
except NoResultFound:
except exc.NoResultFound:
raise exception.AuditTemplateNotFound(
audit_template=audit_template_id)
@@ -238,7 +237,7 @@ class Connection(api.BaseConnection):
raise exception.AuditTemplateNotFound(
audit_template=audit_template_uuid)
return audit_template
except NoResultFound:
except exc.NoResultFound:
raise exception.AuditTemplateNotFound(
audit_template=audit_template_uuid)
@@ -252,11 +251,11 @@ class Connection(api.BaseConnection):
raise exception.AuditTemplateNotFound(
audit_template=audit_template_name)
return audit_template
except MultipleResultsFound:
except exc.MultipleResultsFound:
raise exception.Conflict(
'Multiple audit templates exist with same name.'
' Please use the audit template uuid instead.')
except NoResultFound:
_('Multiple audit templates exist with the same name.'
' Please use the audit template uuid instead'))
except exc.NoResultFound:
raise exception.AuditTemplateNotFound(
audit_template=audit_template_name)
@@ -268,7 +267,7 @@ class Connection(api.BaseConnection):
try:
query.one()
except NoResultFound:
except exc.NoResultFound:
raise exception.AuditTemplateNotFound(node=audit_template_id)
query.delete()
@@ -287,7 +286,7 @@ class Connection(api.BaseConnection):
query = add_identity_filter(query, audit_template_id)
try:
ref = query.with_lockmode('update').one()
except NoResultFound:
except exc.NoResultFound:
raise exception.AuditTemplateNotFound(
audit_template=audit_template_id)
@@ -302,7 +301,7 @@ class Connection(api.BaseConnection):
try:
query.one()
except NoResultFound:
except exc.NoResultFound:
raise exception.AuditTemplateNotFound(node=audit_template_id)
query.soft_delete()
@@ -323,7 +322,7 @@ class Connection(api.BaseConnection):
values['uuid'] = utils.generate_uuid()
if values.get('state') is None:
values['state'] = AuditStatus.PENDING
values['state'] = audit_objects.AuditStatus.PENDING
audit = models.Audit()
audit.update(values)
@@ -343,7 +342,7 @@ class Connection(api.BaseConnection):
if audit.state == 'DELETED':
raise exception.AuditNotFound(audit=audit_id)
return audit
except NoResultFound:
except exc.NoResultFound:
raise exception.AuditNotFound(audit=audit_id)
def get_audit_by_uuid(self, context, audit_uuid):
@@ -356,7 +355,7 @@ class Connection(api.BaseConnection):
if audit.state == 'DELETED':
raise exception.AuditNotFound(audit=audit_uuid)
return audit
except NoResultFound:
except exc.NoResultFound:
raise exception.AuditNotFound(audit=audit_uuid)
def destroy_audit(self, audit_id):
@@ -374,7 +373,7 @@ class Connection(api.BaseConnection):
try:
audit_ref = query.one()
except NoResultFound:
except exc.NoResultFound:
raise exception.AuditNotFound(audit=audit_id)
if is_audit_referenced(session, audit_ref['id']):
@@ -396,7 +395,7 @@ class Connection(api.BaseConnection):
query = add_identity_filter(query, audit_id)
try:
ref = query.with_lockmode('update').one()
except NoResultFound:
except exc.NoResultFound:
raise exception.AuditNotFound(audit=audit_id)
ref.update(values)
@@ -410,7 +409,7 @@ class Connection(api.BaseConnection):
try:
query.one()
except NoResultFound:
except exc.NoResultFound:
raise exception.AuditNotFound(node=audit_id)
query.soft_delete()
@@ -447,7 +446,7 @@ class Connection(api.BaseConnection):
raise exception.ActionNotFound(
action=action_id)
return action
except NoResultFound:
except exc.NoResultFound:
raise exception.ActionNotFound(action=action_id)
def get_action_by_uuid(self, context, action_uuid):
@@ -460,7 +459,7 @@ class Connection(api.BaseConnection):
raise exception.ActionNotFound(
action=action_uuid)
return action
except NoResultFound:
except exc.NoResultFound:
raise exception.ActionNotFound(action=action_uuid)
def destroy_action(self, action_id):
@@ -487,7 +486,7 @@ class Connection(api.BaseConnection):
query = add_identity_filter(query, action_id)
try:
ref = query.with_lockmode('update').one()
except NoResultFound:
except exc.NoResultFound:
raise exception.ActionNotFound(action=action_id)
ref.update(values)
@@ -501,7 +500,7 @@ class Connection(api.BaseConnection):
try:
query.one()
except NoResultFound:
except exc.NoResultFound:
raise exception.ActionNotFound(node=action_id)
query.soft_delete()
@@ -541,7 +540,7 @@ class Connection(api.BaseConnection):
raise exception.ActionPlanNotFound(
action_plan=action_plan_id)
return action_plan
except NoResultFound:
except exc.NoResultFound:
raise exception.ActionPlanNotFound(action_plan=action_plan_id)
def get_action_plan_by_uuid(self, context, action_plan__uuid):
@@ -555,7 +554,7 @@ class Connection(api.BaseConnection):
raise exception.ActionPlanNotFound(
action_plan=action_plan__uuid)
return action_plan
except NoResultFound:
except exc.NoResultFound:
raise exception.ActionPlanNotFound(action_plan=action_plan__uuid)
def destroy_action_plan(self, action_plan_id):
@@ -573,7 +572,7 @@ class Connection(api.BaseConnection):
try:
action_plan_ref = query.one()
except NoResultFound:
except exc.NoResultFound:
raise exception.ActionPlanNotFound(action_plan=action_plan_id)
if is_action_plan_referenced(session, action_plan_ref['id']):
@@ -596,7 +595,7 @@ class Connection(api.BaseConnection):
query = add_identity_filter(query, action_plan_id)
try:
ref = query.with_lockmode('update').one()
except NoResultFound:
except exc.NoResultFound:
raise exception.ActionPlanNotFound(action_plan=action_plan_id)
ref.update(values)
@@ -610,7 +609,7 @@ class Connection(api.BaseConnection):
try:
query.one()
except NoResultFound:
except exc.NoResultFound:
raise exception.ActionPlanNotFound(node=action_plan_id)
query.soft_delete()

View File

@@ -21,6 +21,7 @@ from alembic import config as alembic_config
import alembic.migration as alembic_migration
from oslo_db import exception as db_exc
from watcher._i18n import _
from watcher.db.sqlalchemy import api as sqla_api
from watcher.db.sqlalchemy import models
@@ -68,8 +69,9 @@ def create_schema(config=None, engine=None):
# schema, it will only add the new tables, but leave
# existing as is. So we should avoid of this situation.
if version(engine=engine) is not None:
raise db_exc.DbMigrationError("DB schema is already under version"
" control. Use upgrade() instead")
raise db_exc.DbMigrationError(
_("Watcher database schema is already under version control; "
"use upgrade() instead"))
models.Base.metadata.create_all(engine)
stamp('head', config=config)

View File

@@ -15,12 +15,11 @@
# limitations under the License.
from oslo_log import log
from watcher.common.exception import HypervisorNotFound
from watcher.common.exception import IllegalArgumentException
from watcher.common.exception import VMNotFound
from watcher.decision_engine.model.hypervisor import Hypervisor
from watcher.decision_engine.model.mapping import Mapping
from watcher.decision_engine.model.vm import VM
from watcher._i18n import _
from watcher.common import exception
from watcher.decision_engine.model import hypervisor
from watcher.decision_engine.model import mapping
from watcher.decision_engine.model import vm
LOG = log.getLogger(__name__)
@@ -29,18 +28,18 @@ class ModelRoot(object):
def __init__(self):
self._hypervisors = {}
self._vms = {}
self.mapping = Mapping(self)
self.mapping = mapping.Mapping(self)
self.resource = {}
def assert_hypervisor(self, hypervisor):
if not isinstance(hypervisor, Hypervisor):
raise IllegalArgumentException(
"Hypervisor must be an instance of hypervisor")
def assert_hypervisor(self, obj):
if not isinstance(obj, hypervisor.Hypervisor):
raise exception.IllegalArgumentException(
_("'obj' argument type is not valid"))
def assert_vm(self, vm):
if not isinstance(vm, VM):
raise IllegalArgumentException(
"VM must be an instance of VM")
def assert_vm(self, obj):
if not isinstance(obj, vm.VM):
raise exception.IllegalArgumentException(
_("'obj' argument type is not valid"))
def add_hypervisor(self, hypervisor):
self.assert_hypervisor(hypervisor)
@@ -49,7 +48,7 @@ class ModelRoot(object):
def remove_hypervisor(self, hypervisor):
self.assert_hypervisor(hypervisor)
if str(hypervisor.uuid) not in self._hypervisors.keys():
raise HypervisorNotFound(hypervisor.uuid)
raise exception.HypervisorNotFound(hypervisor.uuid)
else:
del self._hypervisors[hypervisor.uuid]
@@ -62,12 +61,12 @@ class ModelRoot(object):
def get_hypervisor_from_id(self, hypervisor_uuid):
if str(hypervisor_uuid) not in self._hypervisors.keys():
raise HypervisorNotFound(hypervisor_uuid)
raise exception.HypervisorNotFound(hypervisor_uuid)
return self._hypervisors[str(hypervisor_uuid)]
def get_vm_from_id(self, uuid):
if str(uuid) not in self._vms.keys():
raise VMNotFound(uuid)
raise exception.VMNotFound(uuid)
return self._vms[str(uuid)]
def get_all_vms(self):

View File

@@ -19,20 +19,17 @@
from oslo_log import log
from enum import Enum
from watcher.common.exception import MetaActionNotFound
from watcher._i18n import _LW
from watcher.common import exception
from watcher.common import utils
from watcher.decision_engine.planner.base import BasePlanner
from watcher.decision_engine.actions import hypervisor_state
from watcher.decision_engine.actions import migration
from watcher.decision_engine.actions import nop
from watcher.decision_engine.actions import power_state
from watcher.decision_engine.planner import base
from watcher import objects
from watcher.decision_engine.actions.hypervisor_state import \
ChangeHypervisorState
from watcher.decision_engine.actions.migration import Migrate
from watcher.decision_engine.actions.nop import Nop
from watcher.decision_engine.actions.power_state import ChangePowerState
from watcher.objects.action import Status as AStatus
from watcher.objects.action_plan import Status as APStatus
LOG = log.getLogger(__name__)
@@ -57,7 +54,7 @@ priority_primitives = {
}
class DefaultPlanner(BasePlanner):
class DefaultPlanner(base.BasePlanner):
def create_action(self, action_plan_id, action_type, applies_to=None,
src=None,
dst=None,
@@ -74,7 +71,7 @@ class DefaultPlanner(BasePlanner):
'dst': dst,
'parameter': parameter,
'description': description,
'state': AStatus.PENDING,
'state': objects.action.Status.PENDING,
'alarm': None,
'next': None,
}
@@ -88,7 +85,7 @@ class DefaultPlanner(BasePlanner):
to_schedule = []
for action in actions:
if isinstance(action, Migrate):
if isinstance(action, migration.Migrate):
# TODO(jed) type
primitive = self.create_action(action_plan.id,
Primitives.LIVE_MIGRATE.value,
@@ -101,7 +98,7 @@ class DefaultPlanner(BasePlanner):
action)
)
elif isinstance(action, ChangePowerState):
elif isinstance(action, power_state.ChangePowerState):
primitive = self.create_action(action_plan_id=action_plan.id,
action_type=Primitives.
POWER_STATE.value,
@@ -111,7 +108,7 @@ class DefaultPlanner(BasePlanner):
value,
description="{0}".format(
action))
elif isinstance(action, ChangeHypervisorState):
elif isinstance(action, hypervisor_state.ChangeHypervisorState):
primitive = self.create_action(action_plan_id=action_plan.id,
action_type=Primitives.
HYPERVISOR_STATE.value,
@@ -120,21 +117,21 @@ class DefaultPlanner(BasePlanner):
value,
description="{0}".format(
action))
elif isinstance(action, Nop):
elif isinstance(action, nop.Nop):
primitive = self.create_action(action_plan_id=action_plan.id,
action_type=Primitives.
NOP.value,
description="{0}".format(
action))
else:
raise MetaActionNotFound()
raise exception.MetaActionNotFound()
priority = priority_primitives[primitive['action_type']]
to_schedule.append((priority, primitive))
# scheduling
scheduled = sorted(to_schedule, reverse=False, key=lambda x: (x[0]))
if len(scheduled) == 0:
LOG.warning("The ActionPlan is empty")
LOG.warning(_LW("The action plan is empty"))
action_plan.first_action_id = None
action_plan.save()
else:
@@ -157,7 +154,7 @@ class DefaultPlanner(BasePlanner):
'uuid': utils.generate_uuid(),
'audit_id': audit_id,
'first_action_id': None,
'state': APStatus.RECOMMENDED
'state': objects.action_plan.Status.RECOMMENDED
}
new_action_plan = objects.ActionPlan(context, **action_plan_dict)

View File

@@ -28,7 +28,6 @@ from watcher.common import utils
from watcher.decision_engine.event.consumer_factory import EventConsumerFactory
from watcher.decision_engine.manager import decision_engine_opt_group
from watcher.decision_engine.manager import WATCHER_DECISION_ENGINE_OPTS
from watcher.decision_engine.messaging.events import Events
LOG = log.getLogger(__name__)
@@ -82,5 +81,5 @@ class DecisionEngineAPI(MessagingCore):
event_consumer = EventConsumerFactory.factory(event_type)
event_consumer.execute(request_id, self.context, data)
except Exception as e:
LOG.error("evt %s" % e.message)
raise e
LOG.exception(e)
raise

View File

@@ -17,10 +17,10 @@
from oslo_config import cfg
from oslo_log import log
from watcher.common.exception import WatcherException
from watcher.decision_engine.strategy.loading.default import \
DefaultStrategyLoader
from watcher.decision_engine.strategy.selection.base import BaseSelector
from watcher._i18n import _
from watcher.common import exception
from watcher.decision_engine.strategy.loading import default
from watcher.decision_engine.strategy.selection import base
LOG = log.getLogger(__name__)
CONF = cfg.CONF
@@ -41,11 +41,11 @@ CONF.register_group(goals_opt_group)
CONF.register_opts(WATCHER_GOALS_OPTS, goals_opt_group)
class DefaultStrategySelector(BaseSelector):
class DefaultStrategySelector(base.BaseSelector):
def __init__(self):
super(DefaultStrategySelector, self).__init__()
self.strategy_loader = DefaultStrategyLoader()
self.strategy_loader = default.DefaultStrategyLoader()
def define_from_goal(self, goal_name):
strategy_to_load = None
@@ -54,7 +54,7 @@ class DefaultStrategySelector(BaseSelector):
return self.strategy_loader.load(strategy_to_load)
except KeyError as exc:
LOG.exception(exc)
raise WatcherException(
"Incorrect mapping: could not find "
"associated strategy for '%s'" % goal_name
raise exception.WatcherException(
_("Incorrect mapping: could not find "
"associated strategy for '%s'") % goal_name
)

View File

@@ -16,7 +16,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
from oslo_log import log
from watcher._i18n import _LE, _LI, _LW
from watcher.common.exception import ClusterEmpty
from watcher.common.exception import ClusterStateNotDefined
from watcher.decision_engine.actions.hypervisor_state import \
@@ -40,6 +43,9 @@ class BasicConsolidation(BaseStrategy):
DEFAULT_NAME = "basic"
DEFAULT_DESCRIPTION = "Basic offline consolidation"
host_cpu_usage_metric_name = 'compute.node.cpu.percent'
instance_cpu_usage_metric_name = 'cpu_util'
def __init__(self, name=DEFAULT_NAME, description=DEFAULT_DESCRIPTION):
"""Basic offline Consolidation using live migration
@@ -254,18 +260,20 @@ class BasicConsolidation(BaseStrategy):
:param model:
:return:
"""
resource_id = "{0}_{1}".format(hypervisor.uuid,
hypervisor.hostname)
resource_id = "%s_%s" % (hypervisor.uuid, hypervisor.hostname)
cpu_avg_vm = self.ceilometer. \
statistic_aggregation(resource_id=resource_id,
meter_name='compute.node.cpu.percent',
meter_name=self.host_cpu_usage_metric_name,
period="7200",
aggregate='avg'
)
if cpu_avg_vm is None:
LOG.error(
"No values returned for {0} compute.node.cpu.percent".format(
resource_id))
_LE("No values returned by %(resource_id)s "
"for %(metric_name)s"),
resource_id=resource_id,
metric_name=self.host_cpu_usage_metric_name,
)
cpu_avg_vm = 100
cpu_capacity = model.get_resource_from_id(
@@ -300,14 +308,19 @@ class BasicConsolidation(BaseStrategy):
raise ClusterStateNotDefined()
vm_cpu_utilization = self.ceilometer. \
statistic_aggregation(resource_id=vm.uuid,
meter_name='cpu_util',
period="7200",
aggregate='avg'
)
statistic_aggregation(
resource_id=vm.uuid,
meter_name=self.instance_cpu_usage_metric_name,
period="7200",
aggregate='avg'
)
if vm_cpu_utilization is None:
LOG.error(
"No values returned for {0} cpu_util".format(vm.uuid))
_LE("No values returned by %(resource_id)s "
"for %(metric_name)s"),
resource_id=vm.uuid,
metric_name=self.instance_cpu_usage_metric_name,
)
vm_cpu_utilization = 100
cpu_capacity = model.get_resource_from_id(
@@ -331,7 +344,7 @@ class BasicConsolidation(BaseStrategy):
model)))
def execute(self, orign_model):
LOG.debug("Initialize Sercon Consolidation")
LOG.info(_LI("Initializing Sercon Consolidation"))
if orign_model is None:
raise ClusterStateNotDefined()
@@ -393,9 +406,9 @@ class BasicConsolidation(BaseStrategy):
''' get Node to be released '''
if len(score) == 0:
LOG.warning(
LOG.warning(_LW(
"The workloads of the compute nodes"
" of the cluster is zero.")
" of the cluster is zero"))
break
node_to_release = s[len(score) - 1][0]
@@ -413,6 +426,7 @@ class BasicConsolidation(BaseStrategy):
''' sort VMs by Score '''
v = sorted(vm_score, reverse=True, key=lambda x: (x[1]))
# BFD: Best Fit Decrease
LOG.debug("VM(s) BFD {0}".format(v))
m = 0

View File

@@ -1,285 +0,0 @@
# French translations for python-watcher.
# Copyright (C) 2015 ORGANIZATION
# This file is distributed under the same license as the python-watcher
# project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2015.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: python-watcher 0.21.1.dev32\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2015-12-11 15:29+0100\n"
"PO-Revision-Date: 2015-12-11 15:42+0100\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language: fr\n"
"Language-Team: fr <LL@li.org>\n"
"Plural-Forms: nplurals=2; plural=(n > 1)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.1.1\n"
#: watcher/api/controllers/v1/types.py:148
#, python-format
msgid "%s is not JSON serializable"
msgstr ""
#: watcher/api/controllers/v1/types.py:184
#, python-format
msgid "Wrong type. Expected '%(type)s', got '%(value)s'"
msgstr ""
#: watcher/api/controllers/v1/types.py:222
#, python-format
msgid "'%s' is an internal attribute and can not be updated"
msgstr ""
#: watcher/api/controllers/v1/types.py:226
#, python-format
msgid "'%s' is a mandatory attribute and can not be removed"
msgstr ""
#: watcher/api/controllers/v1/types.py:231
msgid "'add' and 'replace' operations needs value"
msgstr ""
#: watcher/api/controllers/v1/utils.py:32
msgid "Limit must be positive"
msgstr ""
#: watcher/api/controllers/v1/utils.py:39
#, python-format
msgid "Invalid sort direction: %s. Acceptable values are 'asc' or 'desc'"
msgstr ""
#: watcher/api/controllers/v1/utils.py:49
#, python-format
msgid "Adding a new attribute (%s) to the root of the resource is not allowed"
msgstr ""
#: watcher/api/middleware/auth_token.py:43
#, python-format
msgid "Cannot compile public API routes: %s"
msgstr ""
#: watcher/api/middleware/parsable_error.py:53
#, python-format
msgid "ErrorDocumentMiddleware received an invalid status %s"
msgstr ""
#: watcher/cmd/api.py:45
#, python-format
msgid "Starting server in PID %s"
msgstr ""
#: watcher/cmd/api.py:50
#, python-format
msgid "serving on 0.0.0.0:%(port)s, view at http://127.0.0.1:%(port)s"
msgstr ""
#: watcher/cmd/api.py:54
#, python-format
msgid "serving on http://%(host)s:%(port)s"
msgstr ""
#: watcher/common/exception.py:58
msgid "An unknown exception occurred."
msgstr ""
#: watcher/common/exception.py:109
msgid "Not authorized."
msgstr ""
#: watcher/common/exception.py:114
msgid "Operation not permitted."
msgstr ""
#: watcher/common/exception.py:118
msgid "Unacceptable parameters."
msgstr ""
#: watcher/common/exception.py:123
#, python-format
msgid "The %(name)s %(id)s could not be found."
msgstr ""
#: watcher/common/exception.py:127
msgid "Conflict."
msgstr ""
#: watcher/common/exception.py:132
#, python-format
msgid "The %(name)s resource %(id)s could not be found."
msgstr ""
#: watcher/common/exception.py:137
#, python-format
msgid "Expected an uuid or int but received %(identity)s."
msgstr ""
#: watcher/common/exception.py:141
#, python-format
msgid "Goal %(goal)s is not defined in Watcher configuration file."
msgstr ""
#: watcher/common/exception.py:147
#, python-format
msgid "%(err)s"
msgstr ""
#: watcher/common/exception.py:151
#, python-format
msgid "Expected a uuid but received %(uuid)s."
msgstr ""
#: watcher/common/exception.py:155
#, python-format
msgid "Expected a logical name but received %(name)s."
msgstr ""
#: watcher/common/exception.py:159
#, python-format
msgid "Expected a logical name or uuid but received %(name)s."
msgstr ""
#: watcher/common/exception.py:163
#, python-format
msgid "AuditTemplate %(audit_template)s could not be found."
msgstr ""
#: watcher/common/exception.py:167
#, python-format
msgid "An audit_template with UUID %(uuid)s or name %(name)s already exists."
msgstr ""
#: watcher/common/exception.py:172
#, python-format
msgid "AuditTemplate %(audit_template)s is referenced by one or multiple audit."
msgstr ""
#: watcher/common/exception.py:177
#, python-format
msgid "Audit %(audit)s could not be found."
msgstr ""
#: watcher/common/exception.py:181
#, python-format
msgid "An audit with UUID %(uuid)s already exists."
msgstr ""
#: watcher/common/exception.py:185
#, python-format
msgid "Audit %(audit)s is referenced by one or multiple action plans."
msgstr ""
#: watcher/common/exception.py:190
msgid "ActionPlan %(action plan)s could not be found."
msgstr ""
#: watcher/common/exception.py:194
#, python-format
msgid "An action plan with UUID %(uuid)s already exists."
msgstr ""
#: watcher/common/exception.py:198
#, python-format
msgid "Action Plan %(action_plan)s is referenced by one or multiple actions."
msgstr ""
#: watcher/common/exception.py:203
#, python-format
msgid "Action %(action)s could not be found."
msgstr ""
#: watcher/common/exception.py:207
#, python-format
msgid "An action with UUID %(uuid)s already exists."
msgstr ""
#: watcher/common/exception.py:211
#, python-format
msgid "Action plan %(action_plan)s is referenced by one or multiple goals."
msgstr ""
#: watcher/common/exception.py:216
msgid "Filtering actions on both audit and action-plan is prohibited."
msgstr ""
#: watcher/common/exception.py:225
#, python-format
msgid "Couldn't apply patch '%(patch)s'. Reason: %(reason)s"
msgstr ""
#: watcher/common/exception.py:286
msgid "'Keystone API endpoint is missing''"
msgstr ""
#: watcher/common/exception.py:290
msgid "The list of hypervisor(s) in the cluster is empty.'"
msgstr ""
#: watcher/common/exception.py:294
msgid "The metrics resource collector is not defined.'"
msgstr ""
#: watcher/common/exception.py:298
msgid "the cluster state is not defined"
msgstr ""
#: watcher/common/exception.py:304
msgid "The VM could not be found."
msgstr ""
#: watcher/common/exception.py:308
msgid "The hypervisor could not be found."
msgstr ""
#: watcher/common/exception.py:312
msgid "The Meta-Action could not be found."
msgstr ""
#: watcher/db/sqlalchemy/api.py:278
msgid "Cannot overwrite UUID for an existing AuditTemplate."
msgstr ""
#: watcher/db/sqlalchemy/api.py:387 watcher/db/sqlalchemy/api.py:587
msgid "Cannot overwrite UUID for an existing Audit."
msgstr ""
#: watcher/db/sqlalchemy/api.py:478
msgid "Cannot overwrite UUID for an existing Action."
msgstr ""
#: watcher/objects/base.py:108
msgid "Invalid version string"
msgstr ""
#: watcher/objects/base.py:299
#, python-format
msgid "Cannot load '%(attrname)s' in the base class"
msgstr ""
#: watcher/objects/base.py:308
msgid "Cannot save anything in the base class"
msgstr ""
#: watcher/objects/base.py:340
#, python-format
msgid "%(objname)s object has no attribute '%(attrname)s'"
msgstr ""
#: watcher/objects/base.py:389
#, python-format
msgid "'%(objclass)s' object has no attribute '%(attrname)s'"
msgstr ""
#: watcher/objects/utils.py:40
msgid "A datetime.datetime is required here"
msgstr ""
#: watcher/objects/utils.py:105
#, python-format
msgid "An object of class %s is required here"
msgstr ""

View File

@@ -0,0 +1,436 @@
# French translations for python-watcher.
# Copyright (C) 2015 ORGANIZATION
# This file is distributed under the same license as the python-watcher
# project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2015.
#
msgid ""
msgstr ""
"Project-Id-Version: python-watcher 0.21.1.dev32\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2015-12-18 15:33+0100\n"
"PO-Revision-Date: 2015-12-11 15:42+0100\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language: fr\n"
"Language-Team: fr <LL@li.org>\n"
"Plural-Forms: nplurals=2; plural=(n > 1)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.1.1\n"
#: watcher/api/controllers/v1/types.py:148
#, python-format
msgid "%s is not JSON serializable"
msgstr ""
#: watcher/api/controllers/v1/types.py:184
#, python-format
msgid "Wrong type. Expected '%(type)s', got '%(value)s'"
msgstr ""
#: watcher/api/controllers/v1/types.py:223
#, python-format
msgid "'%s' is an internal attribute and can not be updated"
msgstr ""
#: watcher/api/controllers/v1/types.py:227
#, python-format
msgid "'%s' is a mandatory attribute and can not be removed"
msgstr "'%s' est un attribut obligatoire et ne peut pas être enlevé"
#: watcher/api/controllers/v1/types.py:232
msgid "'add' and 'replace' operations needs value"
msgstr "Les opérations 'add' et 'replace' recquièrent une valeur"
#: watcher/api/controllers/v1/utils.py:36
msgid "Limit must be positive"
msgstr "Limit doit être positif"
#: watcher/api/controllers/v1/utils.py:47
#, python-format
msgid "Invalid sort direction: %s. Acceptable values are 'asc' or 'desc'"
msgstr ""
#: watcher/api/controllers/v1/utils.py:57
#, python-format
msgid "Adding a new attribute (%s) to the root of the resource is not allowed"
msgstr ""
#: watcher/api/middleware/auth_token.py:45
msgid "Cannot compile public API routes"
msgstr ""
#: watcher/api/middleware/parsable_error.py:52
#, python-format
msgid "ErrorDocumentMiddleware received an invalid status %s"
msgstr ""
#: watcher/applier/primitives/change_nova_service_state.py:74
msgid "The target state is not defined"
msgstr ""
#: watcher/cmd/api.py:46
#, python-format
msgid "Starting server in PID %s"
msgstr "Démarre le serveur avec pour PID %s"
#: watcher/cmd/api.py:51
#, python-format
msgid "serving on 0.0.0.0:%(port)s, view at http://127.0.0.1:%(port)s"
msgstr "Sert sur 0.0.0.0:%(port)s, accessible à http://127.0.0.1:%(port)s"
#: watcher/cmd/api.py:55
#, python-format
msgid "serving on http://%(host)s:%(port)s"
msgstr "Sert sur http://%(host)s:%(port)s"
#: watcher/common/exception.py:56
msgid "An unknown exception occurred"
msgstr ""
#: watcher/common/exception.py:107
msgid "Not authorized"
msgstr ""
#: watcher/common/exception.py:112
msgid "Operation not permitted"
msgstr ""
#: watcher/common/exception.py:116
msgid "Unacceptable parameters"
msgstr ""
#: watcher/common/exception.py:121
#, python-format
msgid "The %(name)s %(id)s could not be found"
msgstr ""
#: watcher/common/exception.py:125
#, fuzzy
msgid "Conflict"
msgstr "Conflit."
#: watcher/common/exception.py:130
#, python-format
msgid "The %(name)s resource %(id)s could not be found"
msgstr ""
#: watcher/common/exception.py:135
#, python-format
msgid "Expected an uuid or int but received %(identity)s"
msgstr ""
#: watcher/common/exception.py:139
#, python-format
msgid "Goal %(goal)s is not defined in Watcher configuration file"
msgstr ""
#: watcher/common/exception.py:145
#, python-format
msgid "%(err)s"
msgstr ""
#: watcher/common/exception.py:149
#, python-format
msgid "Expected a uuid but received %(uuid)s"
msgstr ""
#: watcher/common/exception.py:153
#, python-format
msgid "Expected a logical name but received %(name)s"
msgstr ""
#: watcher/common/exception.py:157
#, python-format
msgid "Expected a logical name or uuid but received %(name)s"
msgstr ""
#: watcher/common/exception.py:161
#, python-format
msgid "AuditTemplate %(audit_template)s could not be found"
msgstr ""
#: watcher/common/exception.py:165
#, python-format
msgid "An audit_template with UUID %(uuid)s or name %(name)s already exists"
msgstr ""
#: watcher/common/exception.py:170
#, python-format
msgid "AuditTemplate %(audit_template)s is referenced by one or multiple audit"
msgstr ""
#: watcher/common/exception.py:175
#, python-format
msgid "Audit %(audit)s could not be found"
msgstr ""
#: watcher/common/exception.py:179
#, python-format
msgid "An audit with UUID %(uuid)s already exists"
msgstr ""
#: watcher/common/exception.py:183
#, python-format
msgid "Audit %(audit)s is referenced by one or multiple action plans"
msgstr ""
#: watcher/common/exception.py:188
msgid "ActionPlan %(action plan)s could not be found"
msgstr ""
#: watcher/common/exception.py:192
#, python-format
msgid "An action plan with UUID %(uuid)s already exists"
msgstr ""
#: watcher/common/exception.py:196
#, python-format
msgid "Action Plan %(action_plan)s is referenced by one or multiple actions"
msgstr ""
#: watcher/common/exception.py:201
#, python-format
msgid "Action %(action)s could not be found"
msgstr ""
#: watcher/common/exception.py:205
#, python-format
msgid "An action with UUID %(uuid)s already exists"
msgstr ""
#: watcher/common/exception.py:209
#, python-format
msgid "Action plan %(action_plan)s is referenced by one or multiple goals"
msgstr ""
#: watcher/common/exception.py:214
msgid "Filtering actions on both audit and action-plan is prohibited"
msgstr ""
#: watcher/common/exception.py:223
#, python-format
msgid "Couldn't apply patch '%(patch)s'. Reason: %(reason)s"
msgstr ""
#: watcher/common/exception.py:233
msgid "Description must be an instance of str"
msgstr ""
#: watcher/common/exception.py:243
msgid "An exception occurred without a description"
msgstr ""
#: watcher/common/exception.py:251
msgid "Description cannot be empty"
msgstr ""
#: watcher/common/exception.py:260
msgid "No such metric"
msgstr ""
#: watcher/common/exception.py:269
msgid "No rows were returned"
msgstr ""
#: watcher/common/exception.py:277
msgid "'Keystone API endpoint is missing''"
msgstr ""
#: watcher/common/exception.py:281
msgid "The list of hypervisor(s) in the cluster is empty"
msgstr ""
#: watcher/common/exception.py:285
msgid "The metrics resource collector is not defined"
msgstr ""
#: watcher/common/exception.py:289
msgid "the cluster state is not defined"
msgstr ""
#: watcher/common/exception.py:295
msgid "The VM could not be found"
msgstr ""
#: watcher/common/exception.py:299
msgid "The hypervisor could not be found"
msgstr ""
#: watcher/common/exception.py:303
msgid "The Meta-Action could not be found"
msgstr ""
#: watcher/common/keystone.py:59
msgid "No Keystone service catalog loaded"
msgstr ""
#: watcher/db/sqlalchemy/api.py:256
msgid ""
"Multiple audit templates exist with the same name. Please use the audit "
"template uuid instead"
msgstr ""
#: watcher/db/sqlalchemy/api.py:277
msgid "Cannot overwrite UUID for an existing AuditTemplate."
msgstr ""
#: watcher/db/sqlalchemy/api.py:386 watcher/db/sqlalchemy/api.py:586
msgid "Cannot overwrite UUID for an existing Audit."
msgstr ""
#: watcher/db/sqlalchemy/api.py:477
msgid "Cannot overwrite UUID for an existing Action."
msgstr ""
#: watcher/db/sqlalchemy/migration.py:73
msgid ""
"Watcher database schema is already under version control; use upgrade() "
"instead"
msgstr ""
#: watcher/decision_engine/model/model_root.py:37
#: watcher/decision_engine/model/model_root.py:42
msgid "'obj' argument type is not valid"
msgstr ""
#: watcher/decision_engine/strategy/selection/default.py:56
#, python-format
msgid "Incorrect mapping: could not find associated strategy for '%s'"
msgstr ""
#: watcher/objects/base.py:108
msgid "Invalid version string"
msgstr ""
#: watcher/objects/base.py:299
#, python-format
msgid "Cannot load '%(attrname)s' in the base class"
msgstr ""
#: watcher/objects/base.py:308
msgid "Cannot save anything in the base class"
msgstr ""
#: watcher/objects/base.py:340
#, python-format
msgid "%(objname)s object has no attribute '%(attrname)s'"
msgstr ""
#: watcher/objects/base.py:390
#, python-format
msgid "'%(objclass)s' object has no attribute '%(attrname)s'"
msgstr ""
#: watcher/objects/utils.py:40
msgid "A datetime.datetime is required here"
msgstr ""
#: watcher/objects/utils.py:105
#, python-format
msgid "An object of class %s is required here"
msgstr ""
#~ msgid "Cannot compile public API routes: %s"
#~ msgstr ""
#~ msgid "An exception occurred without a description."
#~ msgstr ""
#~ msgid "no rows were returned"
#~ msgstr ""
#~ msgid ""
#~ msgstr ""
#~ msgid "An unknown exception occurred."
#~ msgstr ""
#~ msgid "Not authorized."
#~ msgstr ""
#~ msgid "Operation not permitted."
#~ msgstr ""
#~ msgid "Unacceptable parameters."
#~ msgstr ""
#~ msgid "The %(name)s %(id)s could not be found."
#~ msgstr ""
#~ msgid "The %(name)s resource %(id)s could not be found."
#~ msgstr ""
#~ msgid "Expected an uuid or int but received %(identity)s."
#~ msgstr ""
#~ msgid "Goal %(goal)s is not defined in Watcher configuration file."
#~ msgstr ""
#~ msgid "Expected a uuid but received %(uuid)s."
#~ msgstr ""
#~ msgid "Expected a logical name but received %(name)s."
#~ msgstr ""
#~ msgid "Expected a logical name or uuid but received %(name)s."
#~ msgstr ""
#~ msgid "AuditTemplate %(audit_template)s could not be found."
#~ msgstr ""
#~ msgid "An audit_template with UUID %(uuid)s or name %(name)s already exists."
#~ msgstr ""
#~ msgid "Audit %(audit)s could not be found."
#~ msgstr ""
#~ msgid "An audit with UUID %(uuid)s already exists."
#~ msgstr ""
#~ msgid "Audit %(audit)s is referenced by one or multiple action plans."
#~ msgstr ""
#~ msgid "ActionPlan %(action plan)s could not be found."
#~ msgstr ""
#~ msgid "An action plan with UUID %(uuid)s already exists."
#~ msgstr ""
#~ msgid "Action Plan %(action_plan)s is referenced by one or multiple actions."
#~ msgstr ""
#~ msgid "Action %(action)s could not be found."
#~ msgstr ""
#~ msgid "An action with UUID %(uuid)s already exists."
#~ msgstr ""
#~ msgid "Action plan %(action_plan)s is referenced by one or multiple goals."
#~ msgstr ""
#~ msgid "Filtering actions on both audit and action-plan is prohibited."
#~ msgstr ""
#~ msgid "The list of hypervisor(s) in the cluster is empty.'"
#~ msgstr ""
#~ msgid "The metrics resource collector is not defined.'"
#~ msgstr ""
#~ msgid "The VM could not be found."
#~ msgstr ""
#~ msgid "The hypervisor could not be found."
#~ msgstr ""
#~ msgid "The Meta-Action could not be found."
#~ msgstr ""
#~ msgid "'hypervisor' argument type is not valid"
#~ msgstr ""
#~ msgid "'vm' argument type is not valid"
#~ msgstr ""

View File

@@ -7,9 +7,9 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: python-watcher 0.21.1.dev32\n"
"Project-Id-Version: python-watcher 0.21.1.dev62\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2015-12-11 15:29+0100\n"
"POT-Creation-Date: 2015-12-18 15:33+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -28,227 +28,276 @@ msgstr ""
msgid "Wrong type. Expected '%(type)s', got '%(value)s'"
msgstr ""
#: watcher/api/controllers/v1/types.py:222
#: watcher/api/controllers/v1/types.py:223
#, python-format
msgid "'%s' is an internal attribute and can not be updated"
msgstr ""
#: watcher/api/controllers/v1/types.py:226
#: watcher/api/controllers/v1/types.py:227
#, python-format
msgid "'%s' is a mandatory attribute and can not be removed"
msgstr ""
#: watcher/api/controllers/v1/types.py:231
#: watcher/api/controllers/v1/types.py:232
msgid "'add' and 'replace' operations needs value"
msgstr ""
#: watcher/api/controllers/v1/utils.py:32
#: watcher/api/controllers/v1/utils.py:36
msgid "Limit must be positive"
msgstr ""
#: watcher/api/controllers/v1/utils.py:39
#: watcher/api/controllers/v1/utils.py:47
#, python-format
msgid "Invalid sort direction: %s. Acceptable values are 'asc' or 'desc'"
msgstr ""
#: watcher/api/controllers/v1/utils.py:49
#: watcher/api/controllers/v1/utils.py:57
#, python-format
msgid "Adding a new attribute (%s) to the root of the resource is not allowed"
msgstr ""
#: watcher/api/middleware/auth_token.py:43
#, python-format
msgid "Cannot compile public API routes: %s"
#: watcher/api/middleware/auth_token.py:45
msgid "Cannot compile public API routes"
msgstr ""
#: watcher/api/middleware/parsable_error.py:53
#: watcher/api/middleware/parsable_error.py:52
#, python-format
msgid "ErrorDocumentMiddleware received an invalid status %s"
msgstr ""
#: watcher/cmd/api.py:45
#: watcher/applier/primitives/change_nova_service_state.py:74
msgid "The target state is not defined"
msgstr ""
#: watcher/cmd/api.py:46
#, python-format
msgid "Starting server in PID %s"
msgstr ""
#: watcher/cmd/api.py:50
#: watcher/cmd/api.py:51
#, python-format
msgid "serving on 0.0.0.0:%(port)s, view at http://127.0.0.1:%(port)s"
msgstr ""
#: watcher/cmd/api.py:54
#: watcher/cmd/api.py:55
#, python-format
msgid "serving on http://%(host)s:%(port)s"
msgstr ""
#: watcher/common/exception.py:58
msgid "An unknown exception occurred."
#: watcher/common/exception.py:56
msgid "An unknown exception occurred"
msgstr ""
#: watcher/common/exception.py:109
msgid "Not authorized."
#: watcher/common/exception.py:107
msgid "Not authorized"
msgstr ""
#: watcher/common/exception.py:114
msgid "Operation not permitted."
#: watcher/common/exception.py:112
msgid "Operation not permitted"
msgstr ""
#: watcher/common/exception.py:118
msgid "Unacceptable parameters."
#: watcher/common/exception.py:116
msgid "Unacceptable parameters"
msgstr ""
#: watcher/common/exception.py:123
#: watcher/common/exception.py:121
#, python-format
msgid "The %(name)s %(id)s could not be found."
msgid "The %(name)s %(id)s could not be found"
msgstr ""
#: watcher/common/exception.py:127
msgid "Conflict."
#: watcher/common/exception.py:125
msgid "Conflict"
msgstr ""
#: watcher/common/exception.py:132
#: watcher/common/exception.py:130
#, python-format
msgid "The %(name)s resource %(id)s could not be found."
msgid "The %(name)s resource %(id)s could not be found"
msgstr ""
#: watcher/common/exception.py:137
#: watcher/common/exception.py:135
#, python-format
msgid "Expected an uuid or int but received %(identity)s."
msgid "Expected an uuid or int but received %(identity)s"
msgstr ""
#: watcher/common/exception.py:141
#: watcher/common/exception.py:139
#, python-format
msgid "Goal %(goal)s is not defined in Watcher configuration file."
msgid "Goal %(goal)s is not defined in Watcher configuration file"
msgstr ""
#: watcher/common/exception.py:147
#: watcher/common/exception.py:145
#, python-format
msgid "%(err)s"
msgstr ""
#: watcher/common/exception.py:151
#: watcher/common/exception.py:149
#, python-format
msgid "Expected a uuid but received %(uuid)s."
msgid "Expected a uuid but received %(uuid)s"
msgstr ""
#: watcher/common/exception.py:155
#: watcher/common/exception.py:153
#, python-format
msgid "Expected a logical name but received %(name)s."
msgid "Expected a logical name but received %(name)s"
msgstr ""
#: watcher/common/exception.py:159
#: watcher/common/exception.py:157
#, python-format
msgid "Expected a logical name or uuid but received %(name)s."
msgid "Expected a logical name or uuid but received %(name)s"
msgstr ""
#: watcher/common/exception.py:163
#: watcher/common/exception.py:161
#, python-format
msgid "AuditTemplate %(audit_template)s could not be found."
msgid "AuditTemplate %(audit_template)s could not be found"
msgstr ""
#: watcher/common/exception.py:167
#: watcher/common/exception.py:165
#, python-format
msgid "An audit_template with UUID %(uuid)s or name %(name)s already exists."
msgid "An audit_template with UUID %(uuid)s or name %(name)s already exists"
msgstr ""
#: watcher/common/exception.py:172
#: watcher/common/exception.py:170
#, python-format
msgid "AuditTemplate %(audit_template)s is referenced by one or multiple audit."
msgid "AuditTemplate %(audit_template)s is referenced by one or multiple audit"
msgstr ""
#: watcher/common/exception.py:177
#: watcher/common/exception.py:175
#, python-format
msgid "Audit %(audit)s could not be found."
msgid "Audit %(audit)s could not be found"
msgstr ""
#: watcher/common/exception.py:181
#: watcher/common/exception.py:179
#, python-format
msgid "An audit with UUID %(uuid)s already exists."
msgid "An audit with UUID %(uuid)s already exists"
msgstr ""
#: watcher/common/exception.py:185
#: watcher/common/exception.py:183
#, python-format
msgid "Audit %(audit)s is referenced by one or multiple action plans."
msgid "Audit %(audit)s is referenced by one or multiple action plans"
msgstr ""
#: watcher/common/exception.py:190
msgid "ActionPlan %(action plan)s could not be found."
#: watcher/common/exception.py:188
msgid "ActionPlan %(action plan)s could not be found"
msgstr ""
#: watcher/common/exception.py:194
#: watcher/common/exception.py:192
#, python-format
msgid "An action plan with UUID %(uuid)s already exists."
msgid "An action plan with UUID %(uuid)s already exists"
msgstr ""
#: watcher/common/exception.py:198
#: watcher/common/exception.py:196
#, python-format
msgid "Action Plan %(action_plan)s is referenced by one or multiple actions."
msgid "Action Plan %(action_plan)s is referenced by one or multiple actions"
msgstr ""
#: watcher/common/exception.py:203
#: watcher/common/exception.py:201
#, python-format
msgid "Action %(action)s could not be found."
msgid "Action %(action)s could not be found"
msgstr ""
#: watcher/common/exception.py:207
#: watcher/common/exception.py:205
#, python-format
msgid "An action with UUID %(uuid)s already exists."
msgid "An action with UUID %(uuid)s already exists"
msgstr ""
#: watcher/common/exception.py:211
#: watcher/common/exception.py:209
#, python-format
msgid "Action plan %(action_plan)s is referenced by one or multiple goals."
msgid "Action plan %(action_plan)s is referenced by one or multiple goals"
msgstr ""
#: watcher/common/exception.py:216
msgid "Filtering actions on both audit and action-plan is prohibited."
#: watcher/common/exception.py:214
msgid "Filtering actions on both audit and action-plan is prohibited"
msgstr ""
#: watcher/common/exception.py:225
#: watcher/common/exception.py:223
#, python-format
msgid "Couldn't apply patch '%(patch)s'. Reason: %(reason)s"
msgstr ""
#: watcher/common/exception.py:286
#: watcher/common/exception.py:233
msgid "Description must be an instance of str"
msgstr ""
#: watcher/common/exception.py:243
msgid "An exception occurred without a description"
msgstr ""
#: watcher/common/exception.py:251
msgid "Description cannot be empty"
msgstr ""
#: watcher/common/exception.py:260
msgid "No such metric"
msgstr ""
#: watcher/common/exception.py:269
msgid "No rows were returned"
msgstr ""
#: watcher/common/exception.py:277
msgid "'Keystone API endpoint is missing''"
msgstr ""
#: watcher/common/exception.py:290
msgid "The list of hypervisor(s) in the cluster is empty.'"
#: watcher/common/exception.py:281
msgid "The list of hypervisor(s) in the cluster is empty"
msgstr ""
#: watcher/common/exception.py:294
msgid "The metrics resource collector is not defined.'"
#: watcher/common/exception.py:285
msgid "The metrics resource collector is not defined"
msgstr ""
#: watcher/common/exception.py:298
#: watcher/common/exception.py:289
msgid "the cluster state is not defined"
msgstr ""
#: watcher/common/exception.py:304
msgid "The VM could not be found."
#: watcher/common/exception.py:295
msgid "The VM could not be found"
msgstr ""
#: watcher/common/exception.py:308
msgid "The hypervisor could not be found."
#: watcher/common/exception.py:299
msgid "The hypervisor could not be found"
msgstr ""
#: watcher/common/exception.py:312
msgid "The Meta-Action could not be found."
#: watcher/common/exception.py:303
msgid "The Meta-Action could not be found"
msgstr ""
#: watcher/db/sqlalchemy/api.py:278
#: watcher/common/keystone.py:59
msgid "No Keystone service catalog loaded"
msgstr ""
#: watcher/db/sqlalchemy/api.py:256
msgid ""
"Multiple audit templates exist with the same name. Please use the audit "
"template uuid instead"
msgstr ""
#: watcher/db/sqlalchemy/api.py:277
msgid "Cannot overwrite UUID for an existing AuditTemplate."
msgstr ""
#: watcher/db/sqlalchemy/api.py:387 watcher/db/sqlalchemy/api.py:587
#: watcher/db/sqlalchemy/api.py:386 watcher/db/sqlalchemy/api.py:586
msgid "Cannot overwrite UUID for an existing Audit."
msgstr ""
#: watcher/db/sqlalchemy/api.py:478
#: watcher/db/sqlalchemy/api.py:477
msgid "Cannot overwrite UUID for an existing Action."
msgstr ""
#: watcher/db/sqlalchemy/migration.py:73
msgid ""
"Watcher database schema is already under version control; use upgrade() "
"instead"
msgstr ""
#: watcher/decision_engine/model/model_root.py:37
#: watcher/decision_engine/model/model_root.py:42
msgid "'obj' argument type is not valid"
msgstr ""
#: watcher/decision_engine/strategy/selection/default.py:56
#, python-format
msgid "Incorrect mapping: could not find associated strategy for '%s'"
msgstr ""
#: watcher/objects/base.py:108
msgid "Invalid version string"
msgstr ""
@@ -267,7 +316,7 @@ msgstr ""
msgid "%(objname)s object has no attribute '%(attrname)s'"
msgstr ""
#: watcher/objects/base.py:389
#: watcher/objects/base.py:390
#, python-format
msgid "'%(objclass)s' object has no attribute '%(attrname)s'"
msgstr ""