diff options
author | Changbin Liu <changbin.liu@gmail.com> | 2013-06-19 12:09:28 -0400 |
---|---|---|
committer | Changbin Liu <changbin.liu@gmail.com> | 2013-06-19 13:41:07 -0400 |
commit | 43cf9864b9091319612926a01b07045806cfce49 (patch) | |
tree | 0f6cddb1e69396e863ad4fcd228bd528527218ec /nova/scheduler/manager.py | |
parent | 6808e052dbe9bc51b5836814d0a0331dcc5a6bd2 (diff) | |
download | nova-43cf9864b9091319612926a01b07045806cfce49.tar.gz nova-43cf9864b9091319612926a01b07045806cfce49.tar.xz nova-43cf9864b9091319612926a01b07045806cfce49.zip |
Remove usage of locals() for formatting from nova.scheduler.*
Using of locals() for formatting string is a nasty thing because:
1) It is not so clear as using explicit dicts
2) It could produce hidden errors during refactoring
3) Changing name of variable causes change in message
4) Creating a lot of unused variables
fixes bug #1171936
Change-Id: I7639631846a9145c3a18f2a704b71184ec781f45
Diffstat (limited to 'nova/scheduler/manager.py')
-rw-r--r-- | nova/scheduler/manager.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/nova/scheduler/manager.py b/nova/scheduler/manager.py index 9429a0662..5c99feb03 100644 --- a/nova/scheduler/manager.py +++ b/nova/scheduler/manager.py @@ -208,7 +208,8 @@ class SchedulerManager(manager.Manager): # The refactoring could go further but trying to minimize changes # for essex timeframe - LOG.warning(_("Failed to schedule_%(method)s: %(ex)s") % locals()) + LOG.warning(_("Failed to schedule_%(method)s: %(ex)s"), + {'method': method, 'ex': ex}) vm_state = updates['vm_state'] properties = request_spec.get('instance_properties', {}) @@ -222,8 +223,8 @@ class SchedulerManager(manager.Manager): for instance_uuid in request_spec.get('instance_uuids') or uuids: if instance_uuid: state = vm_state.upper() - LOG.warning(_('Setting instance to %(state)s state.'), - locals(), instance_uuid=instance_uuid) + LOG.warning(_('Setting instance to %s state.'), state, + instance_uuid=instance_uuid) # update instance state and notify on the transition (old_ref, new_ref) = self.db.instance_update_and_get_original( |