Bug 821578 - OVIRT-SDK: Cannot create simultaneous connections to multiple servers
OVIRT-SDK: Cannot create simultaneous connections to multiple servers
Status: CLOSED DUPLICATE of bug 853947
Product: oVirt
Classification: Community
Component: ovirt-engine-sdk (Show other bugs)
unspecified
Unspecified Unspecified
unspecified Severity medium
: ---
: ---
Assigned To: Michael Pasternak
infra
: FutureFeature, Reopened
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-05-14 21:31 EDT by Steven Lawrance
Modified: 2014-01-12 19:37 EST (History)
8 users (show)

See Also:
Fixed In Version:
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
: simultaneous_conn (view as bug list)
Environment:
Last Closed: 2012-10-18 06:32:28 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Steven Lawrance 2012-05-14 21:31:46 EDT
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 02:48:08 EDT
> 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 06:32:28 EDT
http://gerrit.ovirt.org/#/c/8645/

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

Note You need to log in before you can comment on or make changes to this bug.