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

Bug 878784

Summary: Fail to import VM from export domain to data domain with rhevm rest api
Product: Red Hat Enterprise Virtualization Manager Reporter: yuping zhang <yupzhang>
Component: ovirt-engine-restapiAssignee: Ravi Nori <rnori>
Status: CLOSED CURRENTRELEASE QA Contact: Gadi Ickowicz <gickowic>
Severity: high Docs Contact:
Priority: medium    
Version: 3.1.0CC: abaron, amureini, bazulay, dyasny, ecohen, hateya, iheim, mpastern, nlevinki, Rhev-m-bugs, rwu, tzheng, vvyazmin, ykaul
Target Milestone: ---Keywords: Regression
Target Release: 3.1.5   
Hardware: All   
OS: Linux   
Whiteboard: storage
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 879149 (view as bug list) Environment:
Last Closed: 2012-11-22 08:01:18 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:
Attachments:
Description Flags
vdsm-log none

Comment 1 Barak 2012-11-21 09:26:02 UTC
Please provide all logs (including engine & vdsm)

Comment 3 Ayal Baron 2012-11-21 10:05:54 UTC
What is the error?
This looks like a dup of bug 872506
Without engine log and errors there is nothing we can do here.

Comment 6 Michael Pasternak 2012-11-21 10:18:38 UTC
(In reply to comment #3)
> What is the error?
> This looks like a dup of bug 872506

it's fails at api with 405 code before it gets to the BE.

Comment 7 yuping zhang 2012-11-21 10:27:16 UTC
Created attachment 649136 [details]
vdsm-log

Attach vdsm log again as the first one is private.

It is different from bug 872506,bug 872506 has two disks on different storage.
Here just one disk,I want to use Rest api to import guest.The guest can be imported to data domain if I click "Import" in RHEVM webadmin.

Thanks Michael for providing the information. Please tell me if you need anything else.Give me steps are better.:)

Comment 8 Haim 2012-11-21 13:18:27 UTC
please retest on SI24.4.

Comment 10 yuping zhang 2012-11-22 06:30:54 UTC
Tried with SI24.4,use https connection and update the action xml:

#  curl -v -u "admin@internal:redhat" -H "Content-type: application/xml" -d '<action><cluster><name>NFS</name></cluster><storage_domain><name>nfs_data</name></storage_domain><overwrite>true</overwrite><discard_snapshots>true</discard_snapshots></action>' --cacert ca.crt https://hp-xw4550-01.qe.lab.eng.nay.redhat.com/api/storagedomains/08552000-7ab1-4a4a-81f7-39fdcf785f68/vms/3d9762e3-a830-420d-89ed-7ce071046e49/import
* About to connect() to hp-xw4550-01.qe.lab.eng.nay.redhat.com port 443 (#0)
*   Trying 10.66.72.38... connected
* Connected to hp-xw4550-01.qe.lab.eng.nay.redhat.com (10.66.72.38) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
*   CAfile: ca.crt
  CApath: none
* SSL connection using TLS_DHE_RSA_WITH_AES_256_CBC_SHA
* Server certificate:
* 	subject: CN=hp-xw4550-01.qe.lab.eng.nay.redhat.com,O=qe.lab.eng.nay.redhat.com,C=US
* 	start date: Nov 14 05:50:21 2012 GMT
* 	expire date: Oct 20 05:50:25 2017 GMT
* 	common name: hp-xw4550-01.qe.lab.eng.nay.redhat.com
* 	issuer: CN=CA-hp-xw4550-01.qe.lab.eng.nay.redhat.com.51223,O=qe.lab.eng.nay.redhat.com,C=US
* Server auth using Basic with user 'admin@internal'
> POST /api/storagedomains/08552000-7ab1-4a4a-81f7-39fdcf785f68/vms/3d9762e3-a830-420d-89ed-7ce071046e49/import HTTP/1.1
> Authorization: Basic YWRtaW5AaW50ZXJuYWw6cmVkaGF0
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.13.1.0 zlib/1.2.3 libidn/1.18 libssh2/1.2.2
> Host: hp-xw4550-01.qe.lab.eng.nay.redhat.com
> Accept: */*
> Content-type: application/xml
> Content-Length: 176
> 
< HTTP/1.1 202 Accepted
< Date: Thu, 22 Nov 2012 06:25:34 GMT
< Set-Cookie: JSESSIONID=XITXY2LeqXJSWjhKS5hIFIXy; Path=/api; Secure
< Content-Type: application/xml
< Content-Length: 790
< Connection: close
< 
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<action href="/api/storagedomains/08552000-7ab1-4a4a-81f7-39fdcf785f68/vms/3d9762e3-a830-420d-89ed-7ce071046e49/import/4f354cd0-174f-4717-8e9f-f060a8cd863b" id="4f354cd0-174f-4717-8e9f-f060a8cd863b">
    <link href="/api/storagedomains/08552000-7ab1-4a4a-81f7-39fdcf785f68/vms/3d9762e3-a830-420d-89ed-7ce071046e49" rel="parent"/>
    <link href="/api/storagedomains/08552000-7ab1-4a4a-81f7-39fdcf785f68/vms/3d9762e3-a830-420d-89ed-7ce071046e49/import" rel="replay"/>
    <async>true</async>
    <storage_domain>
        <name>nfs_data</name>
    </storage_domain>
    <cluster>
        <name>NFS</name>
    </cluster>
    <discard_snapshots>true</discard_snapshots>
    <status>
        <state>pending</state>
    </status>
</action>
* Closing connection #0

#####################################################3
The guest was imported to data domain.
I downloaded the ca.crt file and used https now,and from document [1],the action xml is :
<action>
    <storage_domain>
        <name>export1</name>
    </storage_domain>
    <overwrite>true<overwrite/>
    <discard_snapshots>true<discard_snapshots/>
</action>

But it need to add the cluster name or id and the storage domain should be data domain,it should be like this:

<action>
	<cluster>
		<name>cluster</name>
	</cluster>
	<storage_domain>
		<name>data1</name>
	</storage_domain>
	<overwrite>true</overwrite>
	<discard_snapshots>true</discard_snapshots>
</action>

[1]http://documentation-devel.engineering.redhat.com/docs/en-US/Red_Hat_Enterprise_Virtualization/3.0/html/REST_API_Guide/sect-REST_API_Guide-VMs-Export.html

Comment 11 Haim 2012-11-22 08:01:18 UTC
feel free to open a bug on doc.