Bug 1351145

Summary: Register unregistered templates (import storage domain) failed via REST
Product: [oVirt] ovirt-engine Reporter: Raz Tamir <ratamir>
Component: BLL.NetworkAssignee: Yevgeny Zaspitsky <yzaspits>
Status: CLOSED CURRENTRELEASE QA Contact: Raz Tamir <ratamir>
Severity: high Docs Contact:
Priority: unspecified    
Version: 4.0.0CC: bugs, danken, gklein, sbonazzo
Target Milestone: ovirt-4.0.2Keywords: Automation, Regression
Target Release: 4.0.2Flags: rule-engine: ovirt-4.0.z+
rule-engine: blocker+
rule-engine: planning_ack+
rule-engine: devel_ack+
rule-engine: testing_ack+
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: 2016-08-12 14:29:11 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Network RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
engine log none

Description Raz Tamir 2016-06-29 11:07:38 UTC
Created attachment 1173773 [details]
engine log

Description of problem:
When trying to register unregistered template using REST API (v3) I get the following response:
Status: 500
Reason: Internal Server Error
Detail: [General command validation failure.]

And from the engine.log:
2016-06-29 13:59:39,906 ERROR [org.ovirt.engine.core.bll.exportimport.ImportVmTemplateFromConfigurationCommand] (default task-30) [dea0471] Error during ValidateFailure.: javax.ejb.EJBException: java.lang.IllegalSt
ateException: Coding error, pool for requested GUID does not exist




Version-Release number of selected component (if applicable):
ovirt-engine-4.0.0.6-0.1.el7ev.noarch

How reproducible:
100%

Steps to Reproduce:
Have a working environment with at least 2 storage domains
1. Create a template from VM on one of the domains
2. Deactivate and detach the domain from step 1
3. Attach the domain again and send the request:
3.1 Send GET command to /api/storagedomains/{sd:id}/templates;unregistered
---> search for the link under with 'register' <actions> collections:
<actions>
    <link href="/ovirt-engine/api/storagedomains/{sd:id}/templates/{template:id}/register" rel="register"/>
</actions>

3.2 Send POST command to /ovirt-engine/api/storagedomains/{sd:id}/templates/{template:id}/register from step 3.1
body:
<action>
    <async>false</async>
    <grace_period>
        <expiry>10</expiry>
    </grace_period>
    <cluster>
        <name>CLUSTER_NAME</name>
    </cluster>
</action>

Actual results:


Expected results:


Additional info:

Comment 1 Juan Hernández 2016-06-29 12:48:48 UTC
I can't reproduce in my environment (latest master), but it looks BLL related, and not specific to V3 of the API. The relevant line from the log is this one:

Caused by: java.lang.IllegalStateException: Coding error, pool for requested GUID does not exist
	at org.ovirt.engine.core.bll.network.macpool.MacPoolPerDc.getMacPoolWithoutLocking(MacPoolPerDc.java:114)

Comment 2 Allon Mureinik 2016-06-30 12:12:54 UTC
(In reply to Juan Hernández from comment #1)
> I can't reproduce in my environment (latest master), but it looks BLL
> related, and not specific to V3 of the API. The relevant line from the log
> is this one:
> 
> Caused by: java.lang.IllegalStateException: Coding error, pool for requested
> GUID does not exist
> 	at
> org.ovirt.engine.core.bll.network.macpool.MacPoolPerDc.
> getMacPoolWithoutLocking(MacPoolPerDc.java:114)
This is a network error wrt assigning a mac pool to the imported entity.
I have a vague recollection it was already solved upstream, but moving to the networking team to verify and/or fix.

Comment 3 Raz Tamir 2016-07-24 14:04:56 UTC
Verified - ovirt-engine-4.0.2-0.1.rc.el7ev.noarch
Template was registered successfully