Description of problem: When creating a new VM disk_attachment using the REST API, there's no validation on the storage_domain parameter, so it's "possible" to create a vm's disk_attachment without a storage_domain. In this case, the storage domain would be determined by the first vm disk (returned by vm_disks[0]) storage domain. Version-Release number of selected component (if applicable): Reproduced for 4.2 version, although according to the code, was probably present before that. How reproducible: 100% Steps to Reproduce: 1. Create a VM. 2. Create a disk and attach it to the VM. 3. Using the REST API, run the following: Method: ------- POST URL: ---- https://xxxx.xxxx.xxxx.xxxx.com/ovirt-engine/api/vms/<VM_ID>/diskattachments Body: ----- <disk_attachment> <interface>ide</interface> <active>true</active> <disk> <name>mydisk</name> <provisioned_size>1024</provisioned_size> <format>COW</format> </disk> </disk_attachment> Actual results: Disk attachment has been created, and the storage_domain's parameter was set as the other disk's storage domain. Expected results: Error (Storage Domain hasn't been specified). Additional info: -
This behavior makes no sense (as the report suggests). I'd like to get this fixed sooner rather than later so we don't hit users relying on this broken behavior.
Shani, this is a user-visible behavior change. Can you please add some doctext explaining it?
Verified with the following code: ------------------------------------------ ovirt-engine-4.1.5.2-0.1.el7.noarch vdsm-4.19.27-1.el7ev Verified with the following scenario: ------------------------------------------ Steps to Reproduce: 1. Create a VM. 2. Create a disk and attach it to the VM. 3. Using the REST API, run the following: >>>>> Correct error message displayed Method: ------- POST URL: ---- https://xxxx.xxxx.xxxx.xxxx.com/ovirt-engine/api/vms/<VM_ID>/diskattachments Body: ----- <disk_attachment> <interface>ide</interface> <active>true</active> <disk> <name>mydisk</name> <provisioned_size>1024</provisioned_size> <format>COW</format> </disk> </disk_attachment> Message output from REST API <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <fault> <detail>[Cannot add Virtual Disk. Storage Domain hasn't been specified.]</detail> <reason>Operation Failed</reason> </fault> Moving to VERIFIED