[ovirt-users] Attaching storage to VM via JSON REST

Andrew Morrison andy.wmorrison at gmail.com
Thu May 8 06:44:35 UTC 2014


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.

Thanks,
Andrew
On May 7, 2014 11:30 PM, "Gadi Ickowicz" <gickowic at redhat.com> wrote:

> 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?
>
> Juan - any other insights?
>
> Gadi Ickowicz
>
> ----- Original Message -----
> From: "Andrew Morrison" <andy.wmorrison at gmail.com>
> To: users at ovirt.org
> Sent: Wednesday, May 7, 2014 11:23:13 PM
> Subject: [ovirt-users] Attaching storage to VM via JSON REST
>
> Hi all,
>
> 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:
> {"storage_domain":
> {"name":"am_data",
> "id":"6fbee79d-5b71-48c1-b86c-ee9755a46013"
> },
> "size":"4294967296",
> "type":"system",
> "interface":"ide",
> "format":"raw",
> "sparse":"false",
> "bootable":"true",
> "wipe_after_delete":"false"
> }
> The response I receive is
> {
> "reason" : "Operation Failed",
> "detail" : "[Cannot add Virtual Machine Disk. Storage Domain doesn't
> exist.]"
> }
> 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.
> "storage_domains" : {
> "storage_domain" : [ {
> "id" : "6fbee79d-5b71-48c1-b86c-ee9755a46013"
> } ]
> },
>
> Any idea what I might be doing wrong?
>
> Thanks,
> Andrew
>
> _______________________________________________
> Users mailing list
> Users at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ovirt.org/pipermail/users/attachments/20140507/dcb8c0b6/attachment-0001.html>


More information about the Users mailing list