[ovirt-users] Unable to rename disks via REST API
Bruno Rodriguez
bruno at pic.es
Wed Jun 28 11:34:47 UTC 2017
Shit, I got it. Sorry
The problem is that I was accessing to the v4 disk-attachment id and I was
getting everything quite messed up. I was doing all of this while creating
a machine, so I was trying to rename the disk at the same time it's being
created.
I'll delete all the "if ($ovirt_major == 3)" I have in my code. If I have
any problem I'll let you know.
Thank you
On Wed, Jun 28, 2017 at 1:03 PM, Juan Hernández <jhernand at redhat.com> wrote:
> On 06/28/2017 12:55 PM, Bruno Rodriguez wrote:
> > I'm sorry about bothering you again, but after trying it some times I'm
> > still getting a "500 Internal Server Error". I'm using a REST client
> > instead of CURL and I tried adding a "Version: 3" to headers and used
> > the URL with the v3 as well.
> >
> > I'm issuing a PUT of
> >
> > <disk><alias>Alias_for_disk</alias></disk>
> >
> > To the URL
> >
> > https://myserver/ovirt-engine/api/v3/vms/62498f51-0203-48b9-
> 83c8-4c6f3bdfe05c/disks/583ed952-46a8-4bc5-8a27-8660e4a24ea2
> >
> > I mean, I can live without it but we are using oVirt as a "static
> > virtualization" environment and is quite useful for us being able to
> > recognize easily each disk by its server name. In case I have to wait
> > until the 4.2 API version to automatize this I'll do :(
> >
>
> That should work. Can you please check if you get any useful message in
> /var/log/ovirt-engine/server.log or /var/log/ovirt-engine/engine.log?
>
> >
> >
> > On Wed, Jun 28, 2017 at 11:18 AM, Bruno Rodriguez <bruno at pic.es
> > <mailto:bruno at pic.es>> wrote:
> >
> > Thank you very much !!!
> >
> > I expected I was missing something like that. Thanks again!
> >
> > On Wed, Jun 28, 2017 at 11:12 AM, Juan Hernández
> > <jhernand at redhat.com <mailto:jhernand at redhat.com>> wrote:
> >
> > 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>
> > > <mailto: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>
> > > <mailto: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>
> > > <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>
> > <mailto:Users at ovirt.org <mailto:Users at ovirt.org>>
> > > http://lists.ovirt.org/mailman/listinfo/users
> > <http://lists.ovirt.org/mailman/listinfo/users>
> > > <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 <tel:%2B34%2093%20170%2027%2030>
> > > 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 <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"
> >
> >
> >
> >
> > --
> > 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"
>
>
--
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"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ovirt.org/pipermail/users/attachments/20170628/3f124bc0/attachment.html>
More information about the Users
mailing list