Description of problem: in engine-setup, in the all-in-one configuration, I need to setup the engine and only when it 's available I need to add the host itself via the API using the SDK. To check the engine status I'm looping (till a maximum of retry with a sleep time between each attempt) trying to instantiate the SDK till the engine is ready. If the system isn't fast enough first attempt goes wrong getting a 503 error (<title>503 Service Unavailable</title> </head><body> <h1>Service Unavailable</h1> <p>The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.</p>) and than any further attempt fails raising a Disconnected Error. I suppose that the problem is due to the fact that ovirtsdk/apy.py in the __init__ firstly tries to # Implicitly disconnect and perform cleanup # when detected instance of the SDK proxy with # ref-count == 0 if context.manager.has_key(self.__id): self.disconnect() call the disconnect method but the previous attempt never got connected and that the disconnect() always raise a DisconnectedError preventing any further attempt. Version-Release number of selected component (if applicable): ovirt-engine-sdk-python.noarch 3.5.0.0-1.20140605.git1267422.fc19 How reproducible: 100% Steps to Reproduce: 1. try to connect to system that is not fully running 2. wait 3. try again Actual results: it raises a DisconnectedError Expected results: a working SDK instance Additional info:
The change to the code generator that fixes this issue has been merged, now the SDK needs to be regenerated.
*** Bug 1113882 has been marked as a duplicate of this bug. ***
I'm still able to reproduce couple of errors between 'temporary unavailable' and working sdk instance, but finally got one. Is it ok for you this way? [root@pb-rh35 ~]# cat test.py #!/usr/bin/env python from ovirtsdk.api import API from ovirtsdk.xml import params from time import sleep def loop_connect(): try: api = API (url="TODO", username="admin@internal", password="XXXXX", ca_file="ca.crt") print "Connected to %s successfully!" % api.get_product_info().name api.disconnect() except Exception as ex: print "Unexpected error: %s" % ex sleep(0.3) loop_connect() loop_connect() [root@pb-rh35 ~]# service ovirt-engine restart; ./test.py Stopping oVirt Engine: [ OK ] Starting oVirt Engine: [ OK ] Unexpected error: status: 503 reason: Service Temporarily Unavailable detail: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>503 Service Temporarily Unavailable</title> </head><body> <h1>Service Temporarily Unavailable</h1> <p>The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.</p> <hr> <address>Apache/2.2.22 (Red Hat Enterprise Web Server) Server at TODO Port 443</address> </body></html> <snip> couple of 503s </snip> Unexpected error: status: 503 reason: Service Temporarily Unavailable detail: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN"> <html><head> <title>503 Service Temporarily Unavailable</title> </head><body> <h1>Service Temporarily Unavailable</h1> <p>The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.</p> <hr> <address>Apache/2.2.22 (Red Hat Enterprise Web Server) Server at TODO Port 443</address> </body></html> Unexpected error: status: 404 reason: Not Found detail: Unexpected error: status: 404 reason: Not Found detail: Unexpected error: status: 404 reason: Not Found detail: Unexpected error: status: 404 reason: Not Found detail: Unexpected error: status: 500 reason: Internal Server Error detail: HTTP Status 500 Unexpected error: status: 500 reason: Internal Server Error detail: HTTP Status 500 Unexpected error: status: 500 reason: Internal Server Error detail: HTTP Status 500 Unexpected error: status: 401 reason: Unauthorized detail: HTTP Status 401 Connected to oVirt Engine successfully!
I think so
Ok then
oVirt 3.5 has been released and should include the fix for this issue.