The cinder.volume.drivers.zfssa.restclient Module

ZFS Storage Appliance REST API Client Programmatic Interface

exception RestClientError(status, name='ERR_INTERNAL', message=None)

Bases: exceptions.Exception

Exception for ZFS REST API client errors

class RestClientURL(url, **kwargs)

Bases: object

ZFSSA urllib client

delete(path, **kwargs)

Make an HTTP DELETE request

Parameters:path – Path to resource that will be deleted.
get(path, **kwargs)

Make an HTTP GET request

Parameters:path – Path to resource.
head(path, **kwargs)

Make an HTTP HEAD request

Parameters:path – Path to resource.
islogin()

return if client is login

login(auth_str)

Login to an appliance using a user name and password.

Start a session like what is done logging into the BUI. This is not a requirement to run REST commands, since the protocol is stateless. What is does is set up a cookie session so that some server side caching can be done. If login is used remember to call logout when finished.

Parameters:auth_str – Authorization string (base64)
logout()

Logout of an appliance

static mkpath(*args, **kwargs)

Make a path?query string for making a REST request

Cmd_params args:
 The path part
Cmd_params kwargs:
 The query part
post(path, body='', **kwargs)

Make an HTTP POST request

Parameters:
  • path – Path to resource.
  • body – Post data content
put(path, body='', **kwargs)

Make an HTTP PUT request

Parameters:
  • path – Path to resource.
  • body – Put data content
request(path, request, body=None, **kwargs)

Make an HTTP request and return the results

Parameters:
  • path – Path used with the initialized URL to make a request
  • request – HTTP request type (GET, POST, PUT, DELETE)
  • body – HTTP body of request
Key accept:

Set HTTP ‘Accept’ header with this value

Key base_path:

Override the base_path for this request

Key content:

Set HTTP ‘Content-Type’ header with this value

class RestResult(response=None, err=None)

Bases: object

Result from a REST API operation

get_header(name)

Get an HTTP header with the given name from the results

Parameters:name – HTTP header name
Returns:The header value or None if no value is found
class Status

Bases: object

Result HTTP Status

ACCEPTED = 202

Command accepted

BAD_REQUEST = 400

Bad Request

BUSY = 503

Service Unavailable

CONFLICT = 409

Invalid request

CREATED = 201

New resource created successfully

FORBIDDEN = 403

The request is not allowed

NOT_ALLOWED = 405

The request is not allowed

NOT_FOUND = 404

The requested resource was not found

NO_CONTENT = 204

Command returned OK but no data will be returned

OK = 200

Request return OK

TIMEOUT = 408

Request timed out

UNAUTHORIZED = 401

User is not authorized

Previous topic

The cinder.volume.drivers.zadara Module

Next topic

The cinder.volume.drivers.zfssa.webdavclient Module

This Page