Nova docker virt driver triggers - AttributeError: 'Message' object has no attribute 'format'
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Compute (nova) |
Invalid
|
Undecided
|
Unassigned | ||
nova-docker |
Fix Committed
|
Undecided
|
Unassigned | ||
oslo-incubator |
Invalid
|
Undecided
|
Unassigned | ||
oslo.i18n |
Won't Fix
|
Undecided
|
Unassigned |
Bug Description
Using the nova virt docker driver and when I try to deploy an instance I get:
2013-10-21 12:18:39.229 20636 ERROR nova.compute.
2013-10-21 12:18:39.229 20636 TRACE nova.compute.
2013-10-21 12:18:39.229 20636 TRACE nova.compute.
2013-10-21 12:18:39.229 20636 TRACE nova.compute.
2013-10-21 12:18:39.229 20636 TRACE nova.compute.
2013-10-21 12:18:39.229 20636 TRACE nova.compute.
2013-10-21 12:18:39.229 20636 TRACE nova.compute.
2013-10-21 12:18:39.229 20636 TRACE nova.compute.
2013-10-21 12:18:39.229 20636 TRACE nova.compute.
2013-10-21 12:18:39.229 20636 TRACE nova.compute.
2013-10-21 12:18:39.229 20636 TRACE nova.compute.
2013-10-21 12:18:39.229 20636 TRACE nova.compute.
2013-10-21 12:18:39.229 20636 TRACE nova.compute.
On a boot VM flow.
Based on a tiny bit of poking it appears there is a common gettextutils method to wrapper message/string access which does not account for the use of Message.format() as used in the docker virt driver.
Honestly based on the code I'm running I'm not sure how spawn worked at all for docker as the use of Message.format() is in the boot codepath:
296 msg = _('Image name "{0}" does not exist, fetching it...')
297 LOG.info(
This always triggers the no attr message.
I'm not up to speed on the gettextutils wrapper, but I hacked around this by adding 'format' to the list of ops in gettextutils.py:
def __getattribute_
243 # NOTE(mrodden): handle lossy operations that we can't deal with yet
244 # These override the UserString implementation, since UserString
245 # uses our __class__ attribute to try and build a new message
246 # after running the inner data string through the operation.
247 # At that point, we have lost the gettext message id and can just
248 # safely resolve to a string instead.
249 ops = ['capitalize', 'center', 'decode', 'encode',
250 'expandtabs', 'ljust', 'lstrip', 'replace', 'rjust', 'rstrip',
251 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill', 'format']
252 if name in ops:
253 return getattr(self.data, name)
254 else:
255 return UserString.
Changed in oslo: | |
status: | New → Invalid |
Changed in nova: | |
status: | New → In Progress |
assignee: | nobody → Davanum Srinivas (DIMS) (dims-v) |
tags: | added: docker |
Changed in nova: | |
assignee: | Davanum Srinivas (DIMS) (dims-v) → nobody |
Changed in nova: | |
status: | In Progress → Triaged |
It would be better to change the log call to
msg = _('Image name "%s" does not exist, fetching it...')
LOG.info(msg, image_name)
because that delays both the translation and the string interpolation until the log message is actually going to be emitted.