Created attachment 601033 [details] log Description of problem: I created a vm with 1 direct lun disk and one regular disk as stateless we are running the vm and creating a snapshot but when I stop the vm we get an error that we failed to stop the vm (although the vm is stopped). looking at the engine log I can see java.lang.IndexOutOfBoundsException on RestoreAllSnapshotsCommand. we cannot remove the snapshot (even when I perminatly removed the disk from the vm) and can no longer run the vm. Version-Release number of selected component (if applicable): si12 How reproducible: 100% Steps to Reproduce: 1. create a vm with one direct lun + 1 disk 2. run vm as stateless 3. stop vm Actual results: we get an alert that we failed to stop the vm but vm stops snapshot cannot be deleted manually we cannot run vm because if a stateless snapshot exist we try to delete it again and fail even when manually removing the disk the snapshot remains under the vm when I detach the direct lun, the vm remains with no disks at all but with an existing snapshot Expected results: we should be able to remove the snapshot Additional info:complete engine log
this is not a regression from 3.0 where there was no direct lun
regression is added since statless + direct lun worked in si6 (when I last tested) and is not working on si12
I checked direct lun + regular disk with preview (not stateless snapshot) and we are getting the same: 2012-07-29 17:37:16,743 ERROR [org.ovirt.engine.core.bll.EntityAsyncTask] (pool-4-thread-47) EntityAsyncTask::EndCommandAction [within thread]: EndAction for action type TryBac kToAllSnapshotsOfVm threw an exception: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 at java.util.ArrayList.rangeCheck(ArrayList.java:604) [rt.jar:1.7.0_05-icedtea] at java.util.ArrayList.get(ArrayList.java:382) [rt.jar:1.7.0_05-icedtea] at org.ovirt.engine.core.bll.snapshots.SnapshotsManager.removeDisksNotInSnapshot(SnapshotsManager.java:379) [engine-bll.jar:] at org.ovirt.engine.core.bll.snapshots.SnapshotsManager.synchronizeDisksFromSnapshot(SnapshotsManager.java:367) [engine-bll.jar:] at org.ovirt.engine.core.bll.snapshots.SnapshotsManager.attempToRestoreVmConfigurationFromSnapshot(SnapshotsManager.java:218) [engine-bll.jar:] at org.ovirt.engine.core.bll.TryBackToAllSnapshotsOfVmCommand.restoreVmConfigFromSnapshot(TryBackToAllSnapshotsOfVmCommand.java:92) [engine-bll.jar:] at org.ovirt.engine.core.bll.TryBackToAllSnapshotsOfVmCommand.EndSuccessfully(TryBackToAllSnapshotsOfVmCommand.java:76) [engine-bll.jar:] at org.ovirt.engine.core.bll.CommandBase.InternalEndSuccessfully(CommandBase.java:476) [engine-bll.jar:] at org.ovirt.engine.core.bll.CommandBase.endActionInTransactionScope(CommandBase.java:431) [engine-bll.jar:] at org.ovirt.engine.core.bll.CommandBase.runInTransaction(CommandBase.java:1243) [engine-bll.jar:] at org.ovirt.engine.core.utils.transaction.TransactionSupport.executeInNewTransaction(TransactionSupport.java:204) [engine-utils.jar:] at org.ovirt.engine.core.utils.transaction.TransactionSupport.executeInRequired(TransactionSupport.java:142) [engine-utils.jar:] at org.ovirt.engine.core.utils.transaction.TransactionSupport.executeInScope(TransactionSupport.java:109) [engine-utils.jar:] at org.ovirt.engine.core.bll.CommandBase.EndAction(CommandBase.java:377) [engine-bll.jar:] at org.ovirt.engine.core.bll.Backend.endAction(Backend.java:355) [engine-bll.jar:] at sun.reflect.GeneratedMethodAccessor423.invoke(Unknown Source) [:1.7.0_05-icedtea] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_05-icedtea] at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_05-icedtea] at org.jboss.as.ee.component.ManagedReferenceMethodInterceptorFactory$ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptorFactory.java: 72) [jboss-as-ee.jar:7.1.2.Final-redhat-1] at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation.jar:1.1.1.Final-redhat-1] at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:374) [jboss-invocation.jar:1.1.1.Final-redhat-1] at org.ovirt.engine.core.utils.ThreadLocalSessionCleanerInterceptor.injectWebContextToThreadLocal(ThreadLocalSessionCleanerInterceptor.java:11) [engine-utils.jar:] at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source) [:1.7.0_05-icedtea] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_05-icedtea] at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_05-icedtea] at org.jboss.as.ee.component.ManagedReferenceLifecycleMethodInterceptorFactory$ManagedReferenceLifecycleMethodInterceptor.processInvocation(ManagedReferenceLifecycleMet hodInterceptorFactory.java:123) [jboss-as-ee.jar:7.1.2.Final-redhat-1]
proposed solution is at: http://gerrit.ovirt.org/#/c/6768/
Merged to upstream at commit #d5227631e4231eb21186ff22172e67d2d68c8060
verified on si15. started a vm with 1 external disk and 1 direct lun as stateless and then stopped it. snapshot was deleted as a part of stop action.