summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Erdfelt <johannes.erdfelt@rackspace.com>2012-02-07 20:11:55 +0000
committerJohannes Erdfelt <johannes.erdfelt@rackspace.com>2012-02-08 21:53:55 +0000
commit2b538441a8aafde5dcc48939a091f22d1303f3bf (patch)
tree210f3668fbd5ae6ae1c378e9b11d8a2ea4dde9fd
parent85ae58c21fc9019dfef5585accd53bdc667debde (diff)
downloadnova-2b538441a8aafde5dcc48939a091f22d1303f3bf.tar.gz
nova-2b538441a8aafde5dcc48939a091f22d1303f3bf.tar.xz
nova-2b538441a8aafde5dcc48939a091f22d1303f3bf.zip
Use named logger when available
Cleanup a handful of places where named loggers are created for a particular module but aren't used consistently. Also fix a couple of log entries that aren't internationalized Change-Id: I38186d47e7f31626b3ead779707d8ee5a15f56ac
-rw-r--r--nova/compute/api.py4
-rw-r--r--nova/scheduler/host_manager.py6
-rw-r--r--nova/service.py24
-rw-r--r--nova/tests/scheduler/test_host_manager.py4
-rw-r--r--nova/utils.py2
-rw-r--r--nova/virt/libvirt/firewall.py4
-rw-r--r--nova/virt/xenapi/vm_utils.py4
-rw-r--r--nova/virt/xenapi/vmops.py14
-rw-r--r--nova/volume/driver.py4
9 files changed, 33 insertions, 33 deletions
diff --git a/nova/compute/api.py b/nova/compute/api.py
index 2f4d3e200..1028dd118 100644
--- a/nova/compute/api.py
+++ b/nova/compute/api.py
@@ -269,8 +269,8 @@ class API(base.Base):
ramdisk_id = None
LOG.debug(_("Creating a raw instance"))
# Make sure we have access to kernel and ramdisk (if not raw)
- logging.debug("Using Kernel=%s, Ramdisk=%s" %
- (kernel_id, ramdisk_id))
+ LOG.debug(_("Using Kernel=%(kernel_id)s, Ramdisk=%(ramdisk_id)s")
+ % locals())
if kernel_id:
image_service.show(context, kernel_id)
if ramdisk_id:
diff --git a/nova/scheduler/host_manager.py b/nova/scheduler/host_manager.py
index 925a8637a..5418c0ac1 100644
--- a/nova/scheduler/host_manager.py
+++ b/nova/scheduler/host_manager.py
@@ -262,8 +262,8 @@ class HostManager(object):
def update_service_capabilities(self, service_name, host, capabilities):
"""Update the per-service capabilities based on this notification."""
- logging.debug(_("Received %(service_name)s service update from "
- "%(host)s.") % locals())
+ LOG.debug(_("Received %(service_name)s service update from "
+ "%(host)s.") % locals())
service_caps = self.service_states.get(host, {})
# Copy the capabilities, so we don't modify the original dict
capab_copy = dict(capabilities)
@@ -313,7 +313,7 @@ class HostManager(object):
for compute in compute_nodes:
service = compute['service']
if not service:
- logging.warn(_("No service for compute ID %s") % compute['id'])
+ LOG.warn(_("No service for compute ID %s") % compute['id'])
continue
host = service['host']
capabilities = self.service_states.get(host, None)
diff --git a/nova/service.py b/nova/service.py
index fc62a3b08..2a7625af0 100644
--- a/nova/service.py
+++ b/nova/service.py
@@ -159,8 +159,8 @@ class Service(object):
def start(self):
vcs_string = version.version_string_with_vcs()
- logging.audit(_('Starting %(topic)s node (version %(vcs_string)s)'),
- {'topic': self.topic, 'vcs_string': vcs_string})
+ LOG.audit(_('Starting %(topic)s node (version %(vcs_string)s)'),
+ {'topic': self.topic, 'vcs_string': vcs_string})
self.manager.init_host()
self.model_disconnected = False
ctxt = context.get_admin_context()
@@ -176,8 +176,8 @@ class Service(object):
self.manager.update_available_resource(ctxt)
self.conn = rpc.create_connection(new=True)
- logging.debug("Creating Consumer connection for Service %s" %
- self.topic)
+ LOG.debug(_("Creating Consumer connection for Service %s") %
+ self.topic)
# Share this same connection for these Consumers
self.conn.create_consumer(self.topic, self, fanout=False)
@@ -250,7 +250,7 @@ class Service(object):
try:
db.service_destroy(context.get_admin_context(), self.service_id)
except exception.NotFound:
- logging.warn(_('Service killed that has no database entry'))
+ LOG.warn(_('Service killed that has no database entry'))
def stop(self):
# Try to shut the connection down, but if we get any sort of
@@ -287,8 +287,8 @@ class Service(object):
try:
service_ref = db.service_get(ctxt, self.service_id)
except exception.NotFound:
- logging.debug(_('The service database object disappeared, '
- 'Recreating it.'))
+ LOG.debug(_('The service database object disappeared, '
+ 'Recreating it.'))
self._create_service_ref(ctxt)
service_ref = db.service_get(ctxt, self.service_id)
@@ -302,13 +302,13 @@ class Service(object):
# TODO(termie): make this pattern be more elegant.
if getattr(self, 'model_disconnected', False):
self.model_disconnected = False
- logging.error(_('Recovered model server connection!'))
+ LOG.error(_('Recovered model server connection!'))
# TODO(vish): this should probably only catch connection errors
except Exception: # pylint: disable=W0702
if not getattr(self, 'model_disconnected', False):
self.model_disconnected = True
- logging.exception(_('model server went away'))
+ LOG.exception(_('model server went away'))
class WSGIService(object):
@@ -400,16 +400,16 @@ def serve(*servers):
def wait():
- logging.debug(_('Full set of FLAGS:'))
+ LOG.debug(_('Full set of FLAGS:'))
for flag in FLAGS:
flag_get = FLAGS.get(flag, None)
# hide flag contents from log if contains a password
# should use secret flag when switch over to openstack-common
if ("_password" in flag or "_key" in flag or
(flag == "sql_connection" and "mysql:" in flag_get)):
- logging.debug('%(flag)s : FLAG SET ' % locals())
+ LOG.debug(_('%(flag)s : FLAG SET ') % locals())
else:
- logging.debug('%(flag)s : %(flag_get)s' % locals())
+ LOG.debug('%(flag)s : %(flag_get)s' % locals())
try:
_launcher.wait()
except KeyboardInterrupt:
diff --git a/nova/tests/scheduler/test_host_manager.py b/nova/tests/scheduler/test_host_manager.py
index 9ea00397f..0ee1d0470 100644
--- a/nova/tests/scheduler/test_host_manager.py
+++ b/nova/tests/scheduler/test_host_manager.py
@@ -249,12 +249,12 @@ class HostManagerTestCase(test.TestCase):
topic = 'compute'
self.mox.StubOutWithMock(db, 'compute_node_get_all')
- self.mox.StubOutWithMock(logging, 'warn')
+ self.mox.StubOutWithMock(host_manager.LOG, 'warn')
self.mox.StubOutWithMock(db, 'instance_get_all')
db.compute_node_get_all(context).AndReturn(fakes.COMPUTE_NODES)
# Invalid service
- logging.warn("No service for compute ID 5")
+ host_manager.LOG.warn("No service for compute ID 5")
db.instance_get_all(context).AndReturn(fakes.INSTANCES)
self.mox.ReplayAll()
diff --git a/nova/utils.py b/nova/utils.py
index f9ffe3adc..0baacd25a 100644
--- a/nova/utils.py
+++ b/nova/utils.py
@@ -635,7 +635,7 @@ class LoopingCall(object):
self.stop()
done.send(e.retvalue)
except Exception:
- logging.exception('in looping call')
+ LOG.exception(_('in looping call'))
done.send_exception(*sys.exc_info())
return
else:
diff --git a/nova/virt/libvirt/firewall.py b/nova/virt/libvirt/firewall.py
index 0bfd89de1..8ad844f50 100644
--- a/nova/virt/libvirt/firewall.py
+++ b/nova/virt/libvirt/firewall.py
@@ -137,14 +137,14 @@ class NWFilterFirewall(base_firewall.FirewallDriver):
def setup_basic_filtering(self, instance, network_info):
"""Set up basic filtering (MAC, IP, and ARP spoofing protection)"""
- logging.info('called setup_basic_filtering in nwfilter')
+ LOG.info(_('called setup_basic_filtering in nwfilter'))
if self.handle_security_groups:
# No point in setting up a filter set that we'll be overriding
# anyway.
return
- logging.info('ensuring static filters')
+ LOG.info(_('ensuring static filters'))
self._ensure_static_filters()
if instance['image_ref'] == str(FLAGS.vpn_image_id):
diff --git a/nova/virt/xenapi/vm_utils.py b/nova/virt/xenapi/vm_utils.py
index 91cbe2e38..72c2fbb94 100644
--- a/nova/virt/xenapi/vm_utils.py
+++ b/nova/virt/xenapi/vm_utils.py
@@ -378,8 +378,8 @@ class VMHelper(HelperBase):
"""
# NOTE(sirp): Currently we only support uploading images as VHD, there
# is no RAW equivalent (yet)
- logging.debug(_("Asking xapi to upload %(vdi_uuids)s as"
- " ID %(image_id)s") % locals())
+ LOG.debug(_("Asking xapi to upload %(vdi_uuids)s as"
+ " ID %(image_id)s") % locals())
glance_host, glance_port = glance.pick_glance_api_server()
diff --git a/nova/virt/xenapi/vmops.py b/nova/virt/xenapi/vmops.py
index 30d77369b..b9461eba8 100644
--- a/nova/virt/xenapi/vmops.py
+++ b/nova/virt/xenapi/vmops.py
@@ -644,13 +644,13 @@ class VMOps(object):
self._destroy(instance, template_vm_ref,
shutdown=False, destroy_kernel_ramdisk=False)
- logging.debug(_("Finished snapshot and upload for VM %s"), instance)
+ LOG.debug(_("Finished snapshot and upload for VM %s"), instance)
def _create_snapshot(self, instance):
#TODO(sirp): Add quiesce and VSS locking support when Windows support
# is added
- logging.debug(_("Starting snapshot for VM %s"), instance['uuid'])
+ LOG.debug(_("Starting snapshot for VM %s"), instance['uuid'])
vm_ref = VMHelper.lookup(self._session, instance.name)
label = "%s-snapshot" % instance.name
@@ -659,8 +659,8 @@ class VMOps(object):
self._session, instance, vm_ref, label)
return template_vm_ref, template_vdi_uuids
except self.XenAPI.Failure, exc:
- logging.error(_("Unable to Snapshot %(vm_ref)s: %(exc)s")
- % locals())
+ LOG.error(_("Unable to Snapshot %(vm_ref)s: %(exc)s")
+ % locals())
return
def _migrate_vhd(self, instance, vdi_uuid, dest, sr_path):
@@ -1485,7 +1485,7 @@ class VMOps(object):
self._session.call_xenapi("VM.get_record", vm_ref)
else:
vm_ref = VMHelper.lookup(self._session, instance.name)
- logging.debug(_("injecting network info to xs for vm: |%s|"), vm_ref)
+ LOG.debug(_("injecting network info to xs for vm: |%s|"), vm_ref)
for (network, info) in network_info:
location = 'vm-data/networking/%s' % info['mac'].replace(':', '')
@@ -1503,7 +1503,7 @@ class VMOps(object):
def create_vifs(self, vm_ref, instance, network_info):
"""Creates vifs for an instance."""
- logging.debug(_("creating vif(s) for vm: |%s|"), vm_ref)
+ LOG.debug(_("creating vif(s) for vm: |%s|"), vm_ref)
# this function raises if vm_ref is not a vm_opaque_ref
self._session.call_xenapi("VM.get_record", vm_ref)
@@ -1544,7 +1544,7 @@ class VMOps(object):
# NOTE(jk0): Windows hostnames can only be <= 15 chars.
hostname = hostname[:15]
- logging.debug(_("injecting hostname to xs for vm: |%s|"), vm_ref)
+ LOG.debug(_("injecting hostname to xs for vm: |%s|"), vm_ref)
self._session.call_xenapi_request("VM.add_to_xenstore_data",
(vm_ref, "vm-data/hostname", hostname))
diff --git a/nova/volume/driver.py b/nova/volume/driver.py
index f00eb0800..a9facac91 100644
--- a/nova/volume/driver.py
+++ b/nova/volume/driver.py
@@ -446,8 +446,8 @@ class ISCSIDriver(VolumeDriver):
# Instances remount read-only in this case.
# /etc/init.d/iscsitarget restart and rebooting nova-volume
# is better since ensure_export() works at boot time.
- logging.error(_("Cannot confirm exported volume "
- "id:%(volume_id)s.") % locals())
+ LOG.error(_("Cannot confirm exported volume "
+ "id:%(volume_id)s.") % locals())
raise