Comment 3 for bug 1606707

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/347571
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=7a16c754fb49615b802e6b8f3d886847c168bd2a
Submitter: Jenkins
Branch: master

commit 7a16c754fb49615b802e6b8f3d886847c168bd2a
Author: Matt Riedemann <email address hidden>
Date: Tue Jul 26 18:27:48 2016 -0400

    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.

    Change-Id: I14b0e44a7268231c2b19f013b563f0b8f09c2e88
    Closes-Bug: #1606707