Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 847759

Summary: ovirt-engine-backend: removing disk from vm with snapshot will remove only the disk from the snapshot which will cause NPE on preview
Product: Red Hat Enterprise Virtualization Manager Reporter: Dafna Ron <dron>
Component: ovirt-engineAssignee: Allon Mureinik <amureini>
Status: CLOSED DUPLICATE QA Contact: Dafna Ron <dron>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 3.1.0CC: abaron, dyasny, iheim, lpeer, Rhev-m-bugs, sgrinber, yeylon, ykaul
Target Milestone: ---Keywords: Regression
Target Release: 3.1.0   
Hardware: x86_64   
OS: Linux   
Whiteboard: storage
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-08-15 14:41:27 UTC 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
logs none

Description Dafna Ron 2012-08-13 13:19:17 UTC
Created attachment 604008 [details]
logs

Description of problem:

I created a vm with one disk -> created snapshot -> removed the disk

the snapshot was not deleted but the disk was removed from snapshot in db only. 

I created a new disk for the vm and tried to preview the old snapshot. 
we are getting NPE and the snapshot is also marked as previewed. 

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

si13.2

How reproducible:

100%

Steps to Reproduce:
1. create a vm with one disk
2. create a snpashot
3. remove the disk
4. press preview

Actual results:

1. only the disk is removed from snapshot 
2. trying to preview the snapshot will cause NPE
3. the snapshot is still marked as preview and we have to manually change status in db to undo

Expected results:

if we cannot preview/commit a snapshot that has no disk we should not keep it in the system. 

Additional info: full logs attached

2012-08-13 16:07:35,504 ERROR [org.ovirt.engine.core.bll.TryBackToAllSnapshotsOfVmCommand] (ajp-/127.0.0.1:8009-2) [37eeea93] Command org.ovirt.engine.core.bll.TryBackToAllSnapshotsOfVmCommand throw exception: java.lang.NullPointerExcep
tion
        at org.ovirt.engine.core.utils.ovf.OvfWriter.BuildDisk(OvfWriter.java:152) [engine-utils.jar:]
        at org.ovirt.engine.core.utils.ovf.OvfManager.BuildOvf(OvfManager.java:92) [engine-utils.jar:]
        at org.ovirt.engine.core.utils.ovf.OvfManager.ExportVm(OvfManager.java:24) [engine-utils.jar:]
        at org.ovirt.engine.core.bll.VmCommand.UpdateVmInSpm(VmCommand.java:186) [engine-bll.jar:]
        at org.ovirt.engine.core.bll.VmCommand.UpdateVmInSpm(VmCommand.java:160) [engine-bll.jar:]
        at org.ovirt.engine.core.bll.TryBackToAllSnapshotsOfVmCommand.restoreVmConfigFromSnapshot(TryBackToAllSnapshotsOfVmCommand.java:96) [engine-bll.jar:]
        at org.ovirt.engine.core.bll.TryBackToAllSnapshotsOfVmCommand.ExecuteVmCommand(TryBackToAllSnapshotsOfVmCommand.java:161) [engine-bll.jar:]
        at org.ovirt.engine.core.bll.VmCommand.executeCommand(VmCommand.java:82) [engine-bll.jar:]
        at org.ovirt.engine.core.bll.CommandBase.ExecuteWithoutTransaction(CommandBase.java:810) [engine-bll.jar:]
        at org.ovirt.engine.core.bll.CommandBase.executeActionInTransactionScope(CommandBase.java:901) [engine-bll.jar:]
        at org.ovirt.engine.core.bll.CommandBase.runInTransaction(CommandBase.java:1256) [engine-bll.jar:]
        at org.ovirt.engine.core.utils.transaction.TransactionSupport.executeInSuppressed(TransactionSupport.java:168) [engine-utils.jar:]
        at org.ovirt.engine.core.utils.transaction.TransactionSupport.executeInScope(TransactionSupport.java:107) [engine-utils.jar:]
        at org.ovirt.engine.core.bll.CommandBase.Execute(CommandBase.java:916) [engine-bll.jar:]
        at org.ovirt.engine.core.bll.CommandBase.ExecuteAction(CommandBase.java:275) [engine-bll.jar:]
        at org.ovirt.engine.core.bll.Backend.runActionImpl(Backend.java:335) [engine-bll.jar:]
        at org.ovirt.engine.core.bll.Backend.RunAction(Backend.java:293) [engine-bll.jar:]
        at sun.reflect.GeneratedMethodAccessor169.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.GeneratedMethodAccessor22.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(ManagedReferenceLifecycleMethodInterceptorFactory.java:123) [jboss-as-ee.jar:7.1.2.Final
-redhat-1]

Comment 1 Dafna Ron 2012-08-13 13:21:43 UTC
marking as urgent since snapshot is still marked as previewed and we cannot undo which means that we have to manually change the snapshot state in DB or we will not be able to use other snapshot or run the vm with no active image.

Comment 2 Simon Grinberg 2012-08-13 16:41:18 UTC
Dafna, this happens only if the last disk is remove? 
any disk? 

Not sure about the urgency if it's just the first case.

Comment 3 Dafna Ron 2012-08-15 07:09:14 UTC
removing the disk from snapshot when there is more than one disk is the correct behaviour (this is the way things have worked in the past)
but when there is only one disk the behaviour was to remove the entire snapshot.

Comment 4 Dafna Ron 2012-08-15 07:47:33 UTC
same behaviour changed applies to creating a snapshot when there is no disk. 
we can create the snapshot but preview will issue an alert that snapshot does not exist and yet would mark the snapshot as previewed. 

Error:

Dafna:

    Cannot revert to Snapshot. VM's Snapshot does not exist.

when pressing the undo we get the following alert: 

Error:

Dafna:

    Cannot revert to Snapshot. VM's Snapshot does not exist.

Comment 5 Allon Mureinik 2012-08-15 13:37:45 UTC
previewing works for me with commit hash 0fd794e1f8ad92dbf2ec7f2d3fe6d3799ff413ff.

Undoing the preview will be fixed in response to bug https://bugzilla.redhat.com/show_bug.cgi?id=848298.

Dafna, can I mark this as a duplicate?

Comment 6 Dafna Ron 2012-08-15 14:41:27 UTC
of course : ) it is a duplicate

*** This bug has been marked as a duplicate of bug 848298 ***