Deduplicate some INFO and AUDIT level messages

I'm trying to debug a problem where the last thing in the logs is
"Starting instance...".  Unfortunately this occurs twice in the same
source file, so it's hard to figure out a priori which log statement
it came from.  Audit and info messages don't disambiguate their
function/line number, all you get is the logger name like:

2014-04-06 19:51:01.871 8288 AUDIT
  nova.compute.manager [req-...] [instance: ...] Starting instance...

I think it doesn't hurt to to make sure all logs at this level are
unique, even if upstream were to log the function (see [1]).  Most
duplicate LOG.info and LOG.audit level messages are in separate files
so we can disambiguate by the name, but there are a few that overlap.

For reference, the less-then-perfect but useful check I used was:
 $ grep -r 'LOG.audit' * | sed 's/:\s*/ /' | sort -k1 | uniq -f1 -c

[1] https://review.openstack.org/#/c/85638/

Change-Id: If1ff573ffed1d12fcadfbdfd3365aae68a5fb977
This commit is contained in:
Ian Wienand 2014-04-07 10:15:02 +10:00
parent 89cd6a0c49
commit e154c2cefe
3 changed files with 14 additions and 13 deletions

View File

@ -188,12 +188,12 @@ class AggregateController(object):
aggregate = self.api.add_host_to_aggregate(context, id, host)
except (exception.AggregateNotFound, exception.ComputeHostNotFound):
msg = _('Cannot add host %(host)s in aggregate'
' %(id)s') % {'host': host, 'id': id}
' %(id)s: not found') % {'host': host, 'id': id}
raise exc.HTTPNotFound(explanation=msg)
except (exception.AggregateHostExists,
exception.InvalidAggregateAction):
msg = _('Cannot add host %(host)s in aggregate'
' %(id)s') % {'host': host, 'id': id}
' %(id)s: host exists') % {'host': host, 'id': id}
raise exc.HTTPConflict(explanation=msg)
return self._marshall_aggregate(aggregate)
@ -207,11 +207,11 @@ class AggregateController(object):
except (exception.AggregateNotFound, exception.AggregateHostNotFound,
exception.ComputeHostNotFound):
msg = _('Cannot remove host %(host)s in aggregate'
' %(id)s') % {'host': host, 'id': id}
' %(id)s: not found') % {'host': host, 'id': id}
raise exc.HTTPNotFound(explanation=msg)
except exception.InvalidAggregateAction:
msg = _('Cannot remove host %(host)s in aggregate'
' %(id)s') % {'host': host, 'id': id}
' %(id)s: invalid') % {'host': host, 'id': id}
raise exc.HTTPConflict(explanation=msg)
return self._marshall_aggregate(aggregate)

View File

@ -22,6 +22,7 @@ from oslo.vmware import vim_util as vutil
from nova import exception
from nova.i18n import _
from nova.i18n import _LI
from nova.openstack.common import log as logging
from nova.virt.vmwareapi import vim_util
from nova.virt.vmwareapi import vm_util
@ -336,8 +337,8 @@ class VMwareVolumeOps(object):
# Store the uuid of the volume_device
self._update_volume_details(vm_ref, instance, data['volume_id'])
LOG.info(_("Mountpoint %(mountpoint)s attached to "
"instance %(instance_name)s"),
LOG.info(_LI("Mountpoint %(mountpoint)s attached to "
"vmdk instance %(instance_name)s"),
{'mountpoint': mountpoint, 'instance_name': instance_name},
instance=instance)
@ -371,8 +372,8 @@ class VMwareVolumeOps(object):
self.attach_disk_to_vm(vm_ref, instance,
adapter_type, 'rdmp',
device_name=device_name)
LOG.info(_("Mountpoint %(mountpoint)s attached to "
"instance %(instance_name)s"),
LOG.info(_LI("Mountpoint %(mountpoint)s attached to "
"iscsi instance %(instance_name)s"),
{'mountpoint': mountpoint, 'instance_name': instance_name},
instance=instance)
@ -511,8 +512,8 @@ class VMwareVolumeOps(object):
self._consolidate_vmdk_volume(instance, vm_ref, device, volume_ref)
self.detach_disk_from_vm(vm_ref, instance, device)
LOG.info(_("Mountpoint %(mountpoint)s detached from "
"instance %(instance_name)s"),
LOG.info(_LI("Mountpoint %(mountpoint)s detached from "
"vmdk instance %(instance_name)s"),
{'mountpoint': mountpoint, 'instance_name': instance_name},
instance=instance)
@ -540,8 +541,8 @@ class VMwareVolumeOps(object):
if device is None:
raise exception.StorageError(reason=_("Unable to find volume"))
self.detach_disk_from_vm(vm_ref, instance, device, destroy_disk=True)
LOG.info(_("Mountpoint %(mountpoint)s detached from "
"instance %(instance_name)s"),
LOG.info(_LI("Mountpoint %(mountpoint)s detached from "
"iscsi instance %(instance_name)s"),
{'mountpoint': mountpoint, 'instance_name': instance_name},
instance=instance)

View File

@ -91,7 +91,7 @@ class XCPVNCProxy(object):
data += b
if data.find("\r\n\r\n") != -1:
if not data.split("\r\n")[0].find("200"):
LOG.audit(_("Error in handshake: %s"), data)
LOG.audit(_("Error in handshake format: %s"), data)
return
break