From f396c8e5fa336e4c8bf190cf8b80b7cc6466e01e Mon Sep 17 00:00:00 2001 From: Zhihai Song Date: Fri, 25 Dec 2015 17:50:01 +0800 Subject: [PATCH] Remove unused logging import and LOG global var In some modules the global LOG is not used any more. And the import of logging is not used. This patch removes the unused logging import and LOG vars. Change-Id: I28572c325f8c31ff38161010047bba00c5d5b833 --- .../openstack/compute/legacy_v2/contrib/baremetal_nodes.py | 3 --- nova/api/openstack/compute/legacy_v2/contrib/server_usage.py | 3 --- nova/cells/filters/__init__.py | 4 ---- nova/cells/filters/image_properties.py | 4 ---- nova/manager.py | 2 -- nova/objects/base.py | 4 ---- nova/objects/pci_device.py | 4 ---- nova/objects/request_spec.py | 3 --- nova/pci/request.py | 3 --- nova/pci/whitelist.py | 3 --- nova/scheduler/ironic_host_manager.py | 4 ---- nova/scheduler/manager.py | 3 --- nova/tests/functional/db/api/test_migrations.py | 1 - nova/tests/unit/db/test_migrations.py | 3 --- nova/tests/unit/network/test_linux_net.py | 2 -- nova/tests/unit/virt/libvirt/storage/test_rbd.py | 4 ---- nova/virt/configdrive.py | 3 --- nova/virt/disk/mount/block.py | 4 ---- nova/virt/hyperv/pathutils.py | 3 --- nova/virt/hyperv/vif.py | 3 --- nova/volume/encryptors/base.py | 4 ---- nova/volume/encryptors/nop.py | 5 ----- nova/wsgi/nova-api.py | 1 - 23 files changed, 73 deletions(-) diff --git a/nova/api/openstack/compute/legacy_v2/contrib/baremetal_nodes.py b/nova/api/openstack/compute/legacy_v2/contrib/baremetal_nodes.py index 77199e427ffd..3ce1610091aa 100644 --- a/nova/api/openstack/compute/legacy_v2/contrib/baremetal_nodes.py +++ b/nova/api/openstack/compute/legacy_v2/contrib/baremetal_nodes.py @@ -16,7 +16,6 @@ """The bare-metal admin extension with Ironic Proxy.""" from oslo_config import cfg -from oslo_log import log as logging from oslo_utils import importutils import webob @@ -55,8 +54,6 @@ CONF.import_opt('admin_tenant_name', group='ironic') CONF.import_opt('compute_driver', 'nova.virt.driver') -LOG = logging.getLogger(__name__) - def _check_ironic_client_enabled(): """Check whether Ironic is installed or not.""" diff --git a/nova/api/openstack/compute/legacy_v2/contrib/server_usage.py b/nova/api/openstack/compute/legacy_v2/contrib/server_usage.py index 5c1b47a00d62..f09e22db2fba 100644 --- a/nova/api/openstack/compute/legacy_v2/contrib/server_usage.py +++ b/nova/api/openstack/compute/legacy_v2/contrib/server_usage.py @@ -12,13 +12,10 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo_log import log as logging - from nova.api.openstack import extensions from nova.api.openstack import wsgi from nova import compute -LOG = logging.getLogger(__name__) authorize = extensions.soft_extension_authorizer('compute', 'server_usage') diff --git a/nova/cells/filters/__init__.py b/nova/cells/filters/__init__.py index d069a2a3294c..33fff0d0f6bd 100644 --- a/nova/cells/filters/__init__.py +++ b/nova/cells/filters/__init__.py @@ -17,13 +17,9 @@ Cell scheduler filters """ -from oslo_log import log as logging - from nova import filters from nova import policy -LOG = logging.getLogger(__name__) - class BaseCellFilter(filters.BaseFilter): """Base class for cell filters.""" diff --git a/nova/cells/filters/image_properties.py b/nova/cells/filters/image_properties.py index deccf3c7409f..69ef33b61123 100644 --- a/nova/cells/filters/image_properties.py +++ b/nova/cells/filters/image_properties.py @@ -27,12 +27,8 @@ cells. from distutils import versionpredicate -from oslo_log import log as logging - from nova.cells import filters -LOG = logging.getLogger(__name__) - class ImagePropertiesFilter(filters.BaseCellFilter): """Image properties filter. Works by specifying the hypervisor required in diff --git a/nova/manager.py b/nova/manager.py index bac744203baf..aa1a762d06a0 100644 --- a/nova/manager.py +++ b/nova/manager.py @@ -52,7 +52,6 @@ This module provides Manager, a base class for managers. """ from oslo_config import cfg -from oslo_log import log as logging from oslo_service import periodic_task from nova.db import base @@ -61,7 +60,6 @@ from nova import rpc CONF = cfg.CONF CONF.import_opt('host', 'nova.netconf') -LOG = logging.getLogger(__name__) class PeriodicTasks(periodic_task.PeriodicTasks): diff --git a/nova/objects/base.py b/nova/objects/base.py index 956505d6b7e9..b0c98e055986 100644 --- a/nova/objects/base.py +++ b/nova/objects/base.py @@ -20,7 +20,6 @@ import functools import traceback import netaddr -from oslo_log import log as logging import oslo_messaging as messaging from oslo_utils import versionutils from oslo_versionedobjects import base as ovoo_base @@ -33,9 +32,6 @@ from nova.objects import fields as obj_fields from nova import utils -LOG = logging.getLogger('object') - - def get_attrname(name): """Return the mangled name of the attribute's underlying storage.""" # FIXME(danms): This is just until we use o.vo's class properties diff --git a/nova/objects/pci_device.py b/nova/objects/pci_device.py index e7b4a9e5d52d..265884cfdb7d 100644 --- a/nova/objects/pci_device.py +++ b/nova/objects/pci_device.py @@ -15,7 +15,6 @@ import copy -from oslo_log import log as logging from oslo_serialization import jsonutils from oslo_utils import versionutils @@ -26,9 +25,6 @@ from nova.objects import base from nova.objects import fields -LOG = logging.getLogger(__name__) - - def compare_pci_device_attributes(obj_a, obj_b): pci_ignore_fields = base.NovaPersistentObject.fields.keys() for name in obj_a.obj_fields: diff --git a/nova/objects/request_spec.py b/nova/objects/request_spec.py index 6e8916a14436..17e3f5f4390b 100644 --- a/nova/objects/request_spec.py +++ b/nova/objects/request_spec.py @@ -12,7 +12,6 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo_log import log as logging from oslo_serialization import jsonutils import six @@ -25,8 +24,6 @@ from nova.objects import fields from nova.objects import instance as obj_instance from nova.virt import hardware -LOG = logging.getLogger(__name__) - @base.NovaObjectRegistry.register class RequestSpec(base.NovaObject): diff --git a/nova/pci/request.py b/nova/pci/request.py index 46fcf202e3db..7ec0687f6dd1 100644 --- a/nova/pci/request.py +++ b/nova/pci/request.py @@ -40,7 +40,6 @@ import copy import jsonschema from oslo_config import cfg -from oslo_log import log as logging from oslo_serialization import jsonutils import six @@ -71,8 +70,6 @@ PCI_NET_TAG = 'physical_network' CONF = cfg.CONF CONF.register_opts(pci_alias_opts) -LOG = logging.getLogger(__name__) - _ALIAS_DEV_TYPE = ['NIC', 'ACCEL', 'GPU'] _ALIAS_CAP_TYPE = ['pci'] diff --git a/nova/pci/whitelist.py b/nova/pci/whitelist.py index 603b29400fbc..fdb4ec696ea0 100644 --- a/nova/pci/whitelist.py +++ b/nova/pci/whitelist.py @@ -15,7 +15,6 @@ # under the License. from oslo_config import cfg -from oslo_log import log as logging from oslo_serialization import jsonutils from nova import exception @@ -32,8 +31,6 @@ pci_opts = [cfg.MultiStrOpt('pci_passthrough_whitelist', CONF = cfg.CONF CONF.register_opts(pci_opts) -LOG = logging.getLogger(__name__) - class Whitelist(object): diff --git a/nova/scheduler/ironic_host_manager.py b/nova/scheduler/ironic_host_manager.py index 1b881372ae11..35206ed72353 100644 --- a/nova/scheduler/ironic_host_manager.py +++ b/nova/scheduler/ironic_host_manager.py @@ -21,16 +21,12 @@ This host manager will consume all cpu's, disk space, and ram from a host / node as it is supporting Baremetal hosts, which can not be subdivided into multiple instances. """ -from oslo_log import log as logging - from nova.compute import hv_type import nova.conf from nova.scheduler import host_manager CONF = nova.conf.CONF -LOG = logging.getLogger(__name__) - class IronicNodeState(host_manager.HostState): """Mutable and immutable information tracked for a host. diff --git a/nova/scheduler/manager.py b/nova/scheduler/manager.py index 68807b25c3ab..264bec23b851 100644 --- a/nova/scheduler/manager.py +++ b/nova/scheduler/manager.py @@ -19,7 +19,6 @@ Scheduler Service """ -from oslo_log import log as logging import oslo_messaging as messaging from oslo_serialization import jsonutils from oslo_service import periodic_task @@ -31,8 +30,6 @@ from nova import manager from nova import quota -LOG = logging.getLogger(__name__) - CONF = nova.conf.CONF QUOTAS = quota.QUOTAS diff --git a/nova/tests/functional/db/api/test_migrations.py b/nova/tests/functional/db/api/test_migrations.py index 2e3be9b37015..67d5e11aa978 100644 --- a/nova/tests/functional/db/api/test_migrations.py +++ b/nova/tests/functional/db/api/test_migrations.py @@ -48,7 +48,6 @@ from nova import test CONF = cfg.CONF -LOG = logging.getLogger(__name__) class NovaAPIModelsSync(test_migrations.ModelsMigrationsSync): diff --git a/nova/tests/unit/db/test_migrations.py b/nova/tests/unit/db/test_migrations.py index 9c21b4031be6..92aa433e8b06 100644 --- a/nova/tests/unit/db/test_migrations.py +++ b/nova/tests/unit/db/test_migrations.py @@ -60,9 +60,6 @@ from nova import test from nova.tests import fixtures as nova_fixtures -LOG = logging.getLogger(__name__) - - class NovaMigrationsCheckers(test_migrations.ModelsMigrationsSync, test_migrations.WalkVersionsMixin): """Test sqlalchemy-migrate migrations.""" diff --git a/nova/tests/unit/network/test_linux_net.py b/nova/tests/unit/network/test_linux_net.py index e48ba83e4b11..f9c2ee607ad7 100644 --- a/nova/tests/unit/network/test_linux_net.py +++ b/nova/tests/unit/network/test_linux_net.py @@ -23,7 +23,6 @@ from mox3 import mox import netifaces from oslo_concurrency import processutils from oslo_config import cfg -from oslo_log import log as logging from oslo_serialization import jsonutils from oslo_utils import fileutils from oslo_utils import timeutils @@ -37,7 +36,6 @@ from nova import objects from nova import test from nova import utils -LOG = logging.getLogger(__name__) CONF = cfg.CONF CONF.import_opt('share_dhcp_address', 'nova.objects.network') CONF.import_opt('network_device_mtu', 'nova.objects.network') diff --git a/nova/tests/unit/virt/libvirt/storage/test_rbd.py b/nova/tests/unit/virt/libvirt/storage/test_rbd.py index 1ebc50abb88b..2ae029383105 100644 --- a/nova/tests/unit/virt/libvirt/storage/test_rbd.py +++ b/nova/tests/unit/virt/libvirt/storage/test_rbd.py @@ -12,7 +12,6 @@ import mock -from oslo_log import log as logging from nova import exception from nova import objects @@ -21,9 +20,6 @@ from nova import utils from nova.virt.libvirt.storage import rbd_utils -LOG = logging.getLogger(__name__) - - CEPH_MON_DUMP = """dumped monmap epoch 1 { "epoch": 1, "fsid": "33630410-6d93-4d66-8e42-3b953cf194aa", diff --git a/nova/virt/configdrive.py b/nova/virt/configdrive.py index d07bddc64a46..56b49304ddd0 100644 --- a/nova/virt/configdrive.py +++ b/nova/virt/configdrive.py @@ -19,7 +19,6 @@ import os import shutil from oslo_config import cfg -from oslo_log import log as logging from oslo_utils import fileutils from oslo_utils import units @@ -29,8 +28,6 @@ from nova.objects import fields from nova import utils from nova import version -LOG = logging.getLogger(__name__) - configdrive_opts = [ cfg.StrOpt('config_drive_format', default='iso9660', diff --git a/nova/virt/disk/mount/block.py b/nova/virt/disk/mount/block.py index 6fa5c9e1f814..ca805ccb6500 100644 --- a/nova/virt/disk/mount/block.py +++ b/nova/virt/disk/mount/block.py @@ -13,12 +13,8 @@ # under the License. """Support for mounting block device based images directly.""" -from oslo_log import log as logging - from nova.virt.disk.mount import api -LOG = logging.getLogger(__name__) - class BlockMount(api.Mount): """Block device backed images do not need to be linked because diff --git a/nova/virt/hyperv/pathutils.py b/nova/virt/hyperv/pathutils.py index 34e2b7955dab..ddd343eb59d8 100644 --- a/nova/virt/hyperv/pathutils.py +++ b/nova/virt/hyperv/pathutils.py @@ -17,14 +17,11 @@ import os from os_win.utils import pathutils from oslo_config import cfg -from oslo_log import log as logging from nova import exception from nova.i18n import _ from nova.virt.hyperv import constants -LOG = logging.getLogger(__name__) - hyperv_opts = [ cfg.StrOpt('instances_path_share', default="", diff --git a/nova/virt/hyperv/vif.py b/nova/virt/hyperv/vif.py index 0dc5e91b6621..050c0540f6b1 100644 --- a/nova/virt/hyperv/vif.py +++ b/nova/virt/hyperv/vif.py @@ -18,7 +18,6 @@ import abc from os_win import utilsfactory from oslo_config import cfg -from oslo_log import log as logging hyperv_opts = [ cfg.StrOpt('vswitch_name', @@ -30,8 +29,6 @@ hyperv_opts = [ CONF = cfg.CONF CONF.register_opts(hyperv_opts, 'hyperv') -LOG = logging.getLogger(__name__) - class HyperVBaseVIFDriver(object): @abc.abstractmethod diff --git a/nova/volume/encryptors/base.py b/nova/volume/encryptors/base.py index d1babee3a50f..03639c69ea31 100644 --- a/nova/volume/encryptors/base.py +++ b/nova/volume/encryptors/base.py @@ -15,14 +15,10 @@ import abc - -from oslo_log import log as logging import six from nova import keymgr -LOG = logging.getLogger(__name__) - @six.add_metaclass(abc.ABCMeta) class VolumeEncryptor(object): diff --git a/nova/volume/encryptors/nop.py b/nova/volume/encryptors/nop.py index 64ed8290a019..de0bfbf03d66 100644 --- a/nova/volume/encryptors/nop.py +++ b/nova/volume/encryptors/nop.py @@ -13,14 +13,9 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo_log import log as logging - from nova.volume.encryptors import base -LOG = logging.getLogger(__name__) - - class NoOpEncryptor(base.VolumeEncryptor): """A VolumeEncryptor that does nothing. diff --git a/nova/wsgi/nova-api.py b/nova/wsgi/nova-api.py index c303a14a56b3..c0fc77ac4d1b 100644 --- a/nova/wsgi/nova-api.py +++ b/nova/wsgi/nova-api.py @@ -30,7 +30,6 @@ CONF = cfg.CONF config_files = ['/etc/nova/api-paste.ini', '/etc/nova/nova.conf'] config.parse_args([], default_config_files=config_files) -LOG = logging.getLogger(__name__) logging.setup(CONF, "nova") utils.monkey_patch() objects.register_all()