<div dir="ltr"><div><div><div>Hi Nicolás,<br><br></div>There has been some changes to how a session is refreshed after 4.0. So this is a BZ and is being tracked by BZ 1434605.<br><br></div>Will post a patch to fix this. Thanks for reporting the issue.<br><br></div>Ravi<br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 22, 2017 at 9:10 AM, <span dir="ltr"><<a href="mailto:nicolas@devels.es" target="_blank">nicolas@devels.es</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Juan,<br>
<br>
I confirm this was working with 4.0.6 (but the same SDK package). The script is relatively new but I'm 100% sure it has been in execution for several weeks, in contrast to current version where after 5-6 iterations the exception starts showing up.<br>
<br>
I've voted for the bug and added myself as CC.<br>
<br>
Thank you.<br>
<br>
Regards,<br>
<br>
Nicolás<div class="HOEnZb"><div class="h5"><br>
<br>
El 2017-03-22 12:58, Juan Hernández escribió:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 03/22/2017 01:50 PM, Juan Hernández wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 03/22/2017 01:10 PM, <a href="mailto:nicolas@devels.es" target="_blank">nicolas@devels.es</a> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<br>
We've recently upgraded from oVirt 4.0.x to 4.1.0 and it seems that the<br>
behavior of a script we wrote in Python-SDK has changed slightly. We<br>
have a script that needs to be executed forever (daemon mode). This<br>
daemon creates an ovirtsdk4.Connection object and uses the same<br>
Connection object all the time.<br>
<br>
conn = sdk.Connection(<br>
url=URI,<br>
username=USERNAME,<br>
password=PASSWORD,<br>
ca_file=CAFILE<br>
)<br>
<br>
Between iterations we have ~5 minutes delays which we accomplish with a<br>
time.sleep(...) call.<br>
<br>
After some of these iterations (5 or 6), when trying to perform an<br>
operation on the Connection object (in this case, listing all SDs):<br>
<br>
try:<br>
sys_serv = conn.system_service()<br>
sd_serv = sys_serv.storage_domains_servi<wbr>ce()<br>
storages = sd_serv.list(search=sd_search_<wbr>query)<br>
except Error, e:<br>
log('ERR: Error getting storage domains: %s' % (e))<br>
<br>
We start getting exceptions (i.e., the sd_serv.list() call throwing an<br>
Error exception) with this message:<br>
<br>
ERR: Error getting storage domains: HTTP response code is 401.<br>
<br>
I believe this has something to do with the Connection object expiring<br>
(even if it's not idle more than 5 minutes at any time). Is there a way<br>
to "refresh" the Connection object so it doesn't auto-logout (assuming<br>
this is the actual problem)?<br>
<br>
As I said, this started happening as of oVirt 4.1.0.<br>
ovirt-engine-sdk-python version is 4.1.1.<br>
<br>
Any ideas?<br>
<br>
</blockquote>
<br>
This sound like this bug, opened yesterday:<br>
<br>
SSO token used for the API expires when running only queries<br>
<a href="https://bugzilla.redhat.com/1434605" rel="noreferrer" target="_blank">https://bugzilla.redhat.com/14<wbr>34605</a><br>
<br>
But I thought the same happened in 4.0. Can you confirm that you don't<br>
see this problem in 4.0?<br>
<br>
Open possible workaround is to force a refresh of the backend session<br>
sending an external event, like in this example:<br>
<br>
<br>
<a href="https://github.com/oVirt/ovirt-engine-sdk/blob/master/sdk/examples/vm_backup.py#L112-L131" rel="noreferrer" target="_blank">https://github.com/oVirt/ovirt<wbr>-engine-sdk/blob/master/sdk/<wbr>examples/vm_backup.py#L112-<wbr>L131</a><br>
<br>
I also think that we need to modify the SDKs so that they detect expired<br>
SSO tokens and renew them automatically. I will open another bug for that.<br>
<br>
</blockquote>
<br>
Here is the bug for adding automatic SSO token renew to the SDK, in case<br>
you want to follow/vote it:<br>
<br>
Implement automatic SSO token renew<br>
<a href="https://bugzilla.redhat.com/1434830" rel="noreferrer" target="_blank">https://bugzilla.redhat.com/14<wbr>34830</a><br>
</blockquote>
______________________________<wbr>_________________<br>
Users mailing list<br>
<a href="mailto:Users@ovirt.org" target="_blank">Users@ovirt.org</a><br>
<a href="http://lists.ovirt.org/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.ovirt.org/mailman<wbr>/listinfo/users</a><br>
</div></div></blockquote></div><br></div>