Bug 1115127

Summary: Live deletion of a snapshot (live merge) fails to find constructor for RemoveSnapshotSingleDiskLiveCommand
Product: [Retired] oVirt Reporter: Federico Simoncelli <fsimonce>
Component: ovirt-engine-coreAssignee: Ravi Nori <rnori>
Status: CLOSED CURRENTRELEASE QA Contact: Ori Gofen <ogofen>
Severity: urgent Docs Contact:
Priority: unspecified    
Version: 3.5CC: acanan, amureini, gklein, gpadgett, iheim, oourfali, rbalakri, rnori, yeylon, yzaslavs
Target Milestone: ---   
Target Release: 3.5.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: storage
Fixed In Version: ovirt-3.5.0-beta1.1 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-10-17 12:22:01 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:
Bug Depends On: 1102881    
Bug Blocks: 1073943    

Description Federico Simoncelli 2014-07-01 15:42:51 UTC
Description of problem:
Live deletion of a snapshot (live merge) fails to find constructor for RemoveSnapshotSingleDiskLiveCommand:

2014-07-01 17:26:07,384 ERROR [org.ovirt.engine.core.bll.CommandsFactory] (http-/0.0.0.0:8080-3) [7ed688d2] Cant find constructor for type org.ovirt.engine.core.bll.RemoveSnapshotSingleDiskLiveCommand with parameter types: [class org.ovirt.engine.core.common.action.RemoveSnapshotSingleDiskParameters]
2014-07-01 17:26:07,385 ERROR [org.ovirt.engine.core.bll.CommandsFactory] (http-/0.0.0.0:8080-3) [7ed688d2] An exception has occured while trying to create a command object for command RemoveSnapshotSingleDiskLive: java.lang.RuntimeException: could not find matching constructor for Command class class org.ovirt.engine.core.bll.RemoveSnapshotSingleDiskLiveCommand
        at org.ovirt.engine.core.bll.CommandsFactory.findCommandConstructor(CommandsFactory.java:197) [bll.jar:]
        at org.ovirt.engine.core.bll.CommandsFactory.createCommand(CommandsFactory.java:61) [bll.jar:]
        at org.ovirt.engine.core.bll.CommandsFactory.createCommand(CommandsFactory.java:53) [bll.jar:]
        at org.ovirt.engine.core.bll.tasks.CommandExecutor.executeAsyncCommand(CommandExecutor.java:109) [bll.jar:]
        at org.ovirt.engine.core.bll.tasks.CommandCoordinatorImpl.executeAsyncCommand(CommandCoordinatorImpl.java:76) [bll.jar:]
        at org.ovirt.engine.core.bll.tasks.TaskManagerUtil.executeAsyncCommand(TaskManagerUtil.java:167) [bll.jar:]
        at org.ovirt.engine.core.bll.RemoveSnapshotCommand.removeImages(RemoveSnapshotCommand.java:171) [bll.jar:]
        at org.ovirt.engine.core.bll.RemoveSnapshotCommand.executeCommand(RemoveSnapshotCommand.java:123) [bll.jar:]
        at org.ovirt.engine.core.bll.CommandBase.executeWithoutTransaction(CommandBase.java:1135) [bll.jar:]
        at org.ovirt.engine.core.bll.CommandBase.executeActionInTransactionScope(CommandBase.java:1253) [bll.jar:]
        at org.ovirt.engine.core.bll.CommandBase.runInTransaction(CommandBase.java:1844) [bll.jar:]
        at org.ovirt.engine.core.utils.transaction.TransactionSupport.executeInNewTransaction(TransactionSupport.java:210) [utils.jar:]
        at org.ovirt.engine.core.utils.transaction.TransactionSupport.executeInRequired(TransactionSupport.java:149) [utils.jar:]
        at org.ovirt.engine.core.utils.transaction.TransactionSupport.executeInScope(TransactionSupport.java:118) [utils.jar:]
        at org.ovirt.engine.core.bll.CommandBase.execute(CommandBase.java:1274) [bll.jar:]
        at org.ovirt.engine.core.bll.CommandBase.executeAction(CommandBase.java:343) [bll.jar:]
        at org.ovirt.engine.core.bll.Backend.runAction(Backend.java:430) [bll.jar:]
        at org.ovirt.engine.core.bll.Backend.runActionImpl(Backend.java:411) [bll.jar:]
        at org.ovirt.engine.core.bll.Backend.runAction(Backend.java:369) [bll.jar:]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_60]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_60]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_60]
        at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_60]


Version-Release number of selected component (if applicable):
ovirt-engine-3.5 - git hash: 0b16ed7

How reproducible:
100%

Steps to Reproduce:
1. Try to delete a snapshot while the VM is running (I had 2 snapshots and I tried to remove the internal one)

Actual results:
Operation fails with the above stacktrace, snapshot is removed from db but not from storage.

Expected results:
Operation should successfully run RemoveSnapshotSingleDiskLiveCommand.

Comment 1 Federico Simoncelli 2014-07-01 15:53:49 UTC
It seems that also another command is affected:

2014-07-01 17:52:10,080 INFO  [org.ovirt.engine.core.bll.RemoveSnapshotSingleDiskLiveCommand] (DefaultQuartzScheduler_Worker-59) [191ea7e5] Executing Live Merge command step MERGE
2014-07-01 17:52:10,101 ERROR [org.ovirt.engine.core.bll.CommandsFactory] (DefaultQuartzScheduler_Worker-59) [191ea7e5] Cant find constructor for type org.ovirt.engine.core.bll.MergeCommand with parameter types: [class org.ovirt.engine.core.common.action.MergeParameters]
2014-07-01 17:52:10,102 ERROR [org.ovirt.engine.core.bll.CommandsFactory] (DefaultQuartzScheduler_Worker-59) [191ea7e5] An exception has occured while trying to create a command object for command Merge: java.lang.RuntimeException: could not find matching constructor for Command class class org.ovirt.engine.core.bll.MergeCommand
        at org.ovirt.engine.core.bll.CommandsFactory.findCommandConstructor(CommandsFactory.java:197) [bll.jar:]
        at org.ovirt.engine.core.bll.CommandsFactory.createCommand(CommandsFactory.java:61) [bll.jar:]
        at org.ovirt.engine.core.bll.CommandsFactory.createCommand(CommandsFactory.java:53) [bll.jar:]
        at org.ovirt.engine.core.bll.tasks.CommandExecutor.executeAsyncCommand(CommandExecutor.java:109) [bll.jar:]
        at org.ovirt.engine.core.bll.tasks.CommandCoordinatorImpl.executeAsyncCommand(CommandCoordinatorImpl.java:76) [bll.jar:]
        at org.ovirt.engine.core.bll.tasks.TaskManagerUtil.executeAsyncCommand(TaskManagerUtil.java:167) [bll.jar:]
        at org.ovirt.engine.core.bll.RemoveSnapshotSingleDiskLiveCommand.proceedCommandExecution(RemoveSnapshotSingleDiskLiveCommand.java:145) [bll.jar:]
        at org.ovirt.engine.core.bll.RemoveSnapshotSingleDiskLiveCommandCallback.doPolling(RemoveSnapshotSingleDiskLiveCommandCallback.java:18) [bll.jar:]
        at org.ovirt.engine.core.bll.tasks.CommandExecutor.invokeCallbackMethods(CommandExecutor.java:75) [bll.jar:]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_60]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_60]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_60]
        at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_60]
        at org.ovirt.engine.core.utils.timer.JobWrapper.execute(JobWrapper.java:60) [scheduler.jar:]
        at org.quartz.core.JobRunShell.run(JobRunShell.java:213) [quartz.jar:]
        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:557) [quartz.jar:]

Comment 2 Greg Padgett 2014-07-01 16:06:40 UTC
Ravi, can you take a look?  Seems that CommandExecutor isn't looking for constructors with the CommandContext parameters, which affects all the internal Live Merge commands.

Comment 3 Ravi Nori 2014-07-01 21:47:00 UTC
Can be resolved by adding constructors with out CommandContext

public RemoveSnapshotSingleDiskLiveCommand(T parameters) {
..
}

Comment 4 Greg Padgett 2014-07-01 21:57:36 UTC
(In reply to Ravi Nori from comment #3)
> Can be resolved by adding constructors with out CommandContext
> 
> public RemoveSnapshotSingleDiskLiveCommand(T parameters) {
> ..
> }

Thanks Ravi.  I was under the impression that internal commands, such as those affected here, only needed a single constructor accepting parameters and the context ([1], section 3).  If that's not true for CommandExecutor-style commands I think that's fine, we just need to be sure to establish a convention.  We also will want to ensure we don't need to support any of the context modifications ([1], section 1).

[1] http://lists.ovirt.org/pipermail/devel/2014-June/007869.html

Comment 5 Ravi Nori 2014-07-01 22:09:30 UTC
CommandCoordinator has to be modified to persist and use command context to look up constructors, but command context is not serializable. I am working on it.

Comment 6 Yair Zaslavsky 2014-07-02 12:19:19 UTC
(In reply to Greg Padgett from comment #4)
> (In reply to Ravi Nori from comment #3)
> > Can be resolved by adding constructors with out CommandContext
> > 
> > public RemoveSnapshotSingleDiskLiveCommand(T parameters) {
> > ..
> > }
> 
> Thanks Ravi.  I was under the impression that internal commands, such as
> those affected here, only needed a single constructor accepting parameters
> and the context ([1], section 3).  If that's not true for
> CommandExecutor-style commands I think that's fine, we just need to be sure
> to establish a convention.  We also will want to ensure we don't need to
> support any of the context modifications ([1], section 1).
> 
> [1] http://lists.ovirt.org/pipermail/devel/2014-June/007869.html

That depends how you're invoking the command.

Comment 7 Yair Zaslavsky 2014-07-02 12:22:38 UTC
What I meant in my last comment -
Currently we cannot limit invoking internal commands to only the case where context is passed. Therefore, there might be cases where you will need a ctor without context.

Comment 10 Sandro Bonazzola 2014-10-17 12:22:01 UTC
oVirt 3.5 has been released and should include the fix for this issue.