-
Bug
-
Resolution: Cannot Reproduce
-
Normal
-
None
-
False
-
False
-
None
Description of problem:
As discussed in the following update to bug #1998184.
https://bugzilla.redhat.com/show_bug.cgi?id=1998184#c27
(In reply to Lee Yarwood from comment #27)
> I've finally worked out why we end up with the different behaviour between
> an ephemeral rbd and volume rbd snapshot when using Nova's imageCreate API.
>
> When creating a volume backed snapshot imageCreate will set the size of the
> image to 0 in the image_meta [1]. This in turn activates an odd hackaround
> within Nova's image code that asks glance to create the image with an empty
> string for data, instead of None [2][3]. This causes the Glance backend to
> actually create an image on the backend, write data and compute the
> associated hash properties.
>
> When creating an ephemeral snapshot that uses the underlying direct snapshot
> mechanism in Nova imageCreate doesn't do this, instead creating an image
> initially with an unset size [4][5] that results in nothing being created in
> Glance's backend. As we don't upload any further data to the image in this
> case [6] the hash properties are not recalculated and left empty.
>
> I can try to create this initial image with a size of 0 in this flow but I'm
> worried that Glance will not recalculate the hashes later for other backends
> when we actually upload data, only one way to find out I guess.
>
> FWIW I also this behaviour when shelving an ephemeral backed instance using
> rbd, with the call to create the image [7] not activating the image. Backup
> should also hit this but I haven't tested as yet [8].
>
> [1]
> https://github.com/openstack/nova/blob/
> 1c502ebaec29615f08d4af7dc6680f3141d70e67/nova/compute/api.py#L3307-L3310
> [2]
> https://github.com/openstack/nova/blob/
> 1c502ebaec29615f08d4af7dc6680f3141d70e67/nova/image/glance.py#L531-L536
> [3]
> https://github.com/openstack/nova/blob/
> 1c502ebaec29615f08d4af7dc6680f3141d70e67/nova/image/glance.py#L632-L644
> [4]
> https://github.com/openstack/nova/blob/
> 1c502ebaec29615f08d4af7dc6680f3141d70e67/nova/compute/api.py#L3247-L3249
> [5]
> https://github.com/openstack/nova/blob/
> 1c502ebaec29615f08d4af7dc6680f3141d70e67/nova/compute/utils.py#L1203-L1233
> [6]
> https://github.com/openstack/nova/blob/
> 1c502ebaec29615f08d4af7dc6680f3141d70e67/nova/virt/libvirt/driver.py#L2932-
> L2933
> [7]
> https://github.com/openstack/nova/blob/
> 1c502ebaec29615f08d4af7dc6680f3141d70e67/nova/compute/api.py#L4285-L4287
> [8]
> https://github.com/openstack/nova/blob/
> 1c502ebaec29615f08d4af7dc6680f3141d70e67/nova/compute/api.py#L3218-L3220
IMHO we should stop uploading an empty string as data in the volume snapshot case and leave the hash values blank for both as no actual image data resides within Glance.
Version-Release number of selected component (if applicable):
Master
How reproducible:
Always
Steps to Reproduce:
1. Snapshot a volume backed instance using Nova's imageCreate API.
2. Inspect the image associated with the snapshot.
Actual results:
The image has os_hash_* properties defined
Expected results:
As no image data resides in Glance these properties should not be set.
Additional info:
- external trackers