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.
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.
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.]