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

Bug 920715

Summary: [engine] Creating a VM when no storage domain exists results in NullPointerException during CanDoAction
Product: Red Hat Enterprise Virtualization Manager Reporter: Gadi Ickowicz <gickowic>
Component: ovirt-engineAssignee: Martin Betak <mbetak>
Status: CLOSED WORKSFORME QA Contact: Gadi Ickowicz <gickowic>
Severity: high Docs Contact:
Priority: high    
Version: 3.2.0CC: acathrow, dron, dyasny, hateya, iheim, lpeer, lsvaty, mbetak, nlevinki, Rhev-m-bugs, yeylon, ykaul
Target Milestone: ---Keywords: Triaged
Target Release: 3.3.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: virt
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-03-28 08:40:14 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
vdsm + engine logs none

Description Gadi Ickowicz 2013-03-12 15:25:53 UTC
Created attachment 709028 [details]
vdsm + engine logs

Description of problem:
Creating a VM when no storage domain exists in datacenter returns
Operation Failed: General command validation failure


Version-Release number of selected component (if applicable):
rhevm-3.2.0-10.10.beta1.el6ev.noarch

How reproducible:
100%

Steps to Reproduce:
1. Create datacenter and add host
2. Attempt to create VM (through API) with storage domain and all parameters needed for VM creation
  
Actual results:
Creation fails with Operation Failed: General command validation failure, due to NullPointerException in CanDoAction:


2013-03-12 16:11:16,975 ERROR [org.ovirt.engine.core.bll.AddVmFromScratchCommand] (ajp-/127.0.0.1:8702-3) [77d41134] Error during CanDoActionFailure.: java.lang.NullPointerException
        at org.ovirt.engine.core.bll.AddVmCommand.fillImagesMapBasedOnTemplate(AddVmCommand.java:414) [engine-bll.jar:]
        at org.ovirt.engine.core.bll.AddVmCommand.fillDestMap(AddVmCommand.java:409) [engine-bll.jar:]
        at org.ovirt.engine.core.bll.AddVmCommand.buildAndCheckDestStorageDomains(AddVmCommand.java:360) [engine-bll.jar:]
        at org.ovirt.engine.core.bll.AddVmCommand.canDoAction(AddVmCommand.java:297) [engine-bll.jar:]
        at org.ovirt.engine.core.bll.AddVmFromScratchCommand.canDoAction(AddVmFromScratchCommand.java:140) [engine-bll.jar:]
        at org.ovirt.engine.core.bll.CommandBase.internalCanDoAction(CommandBase.java:658) [engine-bll.jar:]
        at org.ovirt.engine.core.bll.CommandBase.executeAction(CommandBase.java:311) [engine-bll.jar:]
        at org.ovirt.engine.core.bll.Backend.runActionImpl(Backend.java:361) [engine-bll.jar:]
        at org.ovirt.engine.core.bll.Backend.RunAction(Backend.java:307) [engine-bll.jar:]
        at sun.reflect.GeneratedMethodAccessor165.invoke(Unknown Source) [:1.7.0_09-icedtea]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_09-icedtea]
        at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_09-icedtea]
        at org.jboss.as.ee.component.ManagedReferenceMethodInterceptorFactory$ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptorFactory.java:72) [jboss-as-ee.jar:7.1.3.Final-redhat-4]
        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation.jar:1.1.1.Final-redhat-2]
        at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:374) [jboss-invocation.jar:1.1.1.Final-redhat-2]
        at org.ovirt.engine.core.utils.ThreadLocalSessionCleanerInterceptor.injectWebContextToThreadLocal(ThreadLocalSessionCleanerInterceptor.java:11) [engine-utils.jar:]
        at sun.reflect.GeneratedMethodAccessor28.invoke(Unknown Source) [:1.7.0_09-icedtea]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_09-icedtea]
        at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_09-icedtea]
        at org.jboss.as.ee.component.ManagedReferenceLifecycleMethodInterceptorFactory$ManagedReferenceLifecycleMethodInterceptor.processInvocation(ManagedReferenceLifecycleMethodInterceptorFactory.java:123) [jboss-as-ee.jar:7.1.3.Final-redhat-4]
.... [snip]....


2013-03-12 16:11:16,980 INFO  [org.ovirt.engine.core.bll.AddVmFromScratchCommand] (ajp-/127.0.0.1:8702-3) [77d41134] Lock freed to object EngineLock [exclusiveLocks= key: rhel_6_3_shortVM value: VM_NAME
, sharedLocks= ]
2013-03-12 16:11:16,982 ERROR [org.ovirt.engine.api.restapi.resource.AbstractBackendResource] (ajp-/127.0.0.1:8702-3) Operation Failed: [General command validation failure.]





Expected results:
Creation should fail with clear error message

Comment 1 Martin Betak 2013-03-20 11:42:56 UTC
Please could you be more specific on how you used the API to create the VM? Was it a diskless VM or from a template with disk on the storage domain? Was there no storage domain on the datacenter or was it just inaccessible?

Comment 2 Gadi Ickowicz 2013-03-20 14:17:40 UTC
I tried to create a VM on a cluster for a datacenter that has *no* storage domain. Just add datacenter, cluster and host, then POST to /api/vms:
(this is not the exact same cluster/vm id's and names from the log, I just ran this again to get the details)

<vm>
 <name>vm_clone</name>
 <cluster id="0dc2d5e6-b032-4a93-b400-9be428a6bb64" />
 <template id="00000000-0000-0000-0000-000000000000"/>
<memory>536870912</memory>
</vm>


The cluster at the time is:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<cluster href="/api/clusters/0dc2d5e6-b032-4a93-b400-9be428a6bb64" id="0dc2d5e6-b032-4a93-b400-9be428a6bb64">
    <name>1</name>
    <link href="/api/clusters/0dc2d5e6-b032-4a93-b400-9be428a6bb64/networks" rel="networks"/>
    <link href="/api/clusters/0dc2d5e6-b032-4a93-b400-9be428a6bb64/permissions" rel="permissions"/>
    <link href="/api/clusters/0dc2d5e6-b032-4a93-b400-9be428a6bb64/glustervolumes" rel="glustervolumes"/>
    <cpu id="Intel Westmere Family"/>
    <data_center href="/api/datacenters/8b3353f2-e66a-491a-90fd-a0581c48c96e" id="8b3353f2-e66a-491a-90fd-a0581c48c96e"/>
    <memory_policy>
        <overcommit percent="200"/>
        <transparent_hugepages>
            <enabled>true</enabled>
        </transparent_hugepages>
    </memory_policy>
    <scheduling_policy/>
    <version major="3" minor="2"/>
    <error_handling>
        <on_error>migrate</on_error>
    </error_handling>
    <virt_service>true</virt_service>
    <gluster_service>false</gluster_service>
    <threads_as_cores>false</threads_as_cores>
</cluster>

datacenter is uninitialized:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<data_center href="/api/datacenters/8b3353f2-e66a-491a-90fd-a0581c48c96e" id="8b3353f2-e66a-491a-90fd-a0581c48c96e">
    <name>1</name>
    <link href="/api/datacenters/8b3353f2-e66a-491a-90fd-a0581c48c96e/storagedomains" rel="storagedomains"/>
    <link href="/api/datacenters/8b3353f2-e66a-491a-90fd-a0581c48c96e/permissions" rel="permissions"/>
    <link href="/api/datacenters/8b3353f2-e66a-491a-90fd-a0581c48c96e/quotas" rel="quotas"/>
    <storage_type>nfs</storage_type>
    <version major="3" minor="2"/>
    <supported_versions>
        <version major="3" minor="2"/>
    </supported_versions>
    <status>
        <state>uninitialized</state>
    </status>
</data_center>

Comment 3 Gadi Ickowicz 2013-03-28 08:40:14 UTC
Unable to reproduce on SF11