Package ganeti :: Package rapi :: Module client
[hide private]
[frames] | no frames]

Module client

source code

Ganeti RAPI client.


Attention: To use the RAPI client, the application must call pycurl.global_init during initialization and pycurl.global_cleanup before exiting the process. This is very important in multi-threaded programs. See curl_global_init(3) and curl_global_cleanup(3) for details. The decorator UsesRapiClient can be used.

Classes [hide private]
  Error
Base error class for this module.
  CertificateError
Raised when a problem is found with the SSL certificate.
  GanetiApiError
Generic error raised from Ganeti API.
  GanetiRapiClient
Ganeti RAPI client.
Functions [hide private]
 
UsesRapiClient(fn)
Decorator for code using RAPI client to initialize pycURL.
source code
 
GenericCurlConfig(verbose=False, use_signal=False, use_curl_cabundle=False, cafile=None, capath=None, proxy=None, verify_hostname=False, connect_timeout=None, timeout=None, _pycurl_version_fn=pycurl.version_info)
Curl configuration function generator.
source code
Variables [hide private]
  GANETI_RAPI_PORT = 5080
  GANETI_RAPI_VERSION = 2
  HTTP_DELETE = "DELETE"
  HTTP_GET = "GET"
  HTTP_PUT = "PUT"
  HTTP_POST = "POST"
  HTTP_OK = 200
  HTTP_NOT_FOUND = 404
  HTTP_APP_JSON = "application/json"
  REPLACE_DISK_PRI = "replace_on_primary"
  REPLACE_DISK_SECONDARY = "replace_on_secondary"
  REPLACE_DISK_CHG = "replace_new_secondary"
  REPLACE_DISK_AUTO = "replace_auto"
  NODE_EVAC_PRI = "primary-only"
  NODE_EVAC_SEC = "secondary-only"
  NODE_EVAC_ALL = "all"
  NODE_ROLE_DRAINED = "drained"
  NODE_ROLE_MASTER_CANDIATE = "master-candidate"
  NODE_ROLE_MASTER = "master"
  NODE_ROLE_OFFLINE = "offline"
  NODE_ROLE_REGULAR = "regular"
  JOB_STATUS_QUEUED = "queued"
  JOB_STATUS_WAITING = "waiting"
  JOB_STATUS_CANCELING = "canceling"
  JOB_STATUS_RUNNING = "running"
  JOB_STATUS_CANCELED = "canceled"
  JOB_STATUS_SUCCESS = "success"
  JOB_STATUS_ERROR = "error"
  JOB_STATUS_FINALIZED = frozenset([JOB_STATUS_CANCELED, JOB_STA...
  JOB_STATUS_ALL = frozenset([JOB_STATUS_QUEUED, JOB_STATUS_WAIT...
  JOB_STATUS_WAITLOCK = "waiting"
  _REQ_DATA_VERSION_FIELD = "__version__"
  _INST_CREATE_REQV1 = "instance-create-reqv1"
  _INST_REINSTALL_REQV1 = "instance-reinstall-reqv1"
  _NODE_MIGRATE_REQV1 = "node-migrate-reqv1"
  _NODE_EVAC_RES1 = "node-evac-res1"
  _INST_NIC_PARAMS = frozenset(["mac", "ip", "mode", "link"])
  _INST_CREATE_V0_DISK_PARAMS = frozenset(["size"])
  _INST_CREATE_V0_PARAMS = frozenset(["os", "pnode", "snode", "i...
  _INST_CREATE_V0_DPARAMS = frozenset(["beparams", "hvparams"])
  _CURLE_SSL_CACERT = 60
  _CURLE_SSL_CACERT_BADFILE = 77
  _CURL_SSL_CERT_ERRORS = frozenset([_CURLE_SSL_CACERT, _CURLE_S...

Imports: logging, simplejson, socket, urllib, threading, pycurl, time, StringIO


Function Details [hide private]

GenericCurlConfig(verbose=False, use_signal=False, use_curl_cabundle=False, cafile=None, capath=None, proxy=None, verify_hostname=False, connect_timeout=None, timeout=None, _pycurl_version_fn=pycurl.version_info)

source code 

Curl configuration function generator.

Parameters:
  • verbose (bool) - Whether to set cURL to verbose mode
  • use_signal (bool) - Whether to allow cURL to use signals
  • use_curl_cabundle (bool) - Whether to use cURL's default CA bundle
  • cafile (string) - In which file we can find the certificates
  • capath (string) - In which directory we can find the certificates
  • proxy (string) - Proxy to use, None for default behaviour and empty string for disabling proxies (see curl_easy_setopt(3))
  • verify_hostname (bool) - Whether to verify the remote peer certificate's commonName
  • connect_timeout (number) - Timeout for establishing connection in seconds
  • timeout (number) - Timeout for complete transfer in seconds (see curl_easy_setopt(3)).

Variables Details [hide private]

JOB_STATUS_FINALIZED

Value:
frozenset([JOB_STATUS_CANCELED, JOB_STATUS_SUCCESS, JOB_STATUS_ERROR,]\
)

JOB_STATUS_ALL

Value:
frozenset([JOB_STATUS_QUEUED, JOB_STATUS_WAITING, JOB_STATUS_CANCELING\
, JOB_STATUS_RUNNING,]) | JOB_STATUS_FINALIZED

_INST_CREATE_V0_PARAMS

Value:
frozenset(["os", "pnode", "snode", "iallocator", "start", "ip_check", \
"name_check", "hypervisor", "file_storage_dir", "file_driver", "dry_ru\
n",])

_CURL_SSL_CERT_ERRORS

Value:
frozenset([_CURLE_SSL_CACERT, _CURLE_SSL_CACERT_BADFILE,])