[ovirt-users] Unable to rename disks via REST API
Juan Hernández
jhernand at redhat.com
Wed Jun 28 09:12:20 UTC 2017
On 06/28/2017 10:43 AM, Bruno Rodriguez wrote:
> Thank you, Daniel
>
> I tried a PUT with the same XML body, I got a "405 Method Not Allowed".
> It's quite strange, there must be someting I'm missing
>
The operation to update a disk will be introduced in version 4 of the
API with version 4.2 of the engine. Meanwhile the way to update the disk
is to use version 3 of the API and the disks sub-collection of the
virtual machine. That means that if you have a VM with id 123 and a disk
with id 456 you can send a request like this:
PUT /ovirt-engine/api/v3/vms/123/disks/456
With a request body like this:
<disk>
<alias>newalias</alias>
</disk>
Note that you can use the above "v3" prefix in the URL or else the
"Version: 3" header. A complete example using curl:
---8<---
#!/bin/bash -ex
url="https://.../ovirt-engine/api"
user="admin at internal"
password="..."
vm_id="..."
disk_id="..."
curl \
--verbose \
--cacert "ca.pem" \
--header "Version: 3" \
--header "Content-Type: application/xml" \
--user "${user}:${password}" \
--request PUT \
--data "
<disk>
<alias>newalias</alias>
</disk>
" \
"${url}/vms/${vm_id}/disks/${disk_id}"
--->8---
>
> On Wed, Jun 28, 2017 at 10:07 AM, Daniel Erez <derez at redhat.com
> <mailto:derez at redhat.com>> wrote:
>
> Hi,
>
> Updating is done using the PUT method.
> Please try that with the same XML body.
>
> Thanks,
> Daniel
>
> On Wed, Jun 28, 2017 at 10:26 AM Bruno Rodriguez <bruno at pic.es
> <mailto:bruno at pic.es>> wrote:
>
> Hello everyone,
>
> I'm having some problems about renaming some disks (setting a
> different alias, name or description) for VMs disks created from
> a template. When I get this URL
>
> https://ovirt-manager/ovirt-engine/api/disks/0123
> <https://ovirt-manager/ovirt-engine/api/disks/0123>
>
> I can see are the methods sparsify, export, move and copy. I
> tried to POST the following XML to the previous URL with no
> result (as expected, it won't work)
>
> <disk>
> <alias>my_machine_Disk1</alias>
> </disk>
>
> I'm quite sure I'm thinking about it in a wrong way (as usual).
> Any help would be welcome...
>
> Thank you in advance
>
> --
> Bruno Rodríguez Rodríguez
>
> *Port d'Informació Científica (PIC)*
>
> _______________________________________________
> Users mailing list
> Users at ovirt.org <mailto:Users at ovirt.org>
> http://lists.ovirt.org/mailman/listinfo/users
> <http://lists.ovirt.org/mailman/listinfo/users>
>
>
>
>
> --
> Bruno Rodríguez Rodríguez
>
> *Port d'Informació Científica (PIC)*
> Campus UAB - Edificio D,
> C / Albareda, s / n
> 08193-Bellaterra (Barcelona), España
> Telf. +34 93 170 27 30
> GPS coordenadas: 41.500850 2.110628
>
> "Si algo me ha enseñado el tetris, es que los errores se acumulan y los
> triunfos desaparecen"
>
>
> _______________________________________________
> Users mailing list
> Users at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/users
>
More information about the Users
mailing list