yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #43567
[Bug 1487742] Re: Nova passing bad 'size' property value 'None' to Glance for images
Reviewed: https://review.openstack.org/215947
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=cc7f0bc038915c2a765bcdd17342ad12ac92e43c
Submitter: Jenkins
Branch: master
commit cc7f0bc038915c2a765bcdd17342ad12ac92e43c
Author: Mike Dorman <mdorman@xxxxxxxxxxx>
Date: Sat Aug 22 10:00:16 2015 -0700
Ensure Glance image 'size' attribute is 0, not 'None'
Make sure that if the 'size' attribute for an image does not
exist in Glance, that we set the value to 0 and not 'None'.
Glance does not accept 'None' as a valid value for the 'size'
attribute.
Co-Authored-By:Kevin_Zheng<zhengzhenyu@xxxxxxxxxx>
Change-Id: I8c6a8749d86a22eb2d2e1e84ce6a2b9a4a4992ee
Closes-bug: 1487742
** Changed in: nova
Status: In Progress => Fix Released
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1487742
Title:
Nova passing bad 'size' property value 'None' to Glance for images
Status in OpenStack Compute (nova):
Fix Released
Bug description:
Glance does not accept 'None' as a valid value for the 'size' property
[1]. However, in certain situations Nova is sending a 'size' property
with a 'None' value. This results in a 400 response from Glance to
Nova, and the following backtrace in Glance:
2015-08-21 14:54:17.916 10446 TRACE glance.api.v1.images Traceback (most recent call last):
2015-08-21 14:54:17.916 10446 TRACE glance.api.v1.images File "/usr/lib/python2.7/site-packages/glance/api/v1/images.py", line 1144, in _deserialize
2015-08-21 14:54:17.916 10446 TRACE glance.api.v1.images result['image_meta'] = utils.get_image_meta_from_headers(request)
2015-08-21 14:54:17.916 10446 TRACE glance.api.v1.images File "/usr/lib/python2.7/site-packages/glance/common/utils.py", line 322, in get_image_meta_from_headers
2015-08-21 14:54:17.916 10446 TRACE glance.api.v1.images extra_msg=extra)
2015-08-21 14:54:17.916 10446 TRACE glance.api.v1.images InvalidParameterValue: Invalid value 'None' for parameter 'size': Cannot convert image size 'None' to an integer.
I believe what's happening is Nova tries to enforce certain required
properties when creating or updating an image, and in the process
reconciling those with the properties that Glance already has (through
the _translate_from_glance() [2] and _extract_attributes() [3] methods
in nova/image/glance.py)
Nova is enforcing the 'size' property being in place [4], but if
Glance does not already have a 'size' property on the image (like if
the image has been queued but not uploaded yet), the value gets set to
'None' on the Nova side [5]. This gets sent to Glance in subsequent
calls, and it fails because 'None' cannot be converted to an integer
(see backtrace above.)
Steps to Reproduce:
Nova and Glance 2015.1.1
1. Queue a new image in Glance
2. Attempt to set a metadata attribute on that image (this will fail with 400 error from Glance)
3. Actually upload the image data sometime later
Potential Solution:
I've patched this locally to simply check that the 'size' property
gets set to 0 instead of 'None' on the Nova side. I am not familiar
enough with all the internals here to understand if that's the "right"
solution, but I can confirm it's working for us and this bug is no
longer triggered.
[1] https://github.com/openstack/glance/blob/2015.1.1/glance/common/utils.py#L305-L319
[2] https://github.com/openstack/nova/blob/2015.1.1/nova/image/glance.py#L482
[3] https://github.com/openstack/nova/blob/2015.1.1/nova/image/glance.py#L533
[4] https://github.com/openstack/nova/blob/2015.1.1/nova/image/glance.py#L539
[5] https://github.com/openstack/nova/blob/2015.1.1/nova/image/glance.py#L571
To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1487742/+subscriptions
References