Reviewed: https://review.opendev.org/457886 Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=d89e7d7857e0ab56c3b088338272c24d0618c07f Submitter: Zuul Branch: master
commit d89e7d7857e0ab56c3b088338272c24d0618c07f Author: rsritesh <[email protected]> Date: Wed Apr 19 12:02:30 2017 +0530 libvirt: flatten rbd images when unshelving an instance Previously attempts to remove the shelved snapshot of an unshelved instance when using the rbd backends for both Nova and Glance would fail. This was due to the instance disk being cloned from and still referencing the shelved snapshot image in Glance, blocking any attempt to remove this image later in the unshelve process. After much debate this change attempts to fix this issue by flattening the instance disk while the instance is being spawned as part of an unshelve. For the rbd imagebackend this removes any reference to the shelved snapshot in Glance allowing this image to be removed. For all other imagebackends the call to flatten the image is currently a no-op. Co-Authored-By: Lee Yarwood <[email protected]> Co-Authored-By: Vladyslav Drok <[email protected]> Closes-Bug: #1653953 Change-Id: If3c9d1de3ce0fe394405bd1e1f0fa08ce2baeda8 ** Changed in: nova Status: In Progress => Fix Released -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to OpenStack Compute (nova). https://bugs.launchpad.net/bugs/1653953 Title: Unable to remove snapshots after an instance is unshelved when using the rbd imagebackend Status in OpenStack Compute (nova): Fix Released Status in OpenStack Compute (nova) queens series: New Status in OpenStack Compute (nova) rocky series: New Status in OpenStack Compute (nova) stein series: New Bug description: Description =========== I'm not entirely convinced that this is a bug but wanted to document and discuss this upstream. When using the rbd imagebackend, snapshots used to shelve an instance cannot be removed after unshelving as they are cloned and as a result are now the parents of the recreated instance disks. This is in line with the behaviour of the imagebackend when initially spawning an instance from an image but has caused confusion for operators downstream who assume that the snapshot can be removed once the instance has been unshelved. We could flatten the instance disk when spawning during an unshelve but to do so would mean extending the imagebackend to handle yet another corner case for rbd. Steps to reproduce ================== $ nova boot --image cirros-raw --flavor 1 test-shelve [..] $ nova shelve test-shelve [..] $ nova unshelve test-shelve [..] $ sudo rbd -p vms ls -l NAME SIZE PARENT FMT PROT LOCK 4c843671-879d-4ba6-b4e8-8eefdced5393_disk 1024M images/df96af36-5a97-4f47-a79f-f3f3c85a21d9@snap 2 $ glance image-delete df96af36-5a97-4f47-a79f-f3f3c85a21d9 Unable to delete image 'df96af36-5a97-4f47-a79f-f3f3c85a21d9' because it is in use. We can easily workaround this by manually flattening the instance disk : $ nova stop test-shelve $ sudo rbd -p vms flatten 4c843671-879d-4ba6-b4e8-8eefdced5393_disk Image flatten: 100% complete...done. $ nova start test-shelve $ glance image-delete df96af36-5a97-4f47-a79f-f3f3c85a21d9 Expected result =============== Able to remove the shelved snapshot from Glance after unshelve. Actual result ============= Unable to remove the shelved snapshot from Glance after unshelve. Environment =========== 1. Exact version of OpenStack you are running. See the following list for all releases: http://docs.openstack.org/releases/ $ pwd /opt/stack/nova $ git rev-parse HEAD d768bfa2c2fb774154a5268f58b28537f7b39f69 2. Which hypervisor did you use? (For example: Libvirt + KVM, Libvirt + XEN, Hyper-V, PowerKVM, ...) What's the version of that? libvirt + kvm 2. Which storage type did you use? (For example: Ceph, LVM, GPFS, ...) What's the version of that? ceph 3. Which networking type did you use? (For example: nova-network, Neutron with OpenVSwitch, ...) N/A Logs & Configs ============== To manage notifications about this bug go to: https://bugs.launchpad.net/nova/+bug/1653953/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : [email protected] Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp

