Long ago, it was decided that we should create an empty image in
glance for snapshots of volume-backed instances[1]. I'm not really sure
why that is, since it doesn't seem to be a useful construct to do
anything with (like a normal snapshot, which can be used to boot).
It was so long ago that it was not documented well[2]. However, when
glance v2 came along, that sort of nonsensical thing became harder
because images would not be "active" until they had content, and nova
decided to continue the status quo by uploading empty data[3] to
force the state transition. Later, that stopped working for Xen
because we were lying about the format in a way that didn't work for
Xen, so we made that lie dynamic[4] to triple-down on the original
decision.
Now, with glance moving to image format safety, our lies have caught
up with us. We can no longer upload an empty stream of data and claim
that it is qcow2 because glance will call our bluff. Although it was
originally suggested[5] as a fix that would be hypervisor-neutral (and
not implemented that way for reasons that were not stated), we must
start uploading that empty stream as the 'raw' format that it is in
order for glance to accept it. Technically glance can be configured
to not allow raw uploads, which means that we could again end up
with the situation from the xen bug[5], but without synthesizing a
fictitious image of a type that is supported, there's no good solutuon,
other than a re-think.
I think it would be worth revisiting whether or not we need an empty
glance image for volume-backed server snapshots, and if we do, whether
or not there's a better way to go about that (like adding a location
which will indicate it lives elsewhere and will result in it becoming
active). However, in the meantime we need to be truthful about the
lie we're making, by correctly identifying the format of the zero-
length data we're not uploading.
Needed-By: https://review.opendev.org/c/openstack/glance-specs/+/925111
Change-Id: I6a6184da3b73506261c61005b6984c69cdc7fb98
1: c3476b5ca7
2: https://bugs.launchpad.net/nova/+bug/1034730
3: 4a39b8b530
4: 2fe5daeb5f
5: https://bugs.launchpad.net/nova/+bug/1616938/comments/1