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

Bug 1348805

Summary: Import vm from export domain using REST API returns "Internal Server Error"
Product: [oVirt] ovirt-engine Reporter: Raz Tamir <ratamir>
Component: RestAPIAssignee: Juan Hernández <juan.hernandez>
Status: CLOSED CURRENTRELEASE QA Contact: Raz Tamir <ratamir>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 4.0.0CC: bugs, gklein, mperina
Target Milestone: ovirt-4.0.1Keywords: Automation, Regression
Target Release: 4.0.1.1Flags: rule-engine: ovirt-4.0.z+
rule-engine: blocker+
rule-engine: planning_ack+
juan.hernandez: 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-04 13:31:29 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Infra RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Raz Tamir 2016-06-22 06:46:13 UTC
Description of problem:
When importing a vm from an export domain using REST API I get  "Internal Server Error" but the operation succeeds.


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


How reproducible:
100%

Steps to Reproduce:
Setup:
- Make sure you have an export domain with vm already exported to it
1. Import the vm:
send POST request to /api/storagedomains/{sd_id}/vms/{vm_id}/import :

<action>
    <async>true</async>
    <grace_period>
        <expiry>10</expiry>
    </grace_period>
    <storage_domain>
        <name>iscsi_1</name>
    </storage_domain>
    <cluster>
        <name>golden_env_mixed_1</name>
    </cluster>
    <vm>
        <name>test</name>
        <snapshots>
            <collapse_snapshots>true</collapse_snapshots>
        </snapshots>
    </vm>
    <clone>true</clone>
</action>
2.
3.

Actual results:
return code - 500
return body -
<html>
    <head>
        <title>Error</title>
    </head>
    <body>Internal Server Error</body>
</html>

Expected results:


Additional info:

Comment 1 Juan Hernández 2016-06-22 09:15:52 UTC
What version of the API are you using?

Note that in version 4 of the API the "collapse_snapshots" element was removed, as it is not really an attribute of the snapshots collection. It has been replaced by a "collapse_snapshots" URL parameter, so the request should look like this:

---8<---
POST /storagedomains/{sd:id}/vms/{vm:id}/import?collapse_snapshots=true
Version: 4

<action>
  <storage_domain>
    <name>iscsi_1</name>
  </storage_domain>
  <cluster>
    <name>golden_env_mixed_1</name>
  </cluster>
  <vm>
    <name>test</name>
  </vm>
  <clone>true</clone>
</action>
--->8---

This works correctly.

In version 3 of the API there the problem is that the backwards compatibility layer tries to populate the IP addresses reported by the guest agent, and that isn't possible for the VM object returned by the import operation, as that VM doesn't exist yet.

Comment 2 Raz Tamir 2016-06-22 09:20:22 UTC
Hi Juan,
I'm using API v3

Comment 3 Raz Tamir 2016-07-19 13:43:23 UTC
Verified on rhevm-4.0.1.1-0.1.el7ev.noarch