Bug 825809

Summary: [Storage][Snapshots] Null pointer exception when trying to remove snapshots when VM has no disks.
Product: Red Hat Enterprise Virtualization Manager Reporter: Leonid Natapov <lnatapov>
Component: ovirt-engineAssignee: Allon Mureinik <amureini>
Status: CLOSED CURRENTRELEASE QA Contact: vvyazmin <vvyazmin>
Severity: high Docs Contact:
Priority: unspecified    
Version: 3.1.0CC: abaron, acathrow, dyasny, hateya, iheim, lpeer, Rhev-m-bugs, yeylon, ykaul
Target Milestone: ---   
Target Release: 3.1.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: storage
Fixed In Version: SI13 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Storage RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
log file none

Description Leonid Natapov 2012-05-28 14:10:17 UTC
Created attachment 587243 [details]
log file

[Storage][Snapshots] Null pointer exception when trying to remove snapshots when VM has no disks.

How to reproduce:
1.Create VM with disk or several disks.
2.Create snapshot.
3.Delete disks.
4.Try to remove snapshot.

It is not clear what was the decision about what should happen to a snapshots when removing VM's disks. If we want to leave the snapshot we have to handle all the snapshot's actions like preview,commit,delete.

engine.log attached.

Comment 1 Asaf Shakarchi 2012-07-03 13:49:10 UTC
Not a NPE but IndexOutOfBoundsException,

To clarify the expected behaviour:

- When a disk is deleted, the snapshot should be kept, this is the current behaviour which is fine.

- A snapshot should be deleted silently when a disk is not available any longer.

- Preview should restore the disk entity in RHEVM but the disk state should be 'illegal'. currently preview with a deleted disk causes another exception, I'll open another BZ for this issue.

Comment 2 Allon Mureinik 2012-07-10 11:24:19 UTC
This usecase is blocked by the UI (i.e., manipulating snapshots with no disks), with commit hash f8ba703f72737d585811bc36fc6106aa84cafe6a.

Do we want to remove this block, and address the bug? What is the expected behavior?

Comment 3 Allon Mureinik 2012-07-10 11:33:17 UTC
ignore last comment - misunderstood the flow.

Comment 4 Allon Mureinik 2012-07-23 16:13:41 UTC
patch http://gerrit.ovirt.org/#/c/6119/ was MERGED.

steps to reproduce are as described in Leonid's initial message.

Comment 5 Haim 2012-07-29 14:40:02 UTC
verified on SI12 - snapshot is now removed.

there is a small bug that removeSnapshot is missing from exception messages, will open a new one since i don't know if its related.

2012-07-29 20:56:49,287 WARN  [org.ovirt.engine.core.dal.job.ExecutionMessageDirector] (ajp-/127.0.0.1:8009-15) [2c369c68] The message key RemoveSnapshot is missing from bundles/ExecutionMessages
2012-07-29 20:56:49,388 INFO  [org.ovirt.engine.core.bll.RemoveSnapshotCommand] (ajp-/127.0.0.1:8009-15) [2c369c68] Lock Acquired to object EngineLock [exclusiveLocks= key: 9c9bc1f1-8f90-4464-bfb4-0bf73a478c74 value: VM
, sharedLocks= ]
2012-07-29 20:56:49,392 INFO  [org.ovirt.engine.core.vdsbroker.irsbroker.IsValidVDSCommand] (ajp-/127.0.0.1:8009-15) [2c369c68] START, IsValidVDSCommand(storagePoolId = 77887fd1-3408-44ec-8de4-153948d89cdc, ignoreFailoverLimit = false, compatabilityVersion = null), log id: 1509eea8
2012-07-29 20:56:49,393 INFO  [org.ovirt.engine.core.vdsbroker.irsbroker.IsValidVDSCommand] (ajp-/127.0.0.1:8009-15) [2c369c68] FINISH, IsValidVDSCommand, return: true, log id: 1509eea8
2012-07-29 20:56:49,630 INFO  [org.ovirt.engine.core.bll.RemoveSnapshotCommand] (ajp-/127.0.0.1:8009-15) [2c369c68] Running command: RemoveSnapshotCommand internal: false. Entities affected :  ID: 9c9bc1f1-8f90-4464-bfb4-0bf73a478c74 Type: VM
2012-07-29 20:56:49,777 INFO  [org.ovirt.engine.core.bll.RemoveSnapshotCommand] (ajp-/127.0.0.1:8009-15) [2c369c68] Lock freed to object EngineLock [exclusiveLocks= key: 9c9bc1f1-8f90-4464-bfb4-0bf73a478c74 value: VM
, sharedLocks= ]
2012-07-29 20:57:51,705 INFO  [org.ovirt.engine.core.bll.AsyncTaskManager] (QuartzScheduler_Worker-42) Setting new tasks map. The map contains now 0 tasks
2012-07-29 20:57:51,705 INFO  [org.ovirt.engine.core.bll.AsyncTaskManager] (QuartzScheduler_Worker-42) Cleared all tasks of pool 77887fd1-3408-44ec-8de4-153948d89cdc