Bug 1419364 - Fail to register an unregistered Template through REST due to an NPE when calling updateMaxMemorySize
Summary: Fail to register an unregistered Template through REST due to an NPE when cal...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: ovirt-engine
Classification: oVirt
Component: Backend.Core
Version: 4.1.0
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ovirt-4.1.1
: 4.1.1
Assignee: Maor
QA Contact: sefi litmanovich
URL:
Whiteboard:
: 1419470 (view as bug list)
Depends On:
Blocks: 1393257
TreeView+ depends on / blocked
 
Reported: 2017-02-05 23:38 UTC by Maor
Modified: 2017-04-21 09:44 UTC (History)
3 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2017-04-21 09:44:22 UTC
oVirt Team: Storage
Embargoed:
rule-engine: ovirt-4.1+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 71688 0 master MERGED core: Avoid NPE when importing unregistered Template. 2020-02-03 17:31:55 UTC
oVirt gerrit 71691 0 ovirt-engine-4.1 MERGED core: Avoid NPE when importing unregistered Template. 2020-02-03 17:31:56 UTC

Description Maor 2017-02-05 23:38:28 UTC
Description of problem:
Registering a Template will cause an NPE since the init function of ImportVmTemplateFromConfigurationCommand executes updateMaxMemorySize which uses getVmTemplate().
Since unregistered entities does not exist in the vm_static table getVmTemplate() returns null.

This is probably related to the change introduced in https://gerrit.ovirt.org/#/c/67747/

2017-02-05 15:51:26,601+02 ERROR [org.ovirt.engine.core.bll.CommandsFactory] (default task-46) [d1ab8f8b-98d0-4d5f-8282-ec88677fcb32] An exception has occurred while trying to create a comma
nd object for command 'ImportVmTemplateFromConfiguration' with parameters 'ImportVmTemplateParameters:{commandId='824772de-3d01-45ae-b530-5c5c6fa0e8b1', user='null', commandType='Unknown'}':
 WELD-000049: Unable to invoke protected final void org.ovirt.engine.core.bll.CommandBase.postConstruct() on org.ovirt.engine.core.bll.exportimport.ImportVmTemplateFromConfigurationCommand@2
b8292ad
2017-02-05 15:51:26,611+02 ERROR [org.ovirt.engine.api.restapi.resource.AbstractBackendResource] (default task-46) [] Operation Failed: java.lang.NullPointerException
2017-02-05 15:51:26,611+02 ERROR [org.ovirt.engine.api.restapi.resource.AbstractBackendResource] (default task-46) [] Exception: javax.ejb.EJBException: java.lang.NullPointerException
        at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleExceptionInNoTx(CMTTxInterceptor.java:213) [wildfly-ejb3-10.1.0.Final.jar:10.1.0.Final]
        at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInNoTx(CMTTxInterceptor.java:265) [wildfly-ejb3-10.1.0.Final.jar:10.1.0.Final]
        at org.jboss.as.ejb3.tx.CMTTxInterceptor.supports(CMTTxInterceptor.java:374) [wildfly-ejb3-10.1.0.Final.jar:10.1.0.Final]
        at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:243) [wildfly-ejb3-10.1.0.Final.jar:10.1.0.Final]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
        at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41) [wildfly-ejb3-10.1.0.Final.jar:10.1.0.F
inal]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
        at org.jboss.as.ejb3.component.invocationmetrics.WaitTimeInterceptor.processInvocation(WaitTimeInterceptor.java:47) [wildfly-ejb3-10.1.0.Final.jar:10.1.0.Final]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
        at org.jboss.as.ejb3.security.SecurityContextInterceptor.processInvocation(SecurityContextInterceptor.java:100) [wildfly-ejb3-10.1.0.Final.jar:10.1.0.Final]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
        at org.jboss.as.ejb3.deployment.processors.StartupAwaitInterceptor.processInvocation(StartupAwaitInterceptor.java:22) [wildfly-ejb3-10.1.0.Final.jar:10.1.0.Final]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
        at org.jboss.as.ejb3.component.interceptors.ShutDownInterceptorFactory$1.processInvocation(ShutDownInterceptorFactory.java:64) [wildfly-ejb3-10.1.0.Final.jar:10.1.0.Final]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
        at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:67) [wildfly-ejb3-10.1.0.Final.jar:10.1.0.Final]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
        at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
        at org.jboss.invocation.ContextClassLoaderInterceptor.processInvocation(ContextClassLoaderInterceptor.java:64)
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
        at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:356)

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

How reproducible:
100%

Steps to Reproduce:
Make sure you have an active DC with multiple storage domains.
1. Create a VM with one disk on a storage domain
2. Create a Template from that VM
3. Move the Storage Domain to maintenance and detach it from the DC
4. Attach the Storage Domain back again and activate it
5. Try to register the Template to the engine using the following REST command:

POST /api/storagedomains/xxxxxxx-xxxx-xxxx-xxxxxx/templates/xxxxxxx-xxxx-xxxx-xxxxxx/register HTTP/1.1
Accept: application/xml
Content-type: application/xml

<action>
    <cluster id='bf5a9e9e-5b52-4b0d-aeba-4ee4493f1072'></cluster>
</action>

Actual results:

NPE

<action>
    <allow_partial_import>true</allow_partial_import>
    <cluster id="a205d3ea-e61c-4d0e-ad55-daaf4ab7f782"/>
    <fault>
        <detail>java.lang.NullPointerException</detail>
        <reason>Operation Failed</reason>
    </fault>
    <status>failed</status>
</action>


Expected results:
The registration should succeed

Additional info:

Comment 1 Tal Nisan 2017-02-06 09:41:30 UTC
*** Bug 1419470 has been marked as a duplicate of this bug. ***

Comment 2 sefi litmanovich 2017-02-14 13:31:10 UTC
Verified on rhevm-4.1.1-0.1.el7.noarch according to the steps in description. Template was imported/registered as expected.


Note You need to log in before you can comment on or make changes to this bug.