| Summary: | API is instantiatable only once. | ||
|---|---|---|---|
| Product: | [Retired] oVirt | Reporter: | Jaroslav Henner <jhenner> |
| Component: | ovirt-engine-sdk | Assignee: | Michael Pasternak <mpastern> |
| Status: | CLOSED NOTABUG | QA Contact: | |
| Severity: | high | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | unspecified | CC: | acathrow, bazulay, clasohm, dyasny, iheim, mgoldboi, ykaul |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2012-04-07 11:17:48 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: | |
this is planned feature for sdk (i'm on it), first item in TODO (Comment 1), as about your use-case, use api.disconnect() before creating new instance of the api proxy. Even if you call api.disconnect(), you still cannot instantiate another API object. api.disconnect() only removes "proxy" from the contextmanager, but not "entry_point" and "persistent_auth", which are also marked as immutable. Ignore my last comment, I was using an older version (rhevm-sdk-3.1.0.5-1.el6ev). Newer versions of API.disconnect() clear the whole contextmanager cache. |
Description of problem: One cannot instantiate two ovirtsdk.API objects. This prevents failover after bad password supplied. Version-Release number of selected component (if applicable): ovirt-engine-sdk-1.6.4-1.fc16.noarch How reproducible: Always. Steps to Reproduce: In [1]: from ovirtsdk import api In [2]: apicko=api.API("https://jh-rhsetup.rhev.lab.eng.brq.redhat.com:8443/", "vdcadmin.eng.brq.redhat.com", "12345", debug=True) In [3]: apicko.test() send: 'GET /api HTTP/1.1\r\nHost: jh-rhsetup.rhev.lab.eng.brq.redhat.com:8443\r\nAccept-Encoding: identity\r\nContent-type: application/xml\r\nAuthorization: Basic dmRjYWRtaW5Acmhldi5sYWIuZW5nLmJycS5yZWRoYXQuY29tOjEyMzQ1\r\n\r\n' reply: 'HTTP/1.1 401 Unauthorized\r\n' header: Server: Apache-Coyote/1.1 header: Pragma: No-cache header: Cache-Control: no-cache header: Expires: Thu, 01 Jan 1970 01:00:00 CET header: X-Powered-By: Servlet 2.5; JBoss-5.0/JBossWeb-2.1 header: WWW-Authenticate: Basic realm = "RHEVM" header: Content-Type: text/html;charset=utf-8 header: Content-Length: 970 header: Date: Sat, 07 Apr 2012 11:00:37 GMT Out[3]: False In [4]: apicko=api.API("https://jh-rhsetup.rhev.lab.eng.brq.redhat.com:8443/", "vdcadmin.eng.brq.redhat.com", "123456", debug=True) --------------------------------------------------------------------------- ImmutableError Traceback (most recent call last) /home/jhenner/work/rest-api-tests/<ipython-input-4-326fcf63bbf2> in <module>() ----> 1 apicko=api.API("https://jh-rhsetup.rhev.lab.eng.brq.redhat.com:8443/", "vdcadmin.eng.brq.redhat.com", "123456", debug=True) /usr/lib/python2.7/site-packages/ovirtsdk/api.pyc in __init__(self, url, username, password, key_file, cert_file, port, timeout, debug) 71 timeout=timeout, 72 debug=debug)), ---> 73 Mode.R) 74 75 self.capabilities = Capabilities() /usr/lib/python2.7/site-packages/ovirtsdk/infrastructure/contextmanager.pyc in add(key, val, mode) 61 with lock: 62 if mode is Mode.R and cache.has_key(key): ---> 63 raise ImmutableError(key) 64 else: 65 cache[key] = __Item(val, mode) ImmutableError: [ERROR]::'proxy' is immutable.