nova/nova/image
Matt Riedemann 056ab125c5 Default image.size to 0 when extracting v1 image attributes
When we snapshot a non-volume-backed instance, we create an
image in nova.compute.api.API._create_image and set some
values from the instance but 'size' isn't one of them.

Later in the virt driver's snapshot method, at least for
libvirt, it gets the snapshot image from the image API (glance)
and when using glance v1 (use_glance_v1=True) the _extract_attributes
method in nova.image.glance pulls the attributes out of the v1 image
response to the form that nova expects. This code assumes that
the 'size' attribute is set on the image, which for a snapshot image
it might not be (yet anyway). This results in an AttributeError.

This change defaults the size attribute value to 0 if it's not set.
If it is set, but to None, we still use 0 as before.

Conflicts:
	nova/tests/unit/image/test_glance.py

Original patch added test-case to TestExtractAttributes class,
but stable/mitaka doesn't have that class.
And that class used configurable value "use_glance_v1" that is
not contained in stable/mitaka.
So I added a test-case that tests fixed points to other existing
class.

Change-Id: I14b0e44a7268231c2b19f013b563f0b8f09c2e88
Closes-Bug: #1606707
(cherry picked from commit 7a16c754fb)
2016-09-14 19:46:00 +09:00
..
download Remove unused CONF imports 2016-02-15 16:40:53 +11:00
__init__.py Align internal image API with volume and network 2014-05-21 16:30:10 -04:00
api.py Fix description of parameters in nova functions 2015-02-10 11:44:45 +04:00
glance.py Default image.size to 0 when extracting v1 image attributes 2016-09-14 19:46:00 +09:00
s3.py Merge "Add hacking check for eventlet.spawn()" 2015-10-08 03:43:00 +00:00