Bug 1015170 - [engine] Unable to remove snapshot after detaching disk from vm
Summary: [engine] Unable to remove snapshot after detaching disk from vm
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine
Version: 3.3.0
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
: 3.3.0
Assignee: Daniel Erez
QA Contact: Elad
URL:
Whiteboard: storage
Depends On:
Blocks: 3.3snap1
TreeView+ depends on / blocked
 
Reported: 2013-10-03 14:43 UTC by Gadi Ickowicz
Modified: 2016-02-10 16:52 UTC (History)
12 users (show)

Fixed In Version: is19
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed:
oVirt Team: Storage
Target Upstream Version:
Embargoed:
amureini: Triaged+


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


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 19895 0 None None None Never
oVirt gerrit 19936 0 None None None Never
oVirt gerrit 19976 0 None None None Never
oVirt gerrit 19999 0 None None None Never
oVirt gerrit 20000 0 None None None Never
oVirt gerrit 20001 0 None None None Never

Description Gadi Ickowicz 2013-10-03 14:43:32 UTC
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)

Comment 1 Daniel Erez 2013-10-06 14:23:33 UTC
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 08:21:22 UTC
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 14:34:21 UTC
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

Comment 4 Itamar Heim 2014-01-21 22:21:23 UTC
Closing - RHEV 3.3 Released

Comment 5 Itamar Heim 2014-01-21 22:26:46 UTC
Closing - RHEV 3.3 Released


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