Bug 821578

Summary: OVIRT-SDK: Cannot create simultaneous connections to multiple servers
Product: [Retired] oVirt Reporter: Steven Lawrance <stl>
Component: ovirt-engine-sdkAssignee: Michael Pasternak <mpastern>
Status: CLOSED DUPLICATE QA Contact:
Severity: medium Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: acathrow, bazulay, clasohm, dyasny, iheim, mgoldboi, tvvcox, ykaul
Target Milestone: ---Keywords: FutureFeature, Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: infra
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
: simultaneous_conn (view as bug list) Environment:
Last Closed: 2012-10-18 10:32:28 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Steven Lawrance 2012-05-15 01:31:46 UTC
Description of problem:
ovirtsdk-api does not support instantiating multiple proxy/API connections.

Version-Release number of selected component (if applicable):
ovirt-engine-sdk-1.3-1.el6.noarch, and git master

How reproducible:
100%

Steps to Reproduce:
from ovirtsdk import api
a = api.API(url='http://localhost/', username='one', password='two')
b = api.API(url='http://remotehost/', username='one', password='two')
  
Actual results:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "ovirtsdk/api.py", line 84, in __init__
    contextmanager.add('proxy', proxy, Mode.R)
  File "ovirtsdk/infrastructure/contextmanager.py", line 63, in add
    raise ImmutableError(key)
ovirtsdk.infrastructure.errors.ImmutableError: [ERROR]::'proxy' is immutable.

Expected results:
No traceback; can ping/operate on both connections.

Additional info:
The "contextmanager" seems little more than sugar-coated global variables, and it only allows one 'proxy' to be cached.  Furthermore, there seems to be no public method to access the cached connection without the original API() instance.

On top of supporting multiple connections, I'd expect the existing connection pool to be reused when attempting a second login with the same credentials.

Comment 1 Michael Pasternak 2012-05-15 06:48:08 UTC
> Actual results:
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "ovirtsdk/api.py", line 84, in __init__
>     contextmanager.add('proxy', proxy, Mode.R)
>   File "ovirtsdk/infrastructure/contextmanager.py", line 63, in add
>     raise ImmutableError(key)
> ovirtsdk.infrastructure.errors.ImmutableError: [ERROR]::'proxy' is immutable.

this is planned feature, see sdk section of todo list
http://www.ovirt.org/wiki/SDK#TODO_list

> The "contextmanager" seems little more than sugar-coated global variables, and
> it only allows one 'proxy' to be cached.  Furthermore, there seems to be no
> public method to access the cached connection without the original API()
> instance.

by-design, sdk is abstracting transport layer, therefore user have 
no access to connection itself, which is managed by infrastructure,
please review sdk wiki: http://www.ovirt.org/wiki/SDK#IDE_Examples

> 
> On top of supporting multiple connections, I'd expect the existing connection
> pool to be reused when attempting a second login with the same credentials.

based on told above, sdk does not expose any login method, credentials 
specified only in proxy constructor - API(url, username, password ...)

Comment 2 Michael Pasternak 2012-10-18 10:32:28 UTC
http://gerrit.ovirt.org/#/c/8645/

*** This bug has been marked as a duplicate of bug 853947 ***