Bug 1348805 - Import vm from export domain using REST API returns "Internal Server Error"
Summary: Import vm from export domain using REST API returns "Internal Server Error"
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: ovirt-engine
Classification: oVirt
Component: RestAPI
Version: 4.0.0
Hardware: Unspecified
OS: Unspecified
urgent
urgent
Target Milestone: ovirt-4.0.1
: 4.0.1.1
Assignee: Juan Hernández
QA Contact: Raz Tamir
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-06-22 06:46 UTC by Raz Tamir
Modified: 2016-08-04 13:31 UTC (History)
3 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2016-08-04 13:31:29 UTC
oVirt Team: Infra
Embargoed:
rule-engine: ovirt-4.0.z+
rule-engine: blocker+
rule-engine: planning_ack+
juan.hernandez: devel_ack+
rule-engine: testing_ack+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 59602 0 master MERGED restapi: Don't try to set IPs for VMs without id 2016-06-22 14:08:22 UTC
oVirt gerrit 59632 0 ovirt-engine-4.0 MERGED restapi: Don't try to set IPs for VMs without id 2016-06-23 04:17:02 UTC

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


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