Description of problem: Snapshot is not getting deleted after smartstate analysis is done for instance booted from a Cinder volume. The image and volume are getting deleted but snapshot remains as it is. Version-Release number of selected component (if applicable): cfme 5.9.4.7.20180829201904_ced41ae Red Hat OpenStack 10 How reproducible: Always Steps to Reproduce: 1. Create an OpenStack instance booted from a Cinder volume a. Log-in to Horizon b. Select an appropriate project c. Select "Volumes" d. Select "Create a Volume" e. Under "Volume Source" f. Under "Use image as a source" select an appropriate image g. Select "Instances" h. Select "Launch Instance" i. Under "Instance boot source" select "Boot from volume" j. Under "Volume" select the volume created in (c)-(f) 2. Log-in to the Cloudforms appliance, and select the instance created in (1) (perform a "Refresh Relationships and Power States" for the provider if required to discover the instance) 3. Select "Configuration" -> "Perform SmartState Analysis" for the instance Actual results: Snapshot is not deleted from OpenStack provider Expected results: Snapshot should be deleted after smartstate analysis is completed successfully.
I'll be away next week, so here's an update as to where I am with this: Basically what's going on is that the snapshot that the smartstate analysis takes of the instance uses the nova image create api call which creates an image from the instance. However, in the specific case of an instance booted from a volume (rather than from an image), in addition to creating the image object (which in the boot-from-volume case seems to have a size of zero), there's also a volume snapshot created, since the instance's disk data is in that volume rather than in an image. The same thing happens if I create the image via the OpenStack CLI. an image-booted instance just gets the snapshot image, but a volume-booted instance gets the snapshot image *and* a volume snapshot. The volume snapshot's snapshot_id is contained in the properties metadata of the image object, though, so the solution here should be to check for snapshot_id in the image metadata before deleting it (in delete_evm_snapshot in MiqOpenStackInstance.rb) and if it's there, then delete the volume snapshot *and* the image. My first attempt to do this today failed, though, since for some reason the properties aren't showing up via fog-openstack. I'll need to debug that when I return, since I need access to the snapshot_id in order to make sure the volume snapshot is also deleted along with the image.
Hi, I will work on this BZ while Scott is on PTO.
It looks like that fog-openstack PR won't be needed after all. The only necessary changes are in the manageiq-smartstate PR here: https://github.com/ManageIQ/manageiq-smartstate/pull/83
New commit detected on ManageIQ/manageiq-smartstate/master: https://github.com/ManageIQ/manageiq-smartstate/commit/c99b01378d78b6606de35c93578f5d811bd313b3 commit c99b01378d78b6606de35c93578f5d811bd313b3 Author: Scott Seago <sseago> AuthorDate: Tue Nov 27 16:08:54 2018 -0500 Commit: Scott Seago <sseago> CommitDate: Tue Nov 27 16:08:54 2018 -0500 bug 1641011: delete snapshot after smartstate analysis fixes https://bugzilla.redhat.com/show_bug.cgi?id=1641011 For instances launched from volumes, the volume snapshot was not being deleted after smartstate analysis. With this PR, it gets deleted if present. lib/OpenStackExtract/MiqOpenStackVm/MiqOpenStackInstance.rb | 23 + 1 file changed, 23 insertions(+)
Hi Scott and Alexander, I tested this PR and it is working like a charm. Now, if an instance is launched using volumes, the snapshot is getting deleted after smartstate is finished successfully. Thank you, Niks
Looks like smart analysis is not working well after following scenario above tested on 5.10.0.30
Marek -- I suspect this failed for Jadh because he's not running with the updated manageiq-smartstate gem, since we lock that version in Gemfile. I'll create a PR to update the Gemfile to use 0.2.18
Gemfile PR posted: https://github.com/ManageIQ/manageiq/pull/18319
PR was merged to master.
I just confirmed that, at least in git, v0.2.18 includes the fix. Jadh -- what version of manageiq-smartstate was installed when this failed for you? If it's 0.2.18, can you give us some more details (and logs, etc.) on what happened, since the fix was previously working for both myself and Nikhil
env: https://10.9.76.165/ 5.10.0.30.20181218191323_900a416 How can i tell what is manageiq-smartstate version ?
There was misunderstanding on reproducing the bug Re-Verified on 5.10.0.30