I'm sending DELETE requests through oVirt REST API in order to remove a CD image from a CD drive. This is working for the persistant configuration (ie the CD image which will be available when starting up the VM), but this is not working for the 'current' configuration. I've tested this with curl on https://rhevm35.spice.brq.redhat.com/ $ curl --user admin@internal -H "filter: true" -H "content-type:application/xml" -k -X DELETE "https://rhevm35.spice.brq.redhat.com/ovirt-engine/api/vms/55e5af3e-3e9e-45df-b534-b3c10a72f248/cdroms/00000000-0000-0000-0000-000000000000;current" Enter host password for user 'admin@internal': <?xml version="1.0" encoding="UTF-8" standalone="yes"?><action><job href="/ovirt-engine/api/jobs/b292db6d-f1ce-4b11-9b7d-28c016dfeaa3" id="b292db6d-f1ce-4b11-9b7d-28c016dfeaa3"/><status><state>complete</state></status></action> $ curl --user admin@internal -H "filter: true" -H "content-type: application/xml" -k "https://rhevm35.spice.brq.redhat.com/ovirt-engine/api/vms/55e5af3e-3e9e-45df-b534-b3c10a72f248/cdroms/00000000-0000-0000-0000-000000000000;current" Enter host password for user 'admin@internal': <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <cdrom href="/ovirt-engine/api/vms/55e5af3e-3e9e-45df-b534-b3c10a72f248/cdroms/00000000-0000-0000-0000-000000000000" id="00000000-0000-0000-0000-000000000000"> <vm href="/ovirt-engine/api/vms/55e5af3e-3e9e-45df-b534-b3c10a72f248" id="55e5af3e-3e9e-45df-b534-b3c10a72f248"/> <file id="WANemv2.3.iso"/> </cdrom>
The way to eject the CD is to update it (not delete) using an empty file identifier: #!/bin/sh -ex url="https://ovirt.example.com/ovirt-engine/api" user="admin@internal" password="******" curl \ --verbose \ --insecure \ --request PUT \ --user "${user}:${password}" \ --header "Content-Type: application/xml" \ --header "Accept: application/xml" \ --data ' <cdrom> <file id=""/> </cdrom> ' \ "${url}/vms/e0ba3f7d-b376-453d-813f-2d6817d77be8/cdroms/00000000-0000-0000-0000-000000000000;current=true" This used to fail due to bug 1135970, but it should work now. *** This bug has been marked as a duplicate of bug 1135970 ***
Hmm but DELETEing the !current image was removing the CD when I tested this, has this changed in fixed versions? Is calling DELETE on such resources returning an error now rather than doing nothing? Last but not least, the example in https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Virtualization/3.5-Beta/html/Technical_Guide/Virtual_Machine_CD-ROMs_Sub-Collection.html is wrong then
The vms/{vm:id}/cdroms/{cdrom:id} resource represents the CD reader device, not the CD disk inside the device. Changing/ejecting the CD disk inside the CD reader device should be implemented by updating (using the PUT method) the "file.id" property of the device. The DELETE method should be used only to actually remove the device from the VM. Unfortunately we initially implemented this in such a way that DELETE means the same that PUT, and we can't change it now, as it would break backwards compatibility. The previous behavior, without the "current" parameter, is preserved. The documentation is wrong.
I openend bug 1145074 to track the issue in the documentation.
Thanks for opening the documentation bug! One more question, this bug was filed against RHEV, the duplicate one is an oVirt bug, I assume this bug will be / is fixed as well in RHEV?
Yes, it is fixed in RHEV as well.