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

Bug 1402088

Summary: General command validation failure on validateMacs when importing an unregistered VM with wrong id
Product: [oVirt] ovirt-engine Reporter: Maor <mlipchuk>
Component: RestAPIAssignee: Maor <mlipchuk>
Status: CLOSED CURRENTRELEASE QA Contact: Eyal Shenitzky <eshenitz>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 4.1.0CC: amureini, bugs, gklein
Target Milestone: ovirt-4.1.0-alphaFlags: rule-engine: ovirt-4.1+
Target Release: 4.1.0.2   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-02-01 14:55:24 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:

Description Maor 2016-12-06 18:07:30 UTC
Description of problem:
General command validation failure on validateMacs when trying to import an unregistered VM with wrong guid.

For example if a VM is with guid 1234, try to import it with the following URL:
api/storagedomains/baa669dd-f8d8-4206-a904-c9f80bbeafee/vms/6666/register

The body should be standard:
<action>
    <cluster id='bf5a9e9e-5b52-4b0d-aeba-4ee4493f1072'></cluster>
</action>

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


How reproducible:
100%

Steps to Reproduce:
1. Try to register a VM with non existing guid or from a storage domain which does not exists
2. 
3.

Actual results:
An NPE is being thrown and the user will get a "General command validation failure."

Expected results:
An NPE should not be thrown and a proper message should be performed indicating the VM is not available.

Additional info:
2016-12-06 19:26:14,286+02 INFO  [org.ovirt.engine.core.bll.exportimport.ImportVmFromConfigurationCommand] (default task-5) [f6910624-93e4-4772-8022-461f1d8b19f1] Lock Acquired to object 'En
gineLock:{exclusiveLocks='null', sharedLocks='[c90f7ac1-dd50-4ed5-a8bb-4b6d41943d37=<REMOTE_VM, ACTION_TYPE_FAILED_VM_IS_BEING_IMPORTED$VmName testVM>]'}'
2016-12-06 19:26:18,195+02 INFO  [org.ovirt.engine.core.vdsbroker.vdsbroker.GetHardwareInfoVDSCommand] (DefaultQuartzScheduler9) [] FINISH, GetHardwareInfoVDSCommand, log id: 492ad52a
2016-12-06 19:26:19,218+02 ERROR [org.ovirt.engine.core.bll.exportimport.ImportVmFromConfigurationCommand] (default task-5) [f6910624-93e4-4772-8022-461f1d8b19f1] Error during ValidateFailur
e.: java.lang.NullPointerException
        at org.ovirt.engine.core.bll.exportimport.ImportVmFromConfigurationCommand.validateMacs(ImportVmFromConfigurationCommand.java:106) [bll.jar:]
        at org.ovirt.engine.core.bll.exportimport.ImportVmFromConfigurationCommand.validate(ImportVmFromConfigurationCommand.java:75) [bll.jar:]
        at org.ovirt.engine.core.bll.CommandBase.internalValidate(CommandBase.java:834) [bll.jar:]
        at org.ovirt.engine.core.bll.CommandBase.executeAction(CommandBase.java:388) [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:509) [bll.jar:]
        at org.ovirt.engine.core.bll.Backend.runActionImpl(Backend.java:491) [bll.jar:]
        at org.ovirt.engine.core.bll.Backend.runAction(Backend.java:444) [bll.jar:]
        at sun.reflect.GeneratedMethodAccessor139.invoke(Unknown Source) [:1.8.0_111]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.8.0_111]
        at java.lang.reflect.Method.invoke(Method.java:498) [rt.jar:1.8.0_111]
        at org.jboss.as.ee.component.ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptor.java:52)
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
        at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:437)
        at org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.delegateInterception(Jsr299BindingsInterceptor.java:70) [wildfly-weld-10.1.0.Final.jar:10.1.0.Final]
        at org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.doMethodInterception(Jsr299BindingsInterceptor.java:80) [wildfly-weld-10.1.0.Final.jar:10.1.0.Final]
        at org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.processInvocation(Jsr299BindingsInterceptor.java:93) [wildfly-weld-10.1.0.Final.jar:10.1.0.Final]
        at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:63)
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
        at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:437)
        at org.ovirt.engine.core.bll.interceptors.CorrelationIdTrackerInterceptor.aroundInvoke(CorrelationIdTrackerInterceptor.java:13) [bll.jar:]
        at sun.reflect.GeneratedMethodAccessor73.invoke(Unknown Source) [:1.8.0_111]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.8.0_111]
        at java.lang.reflect.Method.invoke(Method.java:498) [rt.jar:1.8.0_111]
        at org.jboss.as.ee.component.ManagedReferenceLifecycleMethodInterceptor.processInvocation(ManagedReferenceLifecycleMethodInterceptor.java:89)
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
        at org.jboss.as.ejb3.component.invocationmetrics.ExecutionTimeInterceptor.processInvocation(ExecutionTimeInterceptor.java:43) [wildfly-ejb3-10.1.0.Final.jar:10.1.0.Final]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
        at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:437)
        at org.jboss.weld.ejb.AbstractEJBRequestScopeActivationInterceptor.aroundInvoke(AbstractEJBRequestScopeActivationInterceptor.java:73) [weld-core-impl-2.3.5.Final.jar:2.3.5.Final]
        at org.jboss.as.weld.ejb.EjbRequestScopeActivationInterceptor.processInvocation(EjbRequestScopeActivationInterceptor.java:83) [wildfly-weld-10.1.0.Final.jar:10.1.0.Final]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
        at org.jboss.as.ee.concurrent.ConcurrentContextInterceptor.processInvocation(ConcurrentContextInterceptor.java:45) [wildfly-ee-10.1.0.Final.jar:10.1.0.Final]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
        at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21)
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
        at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
        at org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:52)
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
        at org.jboss.as.ejb3.component.singleton.SingletonComponentInstanceAssociationInterceptor.processInvocation(SingletonComponentInstanceAssociationInterceptor.java:53) [wildfly-ejb3-10.1.0.Final.jar:10.1.0.Final]



The REST response:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<action>
    <fault>
        <detail>[General command validation failure.]</detail>
        <reason>Operation Failed</reason>
    </fault>
    <status>failed</status>
</action>

Comment 1 Eyal Shenitzky 2017-01-24 08:12:06 UTC
 Verified with the following code:
------------------------------------------
ovirt - 
4.1.0-0.4.master.20170104181027.gitab0e3f4.el7.centos

Verified with the following scenario:
------------------------------------------
Steps to reproduce:
------------------------------------------
1. Try to register a VM with non existing guid or from a storage domain which does not exists

Result:
Received 404 (not found)
Moving to VERIFIED!