<p dir="ltr">If I try to use a storage domains object and a list of a storage domain, I get a rather large Java stack trace of the same type as when I have a key named incorrectly or when the request generally contains invalid parameters.</p>
<p dir="ltr">Thanks,<br>
Andrew</p>
<div class="gmail_quote">On May 7, 2014 11:30 PM, "Gadi Ickowicz" <<a href="mailto:gickowic@redhat.com">gickowic@redhat.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I have no experience using JSON myself (I use XML when using REST), however, note that the storage_domain is a list of ids, inside of a storage_domains object. Maybe try to send a request formatted like that?<br>
<br>
Juan - any other insights?<br>
<br>
Gadi Ickowicz<br>
<br>
----- Original Message -----<br>
From: "Andrew Morrison" <<a href="mailto:andy.wmorrison@gmail.com">andy.wmorrison@gmail.com</a>><br>
To: <a href="mailto:users@ovirt.org">users@ovirt.org</a><br>
Sent: Wednesday, May 7, 2014 11:23:13 PM<br>
Subject: [ovirt-users] Attaching storage to VM via JSON REST<br>
<br>
Hi all,<br>
<br>
I'm exploring using ovirt's REST APIs to manage VM creation/deletion/etc. I can create the VM, attach an ISO and change boot order, but I'm unable to attach a storage disk to the VM. I send a POST request to /api/vms/<vm uuid>/disks with the structure:<br>
{"storage_domain":<br>
{"name":"am_data",<br>
"id":"6fbee79d-5b71-48c1-b86c-ee9755a46013"<br>
},<br>
"size":"4294967296",<br>
"type":"system",<br>
"interface":"ide",<br>
"format":"raw",<br>
"sparse":"false",<br>
"bootable":"true",<br>
"wipe_after_delete":"false"<br>
}<br>
The response I receive is<br>
{<br>
"reason" : "Operation Failed",<br>
"detail" : "[Cannot add Virtual Machine Disk. Storage Domain doesn't exist.]"<br>
}<br>
For the storage domain, I've tried just the name, just the id, and both with the same results. When I attach storage from the GUI, the disk is created/attached fine, and a GET request for the disks of the VM shows the storage domain as the same as I was attempting to use before.<br>
"storage_domains" : {<br>
"storage_domain" : [ {<br>
"id" : "6fbee79d-5b71-48c1-b86c-ee9755a46013"<br>
} ]<br>
},<br>
<br>
Any idea what I might be doing wrong?<br>
<br>
Thanks,<br>
Andrew<br>
<br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@ovirt.org">Users@ovirt.org</a><br>
<a href="http://lists.ovirt.org/mailman/listinfo/users" target="_blank">http://lists.ovirt.org/mailman/listinfo/users</a><br>
</blockquote></div>