Bug 1177940

Summary: [REST-API] Fail to Clone VM from Template to another SD, on disk profile mismatch.
Product: Red Hat Enterprise Virtualization Manager Reporter: Ilanit Stein <istein>
Component: ovirt-engine-restapiAssignee: Gilad Chaplik <gchaplik>
Status: CLOSED ERRATA QA Contact: Ilanit Stein <istein>
Severity: high Docs Contact:
Priority: unspecified    
Version: 3.5.0CC: aberezin, bazulay, dfediuck, ecohen, gchaplik, gklein, iheim, juwu, lsurette, mavital, rbalakri, Rhev-m-bugs, yeylon
Target Milestone: ---Keywords: Regression, Triaged
Target Release: 3.5.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: sla
Fixed In Version: org.ovirt.engine-root-3.5.0-30 Doc Type: Bug Fix
Doc Text:
Previously, when cloning disks, disk profiles are retrieved from templates instead of the destination Storage Domain. If a different storage domain then the source was selected, virtual machine creation from the template would fail. With this update, if users do not specify a disk profile when cloning disks, the disk profile gets reset to an available disk profile from the selected storage domain.
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-02-15 09:14:24 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: SLA RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1164308, 1164311    
Attachments:
Description Flags
Failing clone vm from template
none
Logs from Automatic test, that also runs clone vm from template to another storage domain none

Description Ilanit Stein 2014-12-31 13:45:37 UTC
Description of problem:
When trying to clone VM from template, to a storage domain, that has disk profile, which is different than the template disk's disk profile,
It fails on can do action (engine.log):

"CanDoAction of action AddVmFromTemplate failed. Reasons:VAR__ACTION__ADD,VAR__TYPE__VM,ACTION_TYPE_DISK_PROFILE_NOT_MATCH_STORAGE_DOMAIN"

"Operation Failed: [Cannot add VM. Disk Profile doesn't match provided Storage Domain.]"

Only for storage domain, that has the same cpu profile, and the template disk's disk profile, the clone VM from template succeeds (VM created)

Version-Release number of selected component (if applicable):
vt13.5

How reproducible:
100%

Steps to Reproduce:
1. Have a template with disk that is connected to several storage domains in th edata center (more than 1)

2. In the Disks tab, you can see that for template disk, in the general tab, at the bottom, it is displaying a certain disk profile.

3. Via REST clone VM from template like in the attached txt file cloneVmFromTemplateRestRequest.txt. The storage domain set in the CREATE VM request is different from the template disk's disk profile.
=> This action should fail on 

Expected results:
The clone VM from template should succeed to another storage domain as well.

Additional info:
From UI clone VM from template works OK. it is possible to choose the storage target, and adpatively the corresponding disk profile is chosen. VM is create dsuccessfuly.

Comment: 
It is marked as regression because before (rhevm 3.4) it was possible to clone vm from template to another storage domain.

Comment 1 Ilanit Stein 2014-12-31 13:52:32 UTC
Created attachment 974811 [details]
Failing clone vm from template

Failing clone vm from template

Comment 2 Ilanit Stein 2014-12-31 14:00:39 UTC
Created attachment 974812 [details]
Logs from Automatic test, that also runs clone vm from template to another storage domain

See in engine.log, 
2014-12-31 08:44:57,623 ERROR [org.ovirt.engine.api.restapi.resource.AbstractBackendResource] (ajp-/127.0.0.1:8702-18) Operation Failed: [Cannot add VM. Disk Profile doesn't match provided Storage Domain.]

Comment 3 Gilad Chaplik 2015-01-01 08:42:33 UTC
similar to bug 1172207.

Comment 5 Ilanit Stein 2015-01-27 08:57:45 UTC
Verified on vt13.8.

By running this rest POST request with url: 
https://<engine fqdn>:443/ovirt-engine/api/vms

body:

<vm>
    <name>virt-vm-1</name>
    <cluster>
       <name>golden_env_mixed_1</name>
    </cluster>
    <template>
       <name>golden_mixed_virtio_template</name>
    </template>
    <disks>
        <clone>true</clone>
    </disks>
</vm>

Comment 7 Eyal Edri 2015-02-15 09:14:24 UTC
bugs were moved by ERRATA to RELEASE PENDING bug not closed probably due to errata error.
closing as 3.5.0 is released.