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-/127.0.0.1:8702-4) 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-/127.0.0.1:8702-4) 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-/127.0.0.1:8702-4) Lock freed to object EngineLock [exclusiveLocks= key: c7c37f0b-e884-4737-accc-8960a4ebfa15 value: VM , sharedLocks= ] Version-Release number of selected component (if applicable): rhevm-3.3.0-0.24.master.el6ev.noarch How reproducible: 100% 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)
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.
Looking at the 2 patches, shouldn't we also have an upgrade script that removes snapshot_id from floating disks?
Snapshot removal finishes successfully after detaching vm's bootable disk. Checked according to steps. Verified on is20: rhevm-3.3.0-0.28.beta1.el6ev.noarch vdsm-4.13.0-0.5.beta1.el6ev.x86_64
Closing - RHEV 3.3 Released