RAPI client: Switch to pycURL
authorMichael Hanselmann <hansmi@google.com>
Thu, 1 Jul 2010 11:38:59 +0000 (13:38 +0200)
committerMichael Hanselmann <hansmi@google.com>
Thu, 1 Jul 2010 12:13:15 +0000 (14:13 +0200)
commit2a7c3583d568666764054fe50b0ed8ffb9b6c0ef
tree8ab4bd2133e07e1be76cdce2bf81e0a7aaa35de5
parentb939de4662e970c7e0ce8af7bfdf4acc06369b74
RAPI client: Switch to pycURL

Currently the RAPI client uses the urllib2 and httplib modules from
Python's standard library. They're used with pyOpenSSL in a very fragile
way, and there are known issues when receiving large responses from a RAPI
server.

By switching to PycURL we leverage the power and stability of the
widely-used curl library (libcurl). This brings us much more flexibility
than before, and timeouts were easily implemented (something that would
have involved a lot of work with the built-in modules).

There's one small drawback: Programs using libcurl have to call
curl_global_init(3) (available as pycurl.global_init) while exactly one
thread is running (e.g. before other threads) and are supposed to call
curl_global_cleanup(3) (available as pycurl.global_cleanup) upon exiting.
See the manpages for details. A decorator is provided to simplify this.

Unittests for the new code are provided, increasing the test coverage of
the RAPI client from 74% to 89%.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
INSTALL
daemons/ganeti-watcher
lib/rapi/client.py
qa/ganeti-qa.py
qa/qa_rapi.py
test/ganeti.rapi.client_unittest.py
tools/move-instance