Bug 1015170 - [engine] Unable to remove snapshot after detaching disk from vm
[engine] Unable to remove snapshot after detaching disk from vm
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine (Show other bugs)
Unspecified Unspecified
high Severity high
: ---
: 3.3.0
Assigned To: Daniel Erez
Depends On:
Blocks: 3.3snap1
  Show dependency treegraph
Reported: 2013-10-03 10:43 EDT by Gadi Ickowicz
Modified: 2016-02-10 11:52 EST (History)
12 users (show)

See Also:
Fixed In Version: is19
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: Storage
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
amureini: Triaged+

Attachments (Terms of Use)
engine logs (1.01 MB, text/x-log)
2013-10-03 10:43 EDT, Gadi Ickowicz
no flags Details

External Trackers
Tracker ID Priority Status Summary Last Updated
oVirt gerrit 19895 None None None Never
oVirt gerrit 19936 None None None Never
oVirt gerrit 19976 None None None Never
oVirt gerrit 19999 None None None Never
oVirt gerrit 20000 None None None Never
oVirt gerrit 20001 None None None Never

  None (edit)
Description Gadi Ickowicz 2013-10-03 10:43:32 EDT
Created attachment 807111 [details]
engine logs

Description of problem:
After detaching the bootable disk from a vm and then creating a new one, the first snapshot that is created cannot be removed as it fails with CanDoAction Failure:

2013-10-03 17:38:48,435 INFO  [org.ovirt.engine.core.bll.RemoveSnapshotCommand] (ajp-/ Lock Acquired to object EngineLock [exclusiveLocks= key: c7c37f0b-e884-4737-accc-8960a4ebfa15 value: VM
, sharedLocks= ]
2013-10-03 17:38:48,466 WARN  [org.ovirt.engine.core.bll.RemoveSnapshotCommand] (ajp-/ CanDoAction of action RemoveSnapshot failed. Reasons:VAR__TYPE__SNAPSHOT,VAR__ACTION__REMOVE,ACTION_TYPE_FAILED_CANNOT_REMOVE_ACTIVE_IMAGE
2013-10-03 17:38:48,466 INFO  [org.ovirt.engine.core.bll.RemoveSnapshotCommand] (ajp-/ Lock freed to object EngineLock [exclusiveLocks= key: c7c37f0b-e884-4737-accc-8960a4ebfa15 value: VM
, sharedLocks= ]

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Create vm with thin provision disk
2. Deactivate and detach disk (Remove but not permanently remove)
3. Add new disk to vm
4. Create snapshot of vm
5. Remove snapshot

Actual results:
Remove snapshot fails

Expected results:
Snapshot should be removed

Additional info:
Snapshot does not appear to be active in the DB, trying to remove snapshot 'snapshot' according to webadmin portal:

bash-4.1$ psql -d engine -c "select * from snapshots;"
             snapshot_id              |                vm_id                 | snapshot_type | status | description |       creation_date        | app_list |                                                        
 b8861c23-c1cc-4a5a-9979-f8e994bbb886 | c7c37f0b-e884-4737-accc-8960a4ebfa15 | ACTIVE        | OK     | Active VM   | 2013-10-03 17:33:20.017+03 |          |                                                        
 f506babf-4a1f-4340-831b-2531572e47ce | c7c37f0b-e884-4737-accc-8960a4ebfa15 | REGULAR       | OK     | snapshot    | 2013-10-03 17:38:13.586+03 |          | <?xml version='1.0' encoding='UTF-8'?><ovf:Envelope xml
(2 rows)
Comment 1 Daniel Erez 2013-10-06 10:23:33 EDT
The issue relies in the manner we verify that the image is not active (in RemoveSnapshotCommand). The method is based on fetching all images by snapshot ID, however, as the snapshot ID isn't cleared when detaching a disk; also floating disk images may be examined. Since floating disk images aren't relevant with regards to snapshots, they shouldn't be taken into account. Therefore, the suggested solution covers the underlying problem, i.e. clearing snapshot ID when detaching a disk.
Comment 2 Ayal Baron 2013-10-08 04:21:22 EDT
Looking at the 2 patches, shouldn't we also have an upgrade script that removes snapshot_id from floating disks?
Comment 3 Elad 2013-10-27 10:34:21 EDT
Snapshot removal finishes successfully after detaching vm's bootable disk.
Checked according to steps.

Verified on is20:
Comment 4 Itamar Heim 2014-01-21 17:21:23 EST
Closing - RHEV 3.3 Released
Comment 5 Itamar Heim 2014-01-21 17:26:46 EST
Closing - RHEV 3.3 Released

Note You need to log in before you can comment on or make changes to this bug.