From 0c348313a48f40a6b3ae5485bf0d9fa28e784990 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 12 Nov 2015 11:45:50 +0800 Subject: [PATCH] Use olso.log directly As the openstack/common is deprecated, Watcher should use oslo lib directly to run in the openstack env. So there is much work to do with oslo. This patch fixed the log part. Change-Id: I3145a842fe3a22b3d08fec60d180329073edd50f --- requirements.txt | 2 +- watcher/api/middleware/auth_token.py | 3 +- watcher/api/middleware/parsable_error.py | 3 +- .../framework/command/wrapper/nova_wrapper.py | 3 +- watcher/applier/framework/command_executor.py | 3 +- watcher/applier/framework/deploy_phase.py | 3 +- watcher/applier/framework/manager_applier.py | 2 +- .../framework/messaging/launch_action_plan.py | 4 +-- .../messaging/trigger_action_plan.py | 2 +- watcher/applier/framework/rpcapi.py | 2 +- watcher/cmd/api.py | 5 +-- watcher/cmd/applier.py | 7 +++-- watcher/cmd/decisionengine.py | 5 +-- watcher/common/exception.py | 3 +- .../messaging/events/event_dispatcher.py | 2 +- watcher/common/messaging/messaging_core.py | 3 +- watcher/common/messaging/messaging_handler.py | 2 +- .../common/messaging/notification_handler.py | 2 +- watcher/common/messaging/utils/observable.py | 2 +- .../messaging/utils/transport_url_builder.py | 2 +- watcher/common/service.py | 31 ++++++++----------- watcher/common/utils.py | 2 +- watcher/db/sqlalchemy/api.py | 2 +- .../command/trigger_audit_command.py | 2 +- .../framework/default_planner.py | 2 +- .../framework/default_solution.py | 2 +- .../framework/manager_decision_engine.py | 2 +- .../framework/messaging/audit_endpoint.py | 3 +- .../framework/model/mapping.py | 3 +- .../framework/model/model_root.py | 2 +- watcher/decision_engine/framework/rpcapi.py | 3 +- .../framework/strategy/StrategyManagerImpl.py | 2 +- .../framework/strategy/strategy_loader.py | 2 +- .../framework/strategy/strategy_selector.py | 2 +- .../strategies/basic_consolidation.py | 3 +- .../strategies/dummy_strategy.py | 2 +- .../framework/collector_manager.py | 2 +- .../datasources/influxdb_collector.py | 2 +- .../framework/statedb_collector.py | 3 +- watcher/objects/base.py | 2 +- watcher/opts.py | 10 +++--- 41 files changed, 74 insertions(+), 70 deletions(-) diff --git a/requirements.txt b/requirements.txt index dddeb8c88..8809ec1ca 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,7 +7,7 @@ oslo.config==1.14.0 PasteDeploy==1.5.2 oslo.messaging==1.16.0 oslo.db==2.1.0 -oslo.log==1.6.0 +oslo.log>=1.8.0 # Apache-2.0 oslo.i18n==2.1.0 oslo.utils==1.8.0 # Apache-2.0 pecan>=0.8 diff --git a/watcher/api/middleware/auth_token.py b/watcher/api/middleware/auth_token.py index 6a2c1b649..e49c7dacf 100644 --- a/watcher/api/middleware/auth_token.py +++ b/watcher/api/middleware/auth_token.py @@ -15,12 +15,13 @@ import re +from oslo_log import log + from keystonemiddleware import auth_token from watcher.common import exception from watcher.common.i18n import _ from watcher.common import utils -from watcher.openstack.common import log LOG = log.getLogger(__name__) diff --git a/watcher/api/middleware/parsable_error.py b/watcher/api/middleware/parsable_error.py index 24307ea87..82864d8df 100644 --- a/watcher/api/middleware/parsable_error.py +++ b/watcher/api/middleware/parsable_error.py @@ -26,9 +26,10 @@ from xml import etree as et import webob +from oslo_log import log + from watcher.common.i18n import _ from watcher.common.i18n import _LE -from watcher.openstack.common import log LOG = log.getLogger(__name__) diff --git a/watcher/applier/framework/command/wrapper/nova_wrapper.py b/watcher/applier/framework/command/wrapper/nova_wrapper.py index c4d1f14a4..e0bb40d5f 100644 --- a/watcher/applier/framework/command/wrapper/nova_wrapper.py +++ b/watcher/applier/framework/command/wrapper/nova_wrapper.py @@ -20,6 +20,8 @@ import random import time +from oslo_log import log + import cinderclient.exceptions as ciexceptions import cinderclient.v2.client as ciclient import glanceclient.v2.client as glclient @@ -27,7 +29,6 @@ import keystoneclient.v3.client as ksclient import neutronclient.neutron.client as netclient import novaclient.exceptions as nvexceptions import novaclient.v2.client as nvclient -from watcher.openstack.common import log LOG = log.getLogger(__name__) diff --git a/watcher/applier/framework/command_executor.py b/watcher/applier/framework/command_executor.py index 4133999fa..b313a75b1 100644 --- a/watcher/applier/framework/command_executor.py +++ b/watcher/applier/framework/command_executor.py @@ -16,6 +16,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from oslo_log import log + from watcher.applier.framework.default_command_mapper import \ DefaultCommandMapper @@ -24,7 +26,6 @@ from watcher.applier.framework.messaging.events import Events from watcher.common.messaging.events.event import Event from watcher.objects import Action from watcher.objects.action_plan import Status -from watcher.openstack.common import log LOG = log.getLogger(__name__) diff --git a/watcher/applier/framework/deploy_phase.py b/watcher/applier/framework/deploy_phase.py index faf4d86ae..93aa121ce 100644 --- a/watcher/applier/framework/deploy_phase.py +++ b/watcher/applier/framework/deploy_phase.py @@ -16,7 +16,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from watcher.openstack.common import log +from oslo_log import log + LOG = log.getLogger(__name__) diff --git a/watcher/applier/framework/manager_applier.py b/watcher/applier/framework/manager_applier.py index 23da68353..303b08b0a 100644 --- a/watcher/applier/framework/manager_applier.py +++ b/watcher/applier/framework/manager_applier.py @@ -19,13 +19,13 @@ from concurrent.futures import ThreadPoolExecutor from oslo_config import cfg +from oslo_log import log from watcher.applier.framework.messaging.trigger_action_plan import \ TriggerActionPlan from watcher.common.messaging.messaging_core import MessagingCore from watcher.common.messaging.notification_handler import NotificationHandler from watcher.decision_engine.framework.messaging.events import Events -from watcher.openstack.common import log CONF = cfg.CONF diff --git a/watcher/applier/framework/messaging/launch_action_plan.py b/watcher/applier/framework/messaging/launch_action_plan.py index 06f99d186..3548069aa 100644 --- a/watcher/applier/framework/messaging/launch_action_plan.py +++ b/watcher/applier/framework/messaging/launch_action_plan.py @@ -16,6 +16,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from oslo_log import log + from watcher.applier.api.messaging.applier_command import ApplierCommand from watcher.applier.framework.default_applier import DefaultApplier from watcher.applier.framework.messaging.events import Events @@ -23,8 +25,6 @@ from watcher.common.messaging.events.event import Event from watcher.objects.action_plan import ActionPlan from watcher.objects.action_plan import Status -from watcher.openstack.common import log - LOG = log.getLogger(__name__) diff --git a/watcher/applier/framework/messaging/trigger_action_plan.py b/watcher/applier/framework/messaging/trigger_action_plan.py index fc53b719d..3a5925094 100644 --- a/watcher/applier/framework/messaging/trigger_action_plan.py +++ b/watcher/applier/framework/messaging/trigger_action_plan.py @@ -16,10 +16,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from oslo_log import log from watcher.applier.framework.messaging.launch_action_plan import \ LaunchActionPlanCommand -from watcher.openstack.common import log LOG = log.getLogger(__name__) diff --git a/watcher/applier/framework/rpcapi.py b/watcher/applier/framework/rpcapi.py index 2d4672931..4368f5faf 100644 --- a/watcher/applier/framework/rpcapi.py +++ b/watcher/applier/framework/rpcapi.py @@ -17,6 +17,7 @@ # limitations under the License. # from oslo_config import cfg +from oslo_log import log import oslo_messaging as om @@ -30,7 +31,6 @@ from watcher.common.messaging.messaging_core import MessagingCore from watcher.common.messaging.notification_handler import NotificationHandler from watcher.common.messaging.utils.transport_url_builder import \ TransportUrlBuilder -from watcher.openstack.common import log LOG = log.getLogger(__name__) CONF = cfg.CONF diff --git a/watcher/cmd/api.py b/watcher/cmd/api.py index 9f71201ec..7e4146be8 100644 --- a/watcher/cmd/api.py +++ b/watcher/cmd/api.py @@ -22,14 +22,15 @@ import os from wsgiref import simple_server from oslo_config import cfg +from oslo_log import log as logging from watcher.api import app as api_app from watcher.common.i18n import _ -from watcher.openstack.common import log as logging from watcher import service LOG = logging.getLogger(__name__) +CONF = cfg.CONF def main(): @@ -41,7 +42,7 @@ def main(): host, port = cfg.CONF.api.host, cfg.CONF.api.port srv = simple_server.make_server(host, port, app) - logging.setup('watcher') + logging.setup(CONF, 'watcher') LOG.info(_('Starting server in PID %s') % os.getpid()) LOG.debug("Watcher configuration:") cfg.CONF.log_opt_values(LOG, std_logging.DEBUG) diff --git a/watcher/cmd/applier.py b/watcher/cmd/applier.py index a17666969..a69f40fb4 100644 --- a/watcher/cmd/applier.py +++ b/watcher/cmd/applier.py @@ -22,18 +22,19 @@ import os import sys from oslo_config import cfg +from oslo_log import log as logging + from watcher.applier.framework.manager_applier import ApplierManager from watcher.openstack.common._i18n import _LI -from watcher.openstack.common import log as logging - LOG = logging.getLogger(__name__) +CONF = cfg.CONF def main(): cfg.CONF(sys.argv[1:], project='watcher') - logging.setup('watcher') + logging.setup(CONF, 'watcher') LOG.info(_LI('Starting server in PID %s') % os.getpid()) LOG.debug("Configuration:") diff --git a/watcher/cmd/decisionengine.py b/watcher/cmd/decisionengine.py index 7f6d70300..16e6024f7 100644 --- a/watcher/cmd/decisionengine.py +++ b/watcher/cmd/decisionengine.py @@ -22,22 +22,23 @@ import os import sys from oslo_config import cfg +from oslo_log import log as logging from watcher.decision_engine.framework.manager_decision_engine import \ DecisionEngineManager from watcher.openstack.common._i18n import _LI -from watcher.openstack.common import log as logging cfg.CONF.import_opt('hostname', 'watcher.metrics_engine.framework.' 'datasources.influxdb_collector', group='watcher_influxdb_collector') LOG = logging.getLogger(__name__) +CONF = cfg.CONF def main(): cfg.CONF(sys.argv[1:], project='watcher') - logging.setup('watcher') + logging.setup(CONF, 'watcher') LOG.info(_LI('Starting server in PID %s') % os.getpid()) LOG.debug("Configuration:") diff --git a/watcher/common/exception.py b/watcher/common/exception.py index f93ee24a5..31f2bd600 100644 --- a/watcher/common/exception.py +++ b/watcher/common/exception.py @@ -23,11 +23,12 @@ SHOULD include dedicated exception logging. """ from oslo_config import cfg +from oslo_log import log as logging + import six from watcher.common.i18n import _ from watcher.common.i18n import _LE -from watcher.openstack.common import log as logging LOG = logging.getLogger(__name__) diff --git a/watcher/common/messaging/events/event_dispatcher.py b/watcher/common/messaging/events/event_dispatcher.py index a6ea19611..f8b6686f4 100644 --- a/watcher/common/messaging/events/event_dispatcher.py +++ b/watcher/common/messaging/events/event_dispatcher.py @@ -14,9 +14,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +from oslo_log import log from watcher.decision_engine.framework.messaging.events import Events -from watcher.openstack.common import log LOG = log.getLogger(__name__) diff --git a/watcher/common/messaging/messaging_core.py b/watcher/common/messaging/messaging_core.py index 664e2518a..4fe9f5192 100644 --- a/watcher/common/messaging/messaging_core.py +++ b/watcher/common/messaging/messaging_core.py @@ -16,7 +16,7 @@ from oslo_config import cfg - +from oslo_log import log from watcher.common.messaging.events.event_dispatcher import \ EventDispatcher from watcher.common.messaging.messaging_handler import \ @@ -24,7 +24,6 @@ from watcher.common.messaging.messaging_handler import \ from watcher.common.rpc import RequestContextSerializer from watcher.objects.base import WatcherObjectSerializer -from watcher.openstack.common import log LOG = log.getLogger(__name__) CONF = cfg.CONF diff --git a/watcher/common/messaging/messaging_handler.py b/watcher/common/messaging/messaging_handler.py index 657a8c5a0..b283f2933 100644 --- a/watcher/common/messaging/messaging_handler.py +++ b/watcher/common/messaging/messaging_handler.py @@ -16,13 +16,13 @@ import eventlet from oslo_config import cfg +from oslo_log import log import oslo_messaging as om from threading import Thread from watcher.common.messaging.utils.transport_url_builder import \ TransportUrlBuilder from watcher.common.rpc import JsonPayloadSerializer from watcher.common.rpc import RequestContextSerializer -from watcher.openstack.common import log eventlet.monkey_patch() LOG = log.getLogger(__name__) diff --git a/watcher/common/messaging/notification_handler.py b/watcher/common/messaging/notification_handler.py index 80cb1c7d9..d5985a0f7 100644 --- a/watcher/common/messaging/notification_handler.py +++ b/watcher/common/messaging/notification_handler.py @@ -16,10 +16,10 @@ import eventlet from oslo import messaging +from oslo_log import log from watcher.common.messaging.utils.observable import \ Observable -from watcher.openstack.common import log eventlet.monkey_patch() diff --git a/watcher/common/messaging/utils/observable.py b/watcher/common/messaging/utils/observable.py index f51a97b02..07f4582e7 100644 --- a/watcher/common/messaging/utils/observable.py +++ b/watcher/common/messaging/utils/observable.py @@ -14,10 +14,10 @@ # See the License for the specific language governing permissions and # limitations under the License. +from oslo_log import log from watcher.common.messaging.utils.synchronization import \ Synchronization -from watcher.openstack.common import log LOG = log.getLogger(__name__) diff --git a/watcher/common/messaging/utils/transport_url_builder.py b/watcher/common/messaging/utils/transport_url_builder.py index 434f78f2c..62791a2af 100644 --- a/watcher/common/messaging/utils/transport_url_builder.py +++ b/watcher/common/messaging/utils/transport_url_builder.py @@ -15,7 +15,7 @@ # limitations under the License. from oslo_config import cfg -from watcher.openstack.common import log +from oslo_log import log LOG = log.getLogger(__name__) CONF = cfg.CONF diff --git a/watcher/common/service.py b/watcher/common/service.py index 6b4e9bdfb..b9ab49b87 100644 --- a/watcher/common/service.py +++ b/watcher/common/service.py @@ -19,6 +19,8 @@ import socket from oslo import messaging from oslo_config import cfg +from oslo_log import _options +from oslo_log import log from oslo_utils import importutils from watcher.common import config @@ -27,7 +29,6 @@ from watcher.common.i18n import _LI from watcher.common import rpc from watcher.objects import base as objects_base from watcher.openstack.common import context -from watcher.openstack.common import log from watcher.openstack.common import service @@ -115,22 +116,16 @@ class RPCService(service.Service): signal.signal(signal.SIGUSR1, self._handle_signal) +_DEFAULT_LOG_LEVELS = ['amqp=WARN', 'amqplib=WARN', 'qpid.messaging=INFO', + 'oslo.messaging=INFO', 'sqlalchemy=WARN', + 'keystoneclient=INFO', 'stevedore=INFO', + 'eventlet.wsgi.server=WARN', 'iso8601=WARN', + 'paramiko=WARN', 'requests=WARN', 'neutronclient=WARN', + 'glanceclient=WARN', 'watcher.openstack.common=WARN'] + + def prepare_service(argv=[]): config.parse_args(argv) - cfg.set_defaults(log.log_opts, - default_log_levels=['amqp=WARN', - 'amqplib=WARN', - 'qpid.messaging=INFO', - 'oslo.messaging=INFO', - 'sqlalchemy=WARN', - 'keystoneclient=INFO', - 'stevedore=INFO', - 'eventlet.wsgi.server=WARN', - 'iso8601=WARN', - 'paramiko=WARN', - 'requests=WARN', - 'neutronclient=WARN', - 'glanceclient=WARN', - 'watcher.openstack.common=WARN', - ]) - log.setup('watcher') + cfg.set_defaults(_options.log_opts, + default_log_levels=_DEFAULT_LOG_LEVELS) + log.setup(cfg.CONF, 'watcher') diff --git a/watcher/common/utils.py b/watcher/common/utils.py index 34edc6198..c71eb4de7 100644 --- a/watcher/common/utils.py +++ b/watcher/common/utils.py @@ -17,6 +17,7 @@ """Utilities and helper functions.""" from oslo_config import cfg +from oslo_log import log as logging import re import six @@ -24,7 +25,6 @@ import uuid from watcher.common.i18n import _LW -from watcher.openstack.common import log as logging UTILS_OPTS = [ cfg.StrOpt('rootwrap_config', diff --git a/watcher/db/sqlalchemy/api.py b/watcher/db/sqlalchemy/api.py index 4348d96cf..d5d83b22f 100644 --- a/watcher/db/sqlalchemy/api.py +++ b/watcher/db/sqlalchemy/api.py @@ -21,6 +21,7 @@ from oslo_config import cfg 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 @@ -30,7 +31,6 @@ from watcher.db import api from watcher.db.sqlalchemy import models from watcher.objects.audit import AuditStatus from watcher.openstack.common._i18n import _ -from watcher.openstack.common import log CONF = cfg.CONF diff --git a/watcher/decision_engine/framework/command/trigger_audit_command.py b/watcher/decision_engine/framework/command/trigger_audit_command.py index 6fd49dbc0..de8ee1d94 100644 --- a/watcher/decision_engine/framework/command/trigger_audit_command.py +++ b/watcher/decision_engine/framework/command/trigger_audit_command.py @@ -13,6 +13,7 @@ # implied. # See the License for the specific language governing permissions and # limitations under the License. +from oslo_log import log from watcher.common.messaging.events.event import Event from watcher.decision_engine.api.messaging.decision_engine_command import \ @@ -24,7 +25,6 @@ from watcher.decision_engine.framework.strategy.StrategyManagerImpl import \ from watcher.objects.audit import Audit from watcher.objects.audit import AuditStatus from watcher.objects.audit_template import AuditTemplate -from watcher.openstack.common import log LOG = log.getLogger(__name__) diff --git a/watcher/decision_engine/framework/default_planner.py b/watcher/decision_engine/framework/default_planner.py index ed003948a..16061cb04 100644 --- a/watcher/decision_engine/framework/default_planner.py +++ b/watcher/decision_engine/framework/default_planner.py @@ -16,6 +16,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from oslo_log import log from enum import Enum from watcher.common.exception import MetaActionNotFound @@ -31,7 +32,6 @@ from watcher.decision_engine.framework.meta_actions.power_state import \ ChangePowerState from watcher.objects.action import Status as AStatus from watcher.objects.action_plan import Status as APStatus -from watcher.openstack.common import log LOG = log.getLogger(__name__) diff --git a/watcher/decision_engine/framework/default_solution.py b/watcher/decision_engine/framework/default_solution.py index 2824f9c82..b86fddb53 100644 --- a/watcher/decision_engine/framework/default_solution.py +++ b/watcher/decision_engine/framework/default_solution.py @@ -16,8 +16,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from oslo_log import log from watcher.decision_engine.api.solution.solution import Solution -from watcher.openstack.common import log LOG = log.getLogger(__name__) diff --git a/watcher/decision_engine/framework/manager_decision_engine.py b/watcher/decision_engine/framework/manager_decision_engine.py index b55cade6b..48bba745c 100644 --- a/watcher/decision_engine/framework/manager_decision_engine.py +++ b/watcher/decision_engine/framework/manager_decision_engine.py @@ -19,6 +19,7 @@ from concurrent.futures import ThreadPoolExecutor from oslo_config import cfg +from oslo_log import log from watcher.decision_engine.framework.events.event_consumer_factory import \ EventConsumerFactory @@ -33,7 +34,6 @@ from watcher.common.messaging.notification_handler import \ NotificationHandler from watcher.decision_engine.framework.strategy.StrategyManagerImpl import \ StrategyContextImpl -from watcher.openstack.common import log LOG = log.getLogger(__name__) CONF = cfg.CONF diff --git a/watcher/decision_engine/framework/messaging/audit_endpoint.py b/watcher/decision_engine/framework/messaging/audit_endpoint.py index a6950a899..63b5a6f65 100644 --- a/watcher/decision_engine/framework/messaging/audit_endpoint.py +++ b/watcher/decision_engine/framework/messaging/audit_endpoint.py @@ -16,10 +16,11 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from oslo_log import log + from watcher.decision_engine.framework.command.trigger_audit_command import \ TriggerAuditCommand from watcher.metrics_engine.framework.collector_manager import CollectorManager -from watcher.openstack.common import log LOG = log.getLogger(__name__) diff --git a/watcher/decision_engine/framework/model/mapping.py b/watcher/decision_engine/framework/model/mapping.py index 5bef6b1be..ed8bc94c5 100644 --- a/watcher/decision_engine/framework/model/mapping.py +++ b/watcher/decision_engine/framework/model/mapping.py @@ -13,10 +13,9 @@ # implied. # See the License for the specific language governing permissions and # limitations under the License. +from oslo_log import log from threading import Lock -from watcher.openstack.common import log - LOG = log.getLogger(__name__) diff --git a/watcher/decision_engine/framework/model/model_root.py b/watcher/decision_engine/framework/model/model_root.py index c1dd3af21..396cebee1 100644 --- a/watcher/decision_engine/framework/model/model_root.py +++ b/watcher/decision_engine/framework/model/model_root.py @@ -13,6 +13,7 @@ # implied. # See the License for the specific language governing permissions and # limitations under the License. +from oslo_log import log from watcher.common.exception import HypervisorNotFound from watcher.common.exception import IllegalArgumentException @@ -20,7 +21,6 @@ from watcher.common.exception import VMNotFound from watcher.decision_engine.framework.model.hypervisor import Hypervisor from watcher.decision_engine.framework.model.mapping import Mapping from watcher.decision_engine.framework.model.vm import VM -from watcher.openstack.common import log LOG = log.getLogger(__name__) diff --git a/watcher/decision_engine/framework/rpcapi.py b/watcher/decision_engine/framework/rpcapi.py index 1c16a849a..b60535f40 100644 --- a/watcher/decision_engine/framework/rpcapi.py +++ b/watcher/decision_engine/framework/rpcapi.py @@ -19,6 +19,7 @@ from oslo_config import cfg +from oslo_log import log import oslo_messaging as om from watcher.common import exception @@ -38,8 +39,6 @@ from watcher.decision_engine.framework.manager_decision_engine import \ from watcher.decision_engine.framework.messaging.events import Events -from watcher.openstack.common import log - LOG = log.getLogger(__name__) CONF = cfg.CONF diff --git a/watcher/decision_engine/framework/strategy/StrategyManagerImpl.py b/watcher/decision_engine/framework/strategy/StrategyManagerImpl.py index 30d056e35..4c01cae0f 100644 --- a/watcher/decision_engine/framework/strategy/StrategyManagerImpl.py +++ b/watcher/decision_engine/framework/strategy/StrategyManagerImpl.py @@ -13,13 +13,13 @@ # implied. # See the License for the specific language governing permissions and # limitations under the License. +from oslo_log import log from watcher.decision_engine.api.strategy.strategy_context import \ StrategyContext from watcher.decision_engine.framework.default_planner import DefaultPlanner from watcher.decision_engine.framework.strategy.strategy_selector import \ StrategySelector -from watcher.openstack.common import log LOG = log.getLogger(__name__) diff --git a/watcher/decision_engine/framework/strategy/strategy_loader.py b/watcher/decision_engine/framework/strategy/strategy_loader.py index b9a23bff0..e20f56f04 100644 --- a/watcher/decision_engine/framework/strategy/strategy_loader.py +++ b/watcher/decision_engine/framework/strategy/strategy_loader.py @@ -17,10 +17,10 @@ # limitations under the License. # from oslo_config import cfg +from oslo_log import log from stevedore import driver from watcher.decision_engine.strategies.basic_consolidation import \ BasicConsolidation -from watcher.openstack.common import log LOG = log.getLogger(__name__) CONF = cfg.CONF diff --git a/watcher/decision_engine/framework/strategy/strategy_selector.py b/watcher/decision_engine/framework/strategy/strategy_selector.py index 79205489a..f25054464 100644 --- a/watcher/decision_engine/framework/strategy/strategy_selector.py +++ b/watcher/decision_engine/framework/strategy/strategy_selector.py @@ -15,11 +15,11 @@ # limitations under the License. from oslo_config import cfg +from oslo_log import log from watcher.decision_engine.api.strategy.selector import Selector from watcher.decision_engine.framework.strategy.strategy_loader import \ StrategyLoader from watcher.objects.audit_template import Goal -from watcher.openstack.common import log LOG = log.getLogger(__name__) CONF = cfg.CONF diff --git a/watcher/decision_engine/strategies/basic_consolidation.py b/watcher/decision_engine/strategies/basic_consolidation.py index 22e60395c..867ca02fe 100644 --- a/watcher/decision_engine/strategies/basic_consolidation.py +++ b/watcher/decision_engine/strategies/basic_consolidation.py @@ -16,6 +16,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from oslo_log import log + from watcher.decision_engine.framework.model.vm_state import VMState from watcher.metrics_engine.api.metrics_resource_collector import \ AggregationFunction @@ -38,7 +40,6 @@ from watcher.decision_engine.framework.meta_actions.power_state import \ from watcher.decision_engine.framework.model.hypervisor_state import \ HypervisorState from watcher.decision_engine.framework.model.resource import ResourceType -from watcher.openstack.common import log LOG = log.getLogger(__name__) diff --git a/watcher/decision_engine/strategies/dummy_strategy.py b/watcher/decision_engine/strategies/dummy_strategy.py index 96ce874b4..14a83870e 100644 --- a/watcher/decision_engine/strategies/dummy_strategy.py +++ b/watcher/decision_engine/strategies/dummy_strategy.py @@ -16,9 +16,9 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from oslo_log import log from watcher.decision_engine.api.strategy.strategy import Strategy -from watcher.openstack.common import log LOG = log.getLogger(__name__) diff --git a/watcher/metrics_engine/framework/collector_manager.py b/watcher/metrics_engine/framework/collector_manager.py index 4acde9136..73ae94aea 100644 --- a/watcher/metrics_engine/framework/collector_manager.py +++ b/watcher/metrics_engine/framework/collector_manager.py @@ -20,11 +20,11 @@ from keystoneclient.auth.identity import v3 from keystoneclient import session from oslo_config import cfg +from oslo_log import log from stevedore import driver from watcher.applier.framework.command.wrapper.nova_wrapper import NovaWrapper from watcher.metrics_engine.framework.statedb_collector import NovaCollector -from watcher.openstack.common import log LOG = log.getLogger(__name__) CONF = cfg.CONF diff --git a/watcher/metrics_engine/framework/datasources/influxdb_collector.py b/watcher/metrics_engine/framework/datasources/influxdb_collector.py index 44d40ebed..99467a5de 100644 --- a/watcher/metrics_engine/framework/datasources/influxdb_collector.py +++ b/watcher/metrics_engine/framework/datasources/influxdb_collector.py @@ -23,6 +23,7 @@ import parsedatetime from influxdb import InfluxDBClient from oslo_config import cfg +from oslo_log import log from watcher.metrics_engine.api.metrics_resource_collector import \ AggregationFunction from watcher.metrics_engine.api.metrics_resource_collector import Measure @@ -33,7 +34,6 @@ from watcher.metrics_engine.framework.datasources.sql_ast.build_db_query import from watcher.metrics_engine.framework.datasources.sql_ast.sql_ast import And from watcher.metrics_engine.framework.datasources.sql_ast.sql_ast import \ Condition -from watcher.openstack.common import log LOG = log.getLogger(__name__) CONF = cfg.CONF diff --git a/watcher/metrics_engine/framework/statedb_collector.py b/watcher/metrics_engine/framework/statedb_collector.py index 2f05fe8d6..4d00fac09 100644 --- a/watcher/metrics_engine/framework/statedb_collector.py +++ b/watcher/metrics_engine/framework/statedb_collector.py @@ -19,6 +19,8 @@ from oslo_config import cfg +from oslo_log import log + from watcher.decision_engine.framework.model.hypervisor import Hypervisor from watcher.decision_engine.framework.model.model_root import ModelRoot from watcher.decision_engine.framework.model.resource import Resource @@ -26,7 +28,6 @@ from watcher.decision_engine.framework.model.resource import ResourceType from watcher.decision_engine.framework.model.vm import VM from watcher.metrics_engine.api.cluster_state_collector import \ ClusterStateCollector -from watcher.openstack.common import log CONF = cfg.CONF LOG = log.getLogger(__name__) diff --git a/watcher/objects/base.py b/watcher/objects/base.py index e041e795b..bb155b604 100644 --- a/watcher/objects/base.py +++ b/watcher/objects/base.py @@ -17,6 +17,7 @@ import collections import copy +from oslo_log import log as logging import oslo_messaging as messaging import six @@ -24,7 +25,6 @@ from watcher.common import exception from watcher.common.i18n import _ from watcher.common.i18n import _LE from watcher.objects import utils as obj_utils -from watcher.openstack.common import log as logging from watcher.openstack.common import versionutils diff --git a/watcher/opts.py b/watcher/opts.py index c7fb8a7fe..ec9f25132 100644 --- a/watcher/opts.py +++ b/watcher/opts.py @@ -16,12 +16,12 @@ # limitations under the License. import itertools +from oslo_log import _options import watcher.api.app from watcher.applier.framework import manager_applier import watcher.common.messaging.messaging_core -import watcher.openstack.common.log from watcher.decision_engine.framework import manager_decision_engine from watcher.decision_engine.framework.strategy import strategy_loader @@ -33,10 +33,10 @@ from watcher.metrics_engine.framework.datasources import influxdb_collector def list_opts(): return [ ('DEFAULT', itertools.chain( - watcher.openstack.common.log.generic_log_opts, - watcher.openstack.common.log.log_opts, - watcher.openstack.common.log.common_cli_opts, - watcher.openstack.common.log.logging_cli_opts + _options.generic_log_opts, + _options.log_opts, + _options.common_cli_opts, + _options.logging_cli_opts )), ('api', watcher.api.app.API_SERVICE_OPTS), ('watcher_messaging',