Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 1109709 - Python SDK is not able to reconnect to the RHEV-M API
Python SDK is not able to reconnect to the RHEV-M API
Status: CLOSED DUPLICATE of bug 1018559
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine-sdk (Show other bugs)
3.4.0
All All
medium Severity medium
: ---
: 3.5.0
Assigned To: Juan Hernández
Shai Revivo
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2014-06-16 04:02 EDT by Roman Hodain
Modified: 2014-06-16 07:00 EDT (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-06-16 07:00:41 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 Roman Hodain 2014-06-16 04:02:46 EDT
Description of problem:
	python SDK is not able to reconnect after a connection failure.

Version-Release number of selected component (if applicable):
	rhevm-sdk-python-3.4.1.0-2.el6ev.noarch

How reproducible:
	100%

Steps to Reproduce:
	Run the following script on the RHEV-M and restart the engine. Or
shutdown the manger and then start the script.

=======================================
#!/usr/bin/python
import sys
import time
from ovirtsdk.api import API

USERNAME="admin@internal"
PASSWORD="password"
TAG='AlwaysUp'
CA_FILE="/etc/pki/ovirt-engine/ca.pem"
URL="https://FQDN/api"

while True:
        try:
                api_instance = API(url=URL,
                        username=USERNAME,
                        password=PASSWORD,
                        ca_file=CA_FILE)
                print "Connection Ok..."
        except Exception as e:
                print "Connection failure: %s" % str(e)
        time.sleep(5)

======================================

Actual results:
	[ERROR]::oVirt sdk is disconnected from the server.

Expected results:
	SDK is able to reconnect
Comment 1 Juan Hernández 2014-06-16 07:00:41 EDT
The constructor of the SDK has a "renew_session" parameter that enables automatic re-connection. The default values is False, so you need to include it explicitly in the call to the constructor:

  api_instance = API(url=URL,
          username=USERNAME,
          password=PASSWORD,
          ca_file=CA_FILE,
          renew_session=True)

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

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