[Engine-devel] Tweaking backup/restore of engine

Juan Hernandez jhernand at redhat.com
Tue Mar 4 08:51:36 UTC 2014


On 03/04/2014 09:38 AM, Yair Zaslavsky wrote:
> 
> 
> ----- Original Message -----
>> From: "Sven Kieske" <S.Kieske at mittwald.de>
>> To: engine-devel at ovirt.org
>> Sent: Tuesday, March 4, 2014 10:25:31 AM
>> Subject: Re: [Engine-devel] Tweaking backup/restore of engine
>>
>> Thanks for the clarification,
>>
>> I couldn't find this change any more, but I knew
>> there was something done.
>>
>> However this makes me think about an RFE:
>> It would be cool if ovirt could provide a way
>> to use the REST-API without always have to login
>> and logout.
>>
>> Maybe something like a hook into
>> some message passing queue like rabbitMQ or zeroMQ
>> or a similar process for receiving and submitting
>> messages. So you could register once with an API
>> consumer and use that.
>>
>> What do you think?
> 
> CC'ing Juan - the maintainer of the REST API

Using the RESTAPI without repeated login/logout is already supported,
and it is what the SDKs do by default. In order to use it you need to
add the "Prefer: persistent-auth" header to the HTTP request, and keep
track of the cookies returned by the engine. For, example, the following
example sends events to the engine, without repeatedly performing the
login process:

#!/bin/sh -x

# The details to connect to the engine:
url="https://whatever/ovirt-engine/api"
user="admin at internal"
password="****"

# The file where we store the cookies, including the
# session id:
cookies="cookies.txt"

curl \
--insecure \
--request POST \
--header "Accept: application/xml" \
--header "Content-Type: application/xml" \
--header "Prefer: persistent-auth" \
--user "${user}:${password}" \
--cookie "${cookies}" \
--cookie-jar "${cookies}" \
--data "
<event>
  <origin>myorigin</origin>
  <severity>normal</severity>
  <description>Something from me</description>
  <custom_id>$(date +%s)</custom_id>
</event>
" \
${url}/events

This will keep a session alive in the server. If you want to explicitly
close it just send an additional request, with the same cookies and
without the "Prefer" header.

It is described in more detail here:

http://www.ovirt.org/Features/RESTSessionManagement

>>
>> Am 04.03.2014 07:53, schrieb Yair Zaslavsky:
>>> Hi Sven,
>>> This is not entirely accurate -
>>> The solution introduced at commit hash
>>> cb56de8808cec33b7599828ead890f52e32bcaea solves the problem for a
>>> specific case in which we have a multiple login in a very short interval
>>> of time -
>>> mainly due to attempt to login from webadmin, while UI plugin tries to
>>> login as well.
>>> We have an "anti flood" mechanism for events, allowing us to define an
>>> interval, in which an event will not be logged twice. In the case of the
>>> login event this is set to 5 seconds, which is enough to solve the above
>>> described scenario.
>>
>> --
>> Mit freundlichen Grüßen / Regards
>>
>> Sven Kieske
>>
>> Systemadministrator
>> Mittwald CM Service GmbH & Co. KG
>> Königsberger Straße 6
>> 32339 Espelkamp
>> T: +49-5772-293-100
>> F: +49-5772-293-333
>> https://www.mittwald.de
>> Geschäftsführer: Robert Meyer
>> St.Nr.: 331/5721/1033, USt-IdNr.: DE814773217, HRA 6640, AG Bad Oeynhausen
>> Komplementärin: Robert Meyer Verwaltungs GmbH, HRB 13260, AG Bad Oeynhausen
>> _______________________________________________
>> Engine-devel mailing list
>> Engine-devel at ovirt.org
>> http://lists.ovirt.org/mailman/listinfo/engine-devel
>>


-- 
Dirección Comercial: C/Jose Bardasano Baos, 9, Edif. Gorbea 3, planta
3ºD, 28016 Madrid, Spain
Inscrita en el Reg. Mercantil de Madrid – C.I.F. B82657941 - Red Hat S.L.



More information about the Engine-devel mailing list