I came across this bug during triage today:

https://bugs.launchpad.net/nova/+bug/1732428

It essentially says that unshelving an instance and then resizing that instance later, depending on the type of image backend, can fail.

It's pointed out that when we complete the unshelve procedure, we set the instance.image_ref back to the original image_ref used to create the instance, rather than leave it pointing at the shelved instance snapshot image id.

I thought, "well that's crazy, the instance isn't backed by the original image anymore, it's backed by the snapshot image, so instance.image_ref should point at the snapshot image id now." But lo, in true shelve-tastic form, it turns out that would cause more bugs.

Because after we successfully spawn the guest during unshelve, we delete the snapshot image:

https://github.com/openstack/nova/blob/b6a245f0425a07be3871a976952646d2bdd44533/nova/compute/manager.py#L4797

So at this point, you've unshelved your instance, but the instance.image_ref is pointing at image A but was really created from image B.

Does anyone have ANY idea why we do this? Even if we delete the snapshot image, why would we change the image_ref back to the original image?

I think we can assert as follows:

1. After you've unshelved an instance, it's image_ref (unless volume-backed, because that's different crazy, not discussed here) should point at the image used to create the guest. Agree?

2. If we're going to point the instance at an image_ref, we shouldn't delete that image. I don't have a good reason why besides deleting things which nova has a reference to in an active instance generally causes problems (volumes, ports, etc).

Am I missing something that everyone else knew about way back in 2013?

--

Thanks,

Matt

__________________________________________________________________________
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev

Reply via email to