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

Bug 1623818

Summary: [4.2.z Clone] An exception is thrown when creating a template from snapshot with less disks then the active VM
Product: [oVirt] ovirt-engine Reporter: Tal Nisan <tnisan>
Component: BLL.StorageAssignee: Tal Nisan <tnisan>
Status: CLOSED CURRENTRELEASE QA Contact: Elad <ebenahar>
Severity: high Docs Contact:
Priority: unspecified    
Version: 4.2.6CC: bugs, ebenahar, eshenitz, sleviim, tnisan
Target Milestone: ovirt-4.2.7Flags: rule-engine: ovirt-4.2+
rule-engine: ovirt-4.3+
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ovirt-engine-4.2.7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1573421 Environment:
Last Closed: 2018-11-02 14:33:28 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: 1573421    
Bug Blocks:    

Description Tal Nisan 2018-08-30 09:31:38 UTC
+++ This bug was initially created as a clone of Bug #1573421 +++

Description of problem:

When having a VM with a snapshot that contains fewer disks
then the active-snapshot an exception is thrown and the operation failed


Version-Release number of selected component (if applicable):
master-4.3.0 - from commit 56af10f17ad1ed06611c99abec486fe03e91dd3e

How reproducible:
100%

Steps to Reproduce:
1. Create a VM with disk
2. Create a snapshot of the VM from step 1
3. Add another disk to the VM
4. Try to create a template from the snapshot in step 2

Actual results:
An exception is thrown

Expected results:
The template should create successfully

Additional info:

Part of the engine log-

2018-05-01 10:37:08,444+03 ERROR [org.ovirt.engine.core.bll.storage.disk.image.CreateImageTemplateCommand] (default task-59) [6bf12d96-0ba7-4dee-abdb-a47cfe45907f] Transaction rolled-back for command 'org.ovirt.engine.core.bll.storage.disk.image.CreateImageTemplateCommand'.
2018-05-01 10:37:08,444+03 INFO  [org.ovirt.engine.core.utils.transaction.TransactionSupport] (default task-59) [6bf12d96-0ba7-4dee-abdb-a47cfe45907f] transaction rolled back
2018-05-01 10:37:08,445+03 ERROR [org.ovirt.engine.core.bll.storage.disk.CreateAllTemplateDisksFromSnapshotCommand] (default task-59) [6bf12d96-0ba7-4dee-abdb-a47cfe45907f] Command 'org.ovirt.engine.core.bll.storage.disk.CreateAllTemplateDisksFromSnapshotCommand' failed: 1
2018-05-01 10:37:08,445+03 ERROR [org.ovirt.engine.core.bll.storage.disk.CreateAllTemplateDisksFromSnapshotCommand] (default task-59) [6bf12d96-0ba7-4dee-abdb-a47cfe45907f] Exception: java.lang.ArrayIndexOutOfBoundsException: 1
	at org.ovirt.engine.core.bll.storage.disk.CreateAllTemplateDisksCommand.addVmTemplateImage(CreateAllTemplateDisksCommand.java:134) [bll.jar:]
	at org.ovirt.engine.core.bll.storage.disk.CreateAllTemplateDisksCommand.lambda$addVmTemplateImages$1(CreateAllTemplateDisksCommand.java:129) [bll.jar:]
	at java.util.ArrayList.forEach(ArrayList.java:1257) [rt.jar:1.8.0_161]
	at org.ovirt.engine.core.bll.storage.disk.CreateAllTemplateDisksCommand.addVmTemplateImages(CreateAllTemplateDisksCommand.java:129) [bll.jar:]
	at org.ovirt.engine.core.bll.storage.disk.CreateAllTemplateDisksCommand.lambda$executeCommand$0(CreateAllTemplateDisksCommand.java:83) [bll.jar:]
	at org.ovirt.engine.core.utils.transaction.TransactionSupport.executeInNewTransaction(TransactionSupport.java:202) [utils.jar:]
	at org.ovirt.engine.core.bll.storage.disk.CreateAllTemplateDisksCommand.executeCommand(CreateAllTemplateDisksCommand.java:82) [bll.jar:]
	at org.ovirt.engine.core.bll.CommandBase.executeWithoutTransaction(CommandBase.java:1133) [bll.jar:]
	at org.ovirt.engine.core.bll.CommandBase.executeActionInTransactionScope(CommandBase.java:1286) [bll.jar:]
	at org.ovirt.engine.core.bll.CommandBase.runInTransaction(CommandBase.java:1935) [bll.jar:]
	at org.ovirt.engine.core.utils.transaction.TransactionSupport.executeInSuppressed(TransactionSupport.java:164) [utils.jar:]
	at org.ovirt.engine.core.utils.transaction.TransactionSupport.executeInScope(TransactionSupport.java:103) [utils.jar:]
	at org.ovirt.engine.core.bll.CommandBase.execute(CommandBase.java:1346) [bll.jar:]
	at org.ovirt.engine.core.bll.CommandBase.executeAction(CommandBase.java:400) [bll.jar:]
	at org.ovirt.engine.core.bll.executor.DefaultBackendActionExecutor.execute(DefaultBackendActionExecutor.java:13) [bll.jar:]
	at org.ovirt.engine.core.bll.Backend.runAction(Backend.java:450) [bll.jar:]
	at org.ovirt.engine.core.bll.Backend.runActionImpl(Backend.java:432) [bll.jar:]
	at org.ovirt.engine.core.bll.Backend.runInternalAction(Backend.java:638) [bll.jar:]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.8.0_161]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [rt.jar:1.8.0_161]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.8.0_161]
	at java.lang.reflect.Method.invoke(Method.java:498) [rt.jar:1.8.0_161]
	at org.jboss.as.ee.component.ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptor.java:52)
	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
	at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:509)
	at org.jboss.as.weld.interceptors.Jsr299BindingsInterceptor.delegateInterception(Jsr299BindingsInterceptor.java:78)
	at org.jboss.as.weld.interceptors.Jsr299BindingsInterceptor.doMethodInterception(Jsr299BindingsInterceptor.java:88)
	at org.jboss.as.weld.interceptors.Jsr299BindingsInterceptor.processInvocation(Jsr299BindingsInterceptor.java:101)
	at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:63)
	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:422)
	at org.jboss.as.ejb3.component.invocationmetrics.ExecutionTimeInterceptor.processInvocation(ExecutionTimeInterceptor.java:43) [wildfly-ejb3-11.0.0.Final.jar:11.0.0.Final]

--- Additional comment from Eyal Shenitzky on 2018-05-01 10:46:35 IDT ---

Description of problem:

When having a VM with a snapshot that contains fewer disks
then the active-snapshot, an exception is thrown when trying to create a template from the snapshot and the operation failed.

--- Additional comment from Tal Nisan on 2018-05-01 15:38:51 IDT ---

Eyal, does that reproduce in 4.2.z as well?

--- Additional comment from Eyal Shenitzky on 2018-05-01 15:45:57 IDT ---

(In reply to Tal Nisan from comment #2)
> Eyal, does that reproduce in 4.2.z as well?

I didn't check but I am pretty sure that this is reproduced also in 4.2.z according to the fix.

--- Additional comment from Elad on 2018-08-19 18:29:48 IDT ---

Steps to Reproduce:
1. Create a VM with disk
2. Create a snapshot of the VM from step 1
3. Add another disk to the VM
4. Try to create a template from the snapshot in step 2

Result: Template is being created successfully.


Used:
ovirt-engine-4.3.0-0.0.master.20180815091554.gitd5455ea.el7.noarch

--- Additional comment from shani on 2018-08-30 10:51:41 IDT ---

Same issue for ovirt-engine-4.2.

Comment 1 Elad 2018-09-16 15:09:13 UTC
Template creation, from a snapshot that has fewer disks than the active VM snapshot has, succeeds.

Used:
ovirt-engine-4.2.6.5-0.0.master.20180914152430.gitb8a2050.el7.noarch
vdsm-4.20.39-15.gitae7d021.el7.x86_64

Comment 2 Raz Tamir 2018-09-16 15:30:16 UTC
QE verification bot: the bug was verified upstream

Comment 3 Sandro Bonazzola 2018-11-02 14:33:28 UTC
This bugzilla is included in oVirt 4.2.7 release, published on November 2nd 2018.

Since the problem described in this bug report should be
resolved in oVirt 4.2.7 release, it has been closed with a resolution of CURRENT RELEASE.

If the solution does not work for you, please open a new bug report.