linstor package

Submodules

linstor.resource module

Resource module

class linstor.resource.Resource(name, uri='linstor://localhost', existing_client=None)

Bases: object

Resource class represents a DRBD Resource.

This object allows managing existing DRBD Resources as well as creating new ones.

Parameters
  • name (str) – The name of the DRBD resource.

  • uri (str) – A list of controller addresses. e.g: linstor://localhost,10.0.0.2, linstor+ssl://localhost,linstor://192.168.0.1

  • existing_client (linstor.Linstor) – Instead of creating a new client based on the controller addresses, use this pre-configured client object.

activate(node_name)

Makes a resource available at a given host.

If the host already contains a diskful assignment, this is a NOOP. Otherwise a diskless assignment is created.

Parameters

node_name (str) – Name of the node

Returns

True if success, else raises LinstorError

property allow_two_primaries

Returns the value of the DRBD net-option ‘allow-two-primaries’.

Returns

The value of the DRBD net-option ‘allow-two-primaries’. Raises LinstorError in case of error.

Return type

bool

autoplace()

Automatically place the Resource according to values set in the placement policy.

Example:

To autoplace a Resource ‘foo’ 3 times redundant on the storage pool ‘drbdpool’ one would:

$ foo.placement.redundancy = 3
$ foo.placement.storage_pool = 'drbdpool'
$ foo.autoplace()
Returns

True if success, else raises LinstorError

deactivate(node_name)

Deactivates a resource on a host if possible.

If the assignment is diskless, delete this assignment. If it is diskful and therefore part of the given redundany, this is a NOOP (i.e., the redundancy is not decreased).

Parameters

node_name (str) – Name of the node

Returns

True if success, else raises LinstorError

delete(node_name=None, snapshots=True)

Deletes the resource globally or on the given host.

If the node name is None, deletes the resource globally.

Parameters
  • node_name (str) – Deletes resource only from the specified node.

  • snapshots (bool) – If True deletes snapshots prior deleting the resource

Returns

True if success, else raises LinstorError

diskful(node_name)

Assign a resource diskful on a given node.

If the assignment does not exist, create it diskful. If the assignment is already diskful, this is a NOOP. If it exists diskless, convert it to diskful.

Parameters

node_name (str) – Name of the node

Returns

True if success, else raises LinstorError

diskful_nodes()

Returns the host names of all diskful nodes.

Returns

Host names of diskful nodes.

Return type

list[str]

diskless(node_name)

Assign a resource diskless on a given node.

If the assignment does not exist, create it diskless. If the assignment is already diskless, this is a NOOP. If it exists diskful, convert it to diskless.

Parameters

node_name (str) – Name of the node

Returns

True if success, else raises LinstorError

diskless_nodes()

Returns the host names of all diskless nodes.

Returns

Host names of diskless nodes.

Return type

list[str]

drbd_proxy_disable(node_name_a, node_name_b)
drbd_proxy_enable(node_name_a, node_name_b)
classmethod from_resource_group(uri, resource_group_name, resource_name, vlm_sizes, timeout=300, keep_alive=False, definitions_only=False, existing_client=None)

Spawns a new resource definition from the given resource group.

Parameters
  • uri (str) – A list of controller addresses. e.g: linstor://localhost,10.0.0.2, linstor+ssl://localhost,linstor://192.168.0.1

  • resource_group_name (str) – Name of the resource group

  • resource_name (str) – Name of the new resource definition

  • vlm_sizes (list[str]) – String list of volume sizes e.g. [‘128Mib’, ‘1G’]

  • timeout (int) – client library timeout

  • keep_alive (bool) – keep client connection alive

  • definitions_only (bool) – only spawn definitions

  • existing_client (linstor.Linstor) – Client to associate with the resource

Returns

linstor.resource.Resource object of the newly created resource definition

Return type

linstor.resource.Resource

is_assigned(node_name)

Returns True if the resource is assigned diskful or diskless on the given host.

Parameters

node_name (str) – Name of the node

Returns

True if assigned (diskful or diskless) on given host.

Return type

bool

is_diskful(node_name)

Returns True if the resource is assigned diskful on the given host.

Parameters

node_name (str) – Name of the node

Returns

True if assigned diskful on given host.

Return type

bool

is_diskless(node_name)

Returns True if the resource is assigned diskless on the given host.

Parameters

node_name (str) – Name of the node

Returns

True if assigned diskless on given host.

Return type

bool

is_thin()

Returns if the used storage pool of the resource is thin.

Returns

True if storage pool used is thin.

Return type

bool

property linstor_name

Returns the internal/linstor/DRBD name of the Resource.

Returns

The internal/linstor/DRBD name of the Resource.

Return type

str

property name

Returns the external/user facing name of the Resource.

Returns

The external/user facing name of the Resource.

Return type

str

property port

Returns the port of the Resource.

Returns

The port of the Resource.

Return type

str

property resource_group_name
restore_from_snapshot(snapshot_name, resource_name_to)

Restores a new resource from a snapshot.

Parameters
  • snapshot_name – Snapshot name to use for restoration.

  • resource_name_to – Name of the new resource.

Returns

A new resource object restored from the snapshot.

Return type

linstor.resource.Resource

snapshot_create(name)

Creates a new snapshot for the resource.

Parameters

name (str) – Name of the snapshot

Returns

True if success, else raises LinstorError

snapshot_delete(name)

Deletes a given snapshot of this resource.

Parameters

name (str) – Name of the snapshot

Returns

True if success, else raises LinstorError

snapshot_rollback(name)

Rolls resource data back to snapshot state. The resource must not be in use. The snapshot will not be removed and can be used for subsequent rollbacks. Only the most recent snapshot may be used; to roll back to an earlier snapshot, the intermediate snapshots must first be deleted.

Parameters

name (str) – Name of the snapshot

Returns

True if success, else raises LinstorError

class linstor.resource.Volume(size)

Bases: object

Volume class represents a DRBD Volume.

This object contains important properties of a Volume, including e.g: size, and device_path

Parameters

size – String parsable by linstor.SizeCalc or size in bytes.

property device_path

Returns the device path of a Volume (e.g., /dev/drbd1000).

Returns

The device path of a Volume.

Return type

str

property minor

Returns the minor number of a Volume (e.g., 1000).

Returns

The minor number of a Volume.

Return type

int

property size

Returns the size of a Volume (e.g., 1000000).

Setting tye size of a volume that is deployed triggers a resize operation.

Returns

The size of a Volume in bytes.

Return type

int

property storage_pool_name
linstor.resource.wraps(func)

Replaces functools.wraps in order to undo wrapping when generating Sphinx documentation

linstor.resourcegroup module

ResourceGroup module

class linstor.resourcegroup.ResourceGroup(name, uri='linstor://localhost', existing_client=None)

Bases: object

create_resource(resource_name, vlm_sizes)

Create resource with values.

Parameters
  • resource_name (str) – Name of the resource to create.

  • vlm_sizes (list[str]) – Volume definitions to spawn

Returns

Resource object of the newly created resource definition

Return type

linstor.resource.Resource

delete()

Deletes the ResourceGroup

property description

Returns the description of the ResourceGroup

Returns

The description of a Resource Group.

Return type

str

property diskless_on_remaining

Returns the diskless_on_remaining of the ResourceGroup

Returns

The diskless_on_remaining of a Resource Group.

Return type

bool

property do_not_place_with

Returns the do_not_place_with of the ResourceGroup

Returns

The do_not_place_with of a Resource Group.

Return type

list[str]

property do_not_place_with_regex

Returns the do_not_place_with_regex of the ResourceGroup

Returns

The do_not_place_with_regex of a Resource Group.

Return type

str

property layer_list

Returns the layer list of the ResourceGroup

Returns

The layer list of a Resource Group.

Return type

list[str]

property name

Returns the name of the ResourceGroup

Returns

The name of a Resource Group.

Return type

str

property nr_volumes

Returns the number of volumes of the ResourceGroup

Returns

The number of volumes of a Resource Group.

Return type

int

property property_dict

Returns the property dict of the ResourceGroup

Returns

The property dict of a Resource Group.

Return type

dict[str, str]

property provider_list

Returns the provider list of the ResourceGroup

Returns

The provider list of a Resource Group.

Return type

list[str]

query_max_volume_size()

Queries maximum volume size from the given resource group and returns all possible candidates

property redundancy

Returns the redundancy of the ResourceGroup

Returns

The redundancy of a Resource Group.

Return type

int

property replicas_on_different

Returns the replicas_on_different of the ResourceGroup

Returns

The replicas_on_different of a Resource Group.

Return type

list[str]

property replicas_on_same

Returns the replicas_on_same of the ResourceGroup

Returns

The replicas_on_same of a Resource Group.

Return type

list[str]

property storage_pool

Returns the storage_pool of the ResourceGroup

Returns

The storage_pool of a Resource Group.

Return type

str|list[str]

linstor.kv module

class linstor.kv.KV(name, namespace='/', cached=True, uri='linstor://localhost', rw_to_linstor=True, existing_client=None)

Bases: dict

KV class represents a Key-Value Store backed by LINSTOR.

This object provides mainly the same interface as a Python3 dict and acts as a Key-Value store with namespaces. A namespace acts like a prefix in a UNIX file system and gets added to the every key that is set. The default namespace is ‘/’.

Limitations: Keys and values have to be of type str. KV.keys(), KV.items() (as well as KV.values()) are implemented as simple generators. So they provide a “view”, but not a “set-like” behavior. If you need that, convert the generator to a set (i.e. ks = KV.keys(); set(ks) & {‘foo’}).

The __repr__() method is not overridden intentionally and provides the representation of the whole dict, basically ignoring the namespace. This is helpful for debugging.

Example:

Add a value to a namespace /foo/bar, list it, change the namespace to “/” and list the item:

$ kv = linstor.KV('myKV', namespace='/foo/bar/')
$ kv['key'] = 'val'
$ list(kv.items()) -> [('key', 'val')]
$ kv.namespace = '/'
$ list(kv.items()) -> [('/foo/bar/key', 'val')]
$ kv['foo/baz/key'] = 'valbaz'
$ kv.namespace = '/foo/bar'
$ list(kv.items()) -> [('key', 'val')] # keys in /foo/baz not visible
Parameters
  • name (str) – The name of the KV-store. It acts as a unique handle.

  • namespace (str) – A UNIX-like file system path.

  • cached (bool) – A KV can be backed by a python dict as a caching layer. As of now has to be True. This influences whether reads are forwarded to LINSTOR or not. Writes are obviously always forwarded.

  • uri (str) – A list of controller addresses.

  • rw_to_linstor (bool) – If set to False, entries are not written to LINSTOR. It can be used to use the KV as a name spaced dict() only, or for debugging.

  • existing_client (linstor.Linstor) – Instead of creating a new client based on the controller addresses, use this pre-configured client object.

clear()None.  Remove all items from D.
get(k, d=None)

Return the value for key if key is in the dictionary, else default.

items()a set-like object providing a view on D’s items
keys()a set-like object providing a view on D’s keys
property namespace

Returns the current name space (e.g., /foo/).

Returns

Current name space.

Return type

str

pop(k[, d])v, remove specified key and return the corresponding value.

If key is not found, default is returned if given, otherwise KeyError is raised

popitem()

Remove and return a (key, value) pair as a 2-tuple.

Pairs are returned in LIFO (last-in, first-out) order. Raises KeyError if the dict is empty.

setdefault(k, d=None)

Insert key with a value of default if key is not in the dictionary.

Return the value for key if key is in the dictionary, else default.

update([E, ]**F)None.  Update D from dict/iterable E and F.

If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

values()an object providing a view on D’s values

linstor.linstorapi module

Linstorapi module

class linstor.linstorapi.Linstor(ctrl_host, timeout=300, keep_alive=False)

Bases: object

Linstor class represents a client connection to the Linstor controller. It has all methods to manipulate all kind of objects on the controller.

The controller host address has to be specified as linstor url. e.g: linstor://localhost, linstor+ssl://localhost

Note: This client is not thread-safe, only one request can be in flight at a time.

Parameters
  • ctrl_host (str) – Linstor uri to the controller e.g. linstor://192.168.0.1

  • keep_alive (bool) – Tries to keep the connection alive

APICALL2RESPONSE = {'API_SINGLE_NODE_REQ': <class 'linstor.responses.ResourceConnection'>, 'ExosEvents': <class 'linstor.responses.ExosEnclosureEventListResponse'>, 'ExosExec': <class 'linstor.responses.ExosExecResponse'>, 'ExosMap': <class 'linstor.responses.ExosMapListResponse'>, 'LstCtrlProps': <class 'linstor.responses.ControllerProperties'>, 'LstExosDefaults': <class 'linstor.responses.ExosDefaults'>, 'LstExosEnclosures': <class 'linstor.responses.ExosListResponse'>, 'LstKvs': <class 'linstor.responses.KeyValueStoresResponse'>, 'LstNode': <class 'linstor.responses.NodeListResponse'>, 'LstPhysicalStorage': <class 'linstor.responses.PhysicalStorageList'>, 'LstRsc': <class 'linstor.responses.ResourceResponse'>, 'LstRscDfn': <class 'linstor.responses.ResourceDefinitionResponse'>, 'LstRscGrp': <class 'linstor.responses.ResourceGroupResponse'>, 'LstSnapShips': <class 'linstor.responses.SnapshotShippingResponse'>, 'LstSnapshotDfn': <class 'linstor.responses.SnapshotResponse'>, 'LstStorPool': <class 'linstor.responses.StoragePoolListResponse'>, 'LstStorPoolDfn': <class 'linstor.responses.StoragePoolDefinitionResponse'>, 'LstVlm': <class 'linstor.responses.VolumeResponse'>, 'LstVlmDfn': <class 'linstor.responses.VolumeDefinitionResponse'>, 'LstVlmGrp': <class 'linstor.responses.VolumeGroupResponse'>, 'QryMaxVlmSize': <class 'linstor.responses.MaxVolumeSizeResponse'>, 'ReqErrorReports': <class 'linstor.responses.ErrorReport'>, 'ReqRscConnList': <class 'linstor.responses.ResourceConnectionsResponse'>, 'RptSpc': <class 'linstor.responses.SpaceReport'>, 'Version': <class 'linstor.responses.ControllerVersion'>}
API_SINGLE_NODE_REQ = 'API_SINGLE_NODE_REQ'
REST_HTTPS_PORT = 3371
REST_PORT = 3370
classmethod all_api_responses_no_error(replies)

Checks if none of the responses has an error.

Parameters

replies (list[ApiCallResponse]) – apicallresponse to check

Returns

True if none of the replies has an error.

Return type

bool

classmethod all_api_responses_success(replies)

Checks if none of the responses has an error.

Parameters

replies (list[ApiCallResponse]) – apicallresponse to check

Returns

True if all replies are success

Return type

bool

property allow_insecure
api_version_smaller(version)
Parameters

version (str) – semantic version string

Returns

True if server version is smaller than given version

Return type

bool

property cafile
property certfile
connect()

Connects the internal linstor network client.

Returns

True

property connected

Checks if the Linstor object is connect to a controller.

Returns

True if connected, else False.

controller_del_prop(key)

Deletes a property on the controller.

Parameters

key – Key of the property.

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

controller_host()

Returns the used controller hostname.

Returns

Uri used to connect.

Return type

str

controller_info()

If connected this method returns the controller info string.

Returns

Controller info string or None if not connected.

Return type

str

controller_props()

Request a list of all controller properties.

Returns

A MsgLstCtrlCfgProps proto message containing all controller props.

Return type

list

controller_set_prop(key, value)

Sets a property on the controller.

Parameters
  • key (str) – Key of the property.

  • value (str) – New Value of the property.

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

controller_version()

If connected this method returns the controller version object.

Returns

Controller info string or None if not connected.

Return type

ControllerVersion

crypt_create_passphrase(passphrase)

Create a new crypt passphrase on the controller.

Parameters

passphrase – New passphrase.

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

crypt_enter_passphrase(passphrase)

Send the master passphrase to unlock crypted volumes.

Parameters

passphrase – Passphrase to send to the controller.

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

crypt_modify_passphrase(old_passphrase, new_passphrase)

Modify the current crypt passphrase.

Parameters
  • old_passphrase – Old passphrase, need for decrypt current volumes.

  • new_passphrase – New passphrase.

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

property curl
disconnect()

Disconnects the current connection.

Returns

True if the object was connected else False.

drbd_proxy_disable(rsc_name, node_a, node_b)

Disables DRBD Proxy on a resource connection. Identified by the resource name, node1 and node2 arguments.

Parameters
  • rsc_name (str) – Name of the resource.

  • node_a (str) – Name of the first node.

  • node_b (str) – Name of the second node.

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

drbd_proxy_enable(rsc_name, node_a, node_b, port=None)

Enables DRBD Proxy on a resource connection. Identified by the resource name, node1 and node2 arguments.

Parameters
  • rsc_name (str) – Name of the resource.

  • node_a (str) – Name of the first node.

  • node_b (str) – Name of the second node.

  • port (int) – Port the Proxy connection should use.

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

drbd_proxy_modify(rsc_name, property_dict=None, delete_props=None, compression_type=None, compression_property_dict=None)

Configure DRBD Proxy for the given resource definition.

Parameters
  • rsc_name (str) – Name of the resource definition to modify.

  • str] property_dict (dict[str,) – Dict containing key, value pairs for new values.

  • delete_props (list[str]) – List of properties to delete

  • compression_type (str) – The compression type to use.

  • str] compression_property_dict (dict[str,) – Dict containing key, value pairs for compression values.

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

error_report_delete(nodes=None, since=None, to=None, exception=None, version=None, ids=None)

Deletes error-reports on the linstor cluster, filtered by the given parameters

Parameters
  • nodes (list[str]) – Only delete error-reports from this nodes, if None or empty all

  • since (datetime) – Start datetime from when to delete

  • to (datetime) – Until datetime to delete

  • exception (str) – Delete error reports matching this exception string

  • version (str) – Delete error reports matching this version string

  • ids (list[str]) – Error report ids to delete

Return type

list[ApiCallResponse]

error_report_list(nodes=None, with_content=False, since=None, to=None, ids=None)

Retrieves an error report list from the controller.

Parameters
  • nodes (list[str]) – Nodes to filter, if None all

  • with_content (bool) – If true the full log content will be retrieved

  • since (datetime) – Start datetime from when to include, if None all

  • to (datetime) – Until datetime to include error reports, if None all

  • ids (list[str]) – Ids there string starts with to include, if None all

Returns

A list containing ErrorReport from the controller.

Return type

list[ErrorReport]

exos_enclosure_create(enclosure_name, ctrl_a_ip, ctrl_b_ip=None, username=None, username_env=None, password=None, password_env=None)

Creates a new EXOS enclosures

Parameters
  • enclosure_name (str) – Name of the enclosure

  • ctrl_a_ip (str) – IP address of the first EXOS controller

  • ctrl_b_ip (Optional[str]) – IP address of the second EXOS controller

  • username (Optional[str]) – Username for the given EXOS enclosure

  • username_env (Optional[str]) – Environment variable containing the username for theEXOS enclosure

  • password (Optional[str]) – Password for the given EXOS enclosure

  • password_env (Optional[str]) – Environment variable containing the password for theEXOS enclosure

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

exos_enclosure_delete(enclosure_name)

Deletes the given EXOS enclosures

Parameters

enclosure_name (str) – Name of the enclosure

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

exos_enclosure_events(enclosure_name, count=None)

Lists all EXOS events from the given enclosures

Parameters
  • enclosure_name (str) – Name of the enclosure

  • count (Optional[int]) – Number of events

Returns

A list containing ExosEnclosureEventResponse from the controller

Return type

ExosEnclosureEventListResponse

exos_enclosure_modify(enclosure_name, ctrl_a_ip=None, ctrl_b_ip=None, username=None, username_env=None, password=None, password_env=None)

Modifies a given EXOS enclosures

Parameters
  • enclosure_name (str) – Name of the enclosure

  • ctrl_a_ip (Optional[str]) – IP address of the first EXOS controller

  • ctrl_b_ip (Optional[str]) – IP address of the second EXOS controller

  • username (Optional[str]) – Username for the given EXOS enclosure

  • username_env (Optional[str]) – Environment variable containing the username for theEXOS enclosure

  • password (Optional[str]) – Password for the given EXOS enclosure

  • password_env (Optional[str]) – Environment variable containing the password for theEXOS enclosure

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

exos_exec(enclosure_name, cmds)

Passthrough to the EXOS API through one of the EXOS controllers of the given enclosure

Parameters
  • enclosure_name (str) – Name of the enclosure

  • cmds (List[str]) – EXOS commands to execute

Returns

Passthrough from the EXOS API

exos_get_defaults()

Gets the default values for all EXOS enclosures

Returns

The default values from the Linstor controller.

Return type

ExosDefaults

exos_list_enclosures(nocache=None)

Lists all known EXOS enclosures inlcuind health status

Parameters

nocache (bool) – Whether or not Linstor should refetch data before responding

Returns

A list containing ExosEnclosure from the controller.

Return type

list[ExosListResponse]

exos_map()

Gathers information which Linstor node is connected to which EXOS controller

Returns

A list containing ExosMapResponse from the controller.

Return type

list[ExosMapResponse]

exos_set_defaults(username=None, username_env=None, password=None, password_env=None, unset=None)

Sets the default values for all EXOS enclosures

Parameters
  • username (Optional[str]) – EXOS API username

  • username_env (Optional[str]) – Environment variable containing the EXOS API username

  • password (Optional[str]) – EXOS API password

  • password_env (Optional[str]) – Environment variable containing the EXOS API password

  • unset (Optional[List[str]]) – Unsets default keys

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

classmethod filter_api_call_response(replies)

Filters api call responses from Controller replies.

Parameters

replies (list[ApiCallResponse]) – controller reply list

Returns

Returns all only ApiCallResponses from replies or empty list.

Return type

[ApiCallResponse]

classmethod filter_api_call_response_errors(replies)

Filters api call responses and only returns errors contained in the replies list.

Parameters

replies (list[ApiCallResponse]) – list of ApiCallResponses

Returns

List only containing error responses

Return type

[ApiCallResponse]

classmethod has_linstor_https(hostname, port)

Returns the redirect https port.

Parameters
  • hostname – hostname/ip of the linstor server

  • port – http port to check for redirect

Returns

The https port of linstor if enabled, otherwise 0

Return type

int

property is_secure_connection

Returns True if the connection to linstor uses HTTPS.

Returns

True if using https else False

Return type

bool

property keyfile
keyvaluestore_list(instance_name)

Request key values for the given instance_name. Note that for implementation and historic reasons keys with a ‘/’ as prefix are returned with out this ‘/’. linstor.KV() might be a better fit in general.

Returns

Key/Value store list response objects

Return type

KeyValueStore

Raises

LinstorError – if apicallerror or no response received

keyvaluestore_modify(instance_name, property_dict=None, delete_props=None)

Modify the properties of a given key value store instance.

Parameters
  • instance_name (str) – Name of the Key/Value store to modify.

  • str]] property_dict (Optional[dict[str,) – Dict containing key, value pairs for new values.

  • delete_props (Optional[list[str]]) – List of properties to delete

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

keyvaluestores()

Requests all known KeyValue stores known to linstor and returns them in a KeyValueStoresResponse.

Returns

Key/Value store list response objects

Return type

KeyValueStoresResponse

Raises

LinstorError – if apicallerror or no response received

classmethod layer_list()

Gives a set of possible layer names.

Returns

Set of layer names

Return type

set[str]

net_interface_list(node_name)

Request a list of all netinterfaces of a node known to the controller.

Parameters

node_name (str) – Name of the node.

Returns

A REST message containing all information.

Return type

list[RESTMessageResponse]

netinterface_create(node_name, interface_name, ip, port=None, com_type=None, is_active=False)

Create a netinterface for a given node.

Parameters
  • node_name (str) – Name of the node to add the interface.

  • interface_name (str) – Name of the new interface.

  • ip (str) – IP address of the interface.

  • port (int) – Port of the interface

  • com_type (str) – Communication type to use on the interface.

  • is_active (bool) – True if the net interface should become the active satellite connection

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

netinterface_delete(node_name, interface_name)

Deletes a netinterface on the given node.

Parameters
  • node_name (str) – Name of the node.

  • interface_name (str) – Name of the netinterface to delete.

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

netinterface_modify(node_name, interface_name, ip=None, port=None, com_type=None, is_active=False)

Modify a netinterface on the given node.

Parameters
  • node_name (str) – Name of the node.

  • interface_name (str) – Name of the netinterface to modify.

  • ip (str) – New IP address of the netinterface

  • port (int) – New Port of the netinterface

  • com_type (str) – New communication type of the netinterface

  • is_active (bool) – True if the net interface should become the active satellite connection

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

node_create(node_name, node_type, ip, com_type='Plain', port=None, netif_name='default', property_dict=None)

Creates a node on the controller.

Parameters
  • node_name (str) – Name of the node.

  • node_type (str) – Node type of the new node, one of linstor.consts.VAL_NODE_TYPE*

  • ip (str) – IP address to use for the nodes default netinterface.

  • com_type (str) – Communication type of the node.

  • port (int) – Port number of the node.

  • netif_name (str) – Netinterface name that is created.

  • str] property_dict (dict[str,) – Node properties.

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

node_delete(node_name, async_msg=False)

Deletes the given node on the controller.

Parameters
  • node_name (str) – Node name to delete.

  • async_msg (bool) – True to return without waiting for the action to complete on the satellites.

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

node_list(filter_by_nodes=None, filter_by_props=None)

Request a list of all nodes known to the controller.

Parameters
  • filter_by_nodes (list[str]) – Filter by nodes.

  • filter_by_props (Optional[list[str]]) – Filter nodes by properties.

Returns

A MsgLstNode proto message containing all information.

Return type

list[RESTMessageResponse]

node_list_raise(filter_by_nodes=None, filter_by_props=None)

Request a list of all nodes known to the controller.

Parameters
  • filter_by_nodes (list[str]) – Filter by nodes.

  • filter_by_props (Optional[list[str]]) – Filter nodes by properties.

Returns

Node list response objects

Return type

NodeListResponse

Raises
  • LinstorError – if apicall error or no data received.

  • LinstorApiCallError – on an apicall error from controller

node_lost(node_name, async_msg=False)

Deletes an unrecoverable node on the controller.

Parameters
  • node_name (str) – Node name to delete.

  • async_msg (bool) – True to return without waiting for the action to complete on the satellites.

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

node_modify(node_name, node_type=None, property_dict=None, delete_props=None)

Modify the properties of a given node.

Parameters
  • node_name (str) – Name of the node to modify.

  • node_type (int) – Type of the node, any of VAL_NODE_TYPE_*

  • str] property_dict (dict[str,) – Dict containing key, value pairs for new values.

  • delete_props (list[str]) – List of properties to delete

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

node_reconnect(node_names)

Forces the controller to drop a connection on a satellite and reconnect.

Parameters

node_names (list[str]) – List of nodes to reconnect.

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

node_restore(node_name)

Restores an evicted node.

Parameters

node_name (str) – Node name to restore

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

node_types()

Returns all allowed node types by the api.

Returns

A list containing all node type strings.

Return type

list[str]

classmethod parse_volume_size_to_kib(size_str)

Parses a string e.g. “1g” to computer size units and return KiB

Parameters

size_str (str) – string to parse

Returns

KiB of the parsed string

Return type

int

Raises

LinstorArgumentError – If string can not be parsed as number

property password
physical_storage_create_device_pool(node_name, provider_kind, device_paths, pool_name=None, raid_level='JBOD', vdo_enable=False, vdo_logical_size_kib=None, vdo_slab_size_kib=None, storage_pool_name=None, storage_pool_props=None)

Creates a device pool on the given device and node.

Parameters
  • node_name (str) – Node name where the device pool should be created.

  • provider_kind (str) – Pool type to create, [‘LVM’, ‘LVMTHIN’, ‘ZFS’]

  • device_paths (List[str]) – List of full device path on the node.

  • raid_level (str) – For ‘JBOD’ only.

  • pool_name (Optional[str]) – Pool name

  • vdo_enable (bool) – True or False if VDO should be used.

  • vdo_logical_size_kib (Optional[int]) – Logical pool size for VDO

  • vdo_slab_size_kib (Optional[int]) – Slab size for VDO

  • storage_pool_name (Optional[str]) – If provided creates also a storage pool with that name

  • storage_pool_props (Optional[Dict[str,str]]) – Additional storage pool props

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

physical_storage_list()

Returns a grouped list of physical storage device, to be used for pools. Requires API version 1.0.10

Returns

PhysicalStorageList object

Return type

PhysicalStorageList

Raises

LinstorError

classmethod provider_list()

Gives a set of possible provider names.

Returns

Set of provider names

Return type

set[str]

resource_activate(node_name, rsc_name)

Activate a resource on the given node.

Parameters
  • node_name (str) – node name of the resource

  • rsc_name (str) – resource name

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

resource_auto_place(rsc_name, place_count, storage_pool=None, do_not_place_with=None, do_not_place_with_regex=None, replicas_on_same=None, replicas_on_different=None, diskless_on_remaining=False, async_msg=False, layer_list=None, provider_list=None, additional_place_count=None, diskless_type=None, diskless_storage_pool=None)

Auto places(deploys) a resource to the amount of place_count.

Parameters
  • rsc_name (str) – Name of the resource definition to deploy

  • place_count (optional[int]) – Number of placements to reach, on how many different nodes. either place_count or additional_place_count must be present

  • storage_pool (list[str]) – List of storage pools to use

  • do_not_place_with (list[str]) – Do not place with resource names in this list

  • do_not_place_with_regex (str) – A regex string that rules out resources

  • replicas_on_same (list[str]) – A list of node property names, their values should match

  • replicas_on_different (list[str]) – A list of node property names, their values should not match

  • diskless_on_remaining (bool) – If True all remaining nodes will add a diskless resource

  • async_msg (bool) – True to return without waiting for the action to complete on the satellites

  • layer_list (list[str]) – Define layers for the resource

  • provider_list (list[str]) – Filter provider kinds

  • additional_place_count (optional[int]) – Number of additional placements. either place_count or additional_place_count must be present

  • diskless_type (optional[str]) – Either apiconst.FLAG_DRBD_DISKLESS or apiconst.FLAG_NVME_INITIATOR

  • diskless_storage_pool (optional[list[str]]) – List of diskless pools to use

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

resource_conn_list(rsc_name)

Request a list of all resource connection to the given resource name.

Parameters

rsc_name (str) – Name of the resource to get the connections.

Returns

List of ResourceConnectionsResponse or ApiCallRcResponse

Return type

list[RESTMessageResponse]

resource_conn_list_raise(rsc_name)

Request a list of all resource connection to the given resource name.

Parameters

rsc_name (str) – Name of the resource to get the connections.

Returns

ResourceConnectionsResponse object

Return type

ResourceConnectionsResponse

Raises
  • LinstorError – if apicall error or no data received.

  • LinstorApiCallError – on an apicall error from controller

resource_conn_modify(rsc_name, node_a, node_b, property_dict, delete_props)

Modify properties of a resource connection. Identified by the resource name, node1 and node2 arguments.

Parameters
  • rsc_name (str) – Name of the resource.

  • node_a (str) – Name of the first node.

  • node_b (str) – Name of the second node.

  • str] property_dict (dict[str,) – Dict containing key, value pairs for new values.

  • delete_props (list[str]) – List of properties to delete

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

resource_conn_node_list_raise(rsc_name, node_a, node_b)

Request a list of all resource connection to the given resource name.

Parameters
  • rsc_name (str) – Name of the resource to get the connections.

  • node_a (str) – Name of the first node

  • node_b (str) – Name of the second node

Returns

List of ResourceConnectionsResponse or ApiCallRcResponse

Return type

list[ResourceConnection]

resource_create(rscs, async_msg=False)

Creates new resources in a resource definition.

Parameters
  • rscs (list[ResourceData]) – Resources to create

  • async_msg (bool) – True to return without waiting for the action to complete on the satellites.

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

resource_create_and_auto_place(rsc_name, size, place_count, storage_pool=None, diskless_on_remaining=False)

This is a convenience method mainly intended for plugins. It is quite usual that plugins have a “create” step where they auto-place a resource. Later, these plugins have an “open” call where they might create diskless assignments.

Parameters
  • rsc_name (str) – Name of the new resource definition.

  • size (int) – Size of the volume definition in kibibytes.

  • place_count (int) – Number of placements, on how many different nodes

  • storage_pool (str) – Storage pool to use

  • diskless_on_remaining (bool) – If True all remaining nodes will add a diskless resource

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

resource_deactivate(node_name, rsc_name)

De-activate a resource on the given node.

Parameters
  • node_name (str) – node name of the resource

  • rsc_name (str) – resource name

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

resource_delete(node_name, rsc_name, async_msg=False)

Deletes a given resource on the given node.

Parameters
  • node_name (str) – Name of the node where the resource is deployed.

  • rsc_name (str) – Name of the resource.

  • async_msg (bool) – True to return without waiting for the action to complete on the satellites.

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

resource_delete_if_diskless(node_name, rsc_name)

Deletes a given resource if, and only if, diskless on the given node. If the resource does not even exit, then the delete is considered successful (NOOP). If the resource is not diskless, then the action is considered successful.

Parameters
  • node_name (str) – Name of the node where the resource is deployed.

  • rsc_name (str) – Name of the resource.

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

resource_dfn_create(name, port=None, external_name=None, layer_list=None, resource_group=None)

Creates a resource definition.

Parameters
  • name (str) – Name of the new resource definition.

  • port (int) – Port the resource definition should use.

  • layer_list (list[str]) – Set of layer names to use.

  • external_name (str) – Unicode string of the user specified name.

  • resource_group (str) – Name of the resource group the definition should be linked to.

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

resource_dfn_delete(name, async_msg=False)

Delete a given resource definition.

Parameters
  • name (str) – Resource definition name to delete.

  • async_msg (bool) – True to return without waiting for the action to complete on the satellites.

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

resource_dfn_list(query_volume_definitions=True, filter_by_resource_definitions=None, filter_by_props=None)

Request a list of all resource definitions known to the controller.

Parameters
  • query_volume_definitions (bool) – Query the volume definitions of this resource definition.

  • filter_by_resource_definitions (list[str]) – Filter resource definitions by resource definition names.

  • filter_by_props (Optional[list[str]]) – Filter nodes by properties

Returns

A ResourceDefinitionResponse object

Return type

list[ResourceDefinitionResponse]

resource_dfn_list_raise(query_volume_definitions=True, filter_by_resource_definitions=None, filter_by_props=None)

Request a list of all resource definitions known to the controller.

Parameters
  • query_volume_definitions (bool) – Query the volume definitions of this resource definition.

  • filter_by_resource_definitions (list[str]) – Filter resource definitions by resource definition names.

  • filter_by_props (Optional[list[str]]) – Filter nodes by properties

Returns

A ResourceDefinitionResponse object

Return type

ResourceDefinitionResponse

Raises
  • LinstorError – if apicall error or no data received.

  • LinstorApiCallError – on an apicall error from controller

resource_dfn_modify(name, property_dict, delete_props=None, peer_slots=None, resource_group=None)

Modify properties of the given resource definition.

Parameters
  • name (str) – Name of the resource definition to modify.

  • str] property_dict (dict[str,) – Dict containing key, value pairs for new values.

  • delete_props (list[str]) – List of properties to delete

  • peer_slots (int) – peer slot count for new resources of this resource dfn

  • resource_group (Optional[str]) – Change resource group to the given name

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

resource_dfn_props_list(rsc_name, filter_by_namespace='')

Return a dictionary containing keys for a resource definition filtered by namespace.

Parameters
  • rsc_name (str) – Name of the resource definition it is linked to.

  • filter_by_namespace (str) – Return only keys starting with the given prefix.

Returns

dict containing matching keys

Raises

LinstorError – if resource can not be found

resource_group_create(name, description=None, place_count=None, storage_pool=None, do_not_place_with=None, do_not_place_with_regex=None, replicas_on_same=None, replicas_on_different=None, diskless_on_remaining=None, layer_list=None, provider_list=None, property_dict=None, diskless_storage_pool=None)

Create resource group with values.

Parameters
  • name (str) – Name of the resource group to modify.

  • description (str) – description for the resource group.

  • place_count (int) – Number of placements, on how many different nodes

  • storage_pool (list[str]) – List of storage pools to use

  • do_not_place_with (list[str]) – Do not place with resource names in this list

  • do_not_place_with_regex (str) – A regex string that rules out resources

  • replicas_on_same (list[str]) – A list of node property names, their values should match

  • replicas_on_different (list[str]) – A list of node property names, their values should not match

  • diskless_on_remaining (bool) – If True all remaining nodes will add a diskless resource

  • layer_list (list[str]) – Define layers for the resource

  • provider_list (list[str]) – Filter provider kinds

  • str] property_dict (dict[str,) – Dict containing key, value pairs for new values.

  • diskless_storage_pool (optional[list[str]]) – List of diskless pools to use

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

resource_group_delete(name)

Delete a given resource group.

Parameters

name (str) – Resource group name to delete.

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

resource_group_list_raise(filter_by_resource_groups=None, filter_by_props=None)

Request a list of all resource groups known to the controller.

Parameters
  • filter_by_resource_groups (list[str]) – Filter by the given resource group names.

  • filter_by_props (Optional[list[str]]) – Filter nodes by properties.

Returns

A ResourceGroupListResponse object

Return type

ResourceGroupResponse

Raises
  • LinstorError – if apicall error or no data received.

  • LinstorApiCallError – on an apicall error from controller

resource_group_modify(name, description=None, place_count=None, storage_pool=None, do_not_place_with=None, do_not_place_with_regex=None, replicas_on_same=None, replicas_on_different=None, diskless_on_remaining=None, layer_list=None, provider_list=None, property_dict=None, delete_props=None, diskless_storage_pool=None)

Modify the given resource group.

Parameters
  • name (str) – Name of the resource group to modify.

  • description (str) – description for the resource group.

  • place_count (int) – Number of placements, on how many different nodes

  • storage_pool (list[str]) – List of storage pools to use

  • do_not_place_with (list[str]) – Do not place with resource names in this list

  • do_not_place_with_regex (str) – A regex string that rules out resources

  • replicas_on_same (list[str]) – A list of node property names, their values should match

  • replicas_on_different (list[str]) – A list of node property names, their values should not match

  • diskless_on_remaining (bool) – If True all remaining nodes will add a diskless resource

  • layer_list (list[str]) – Define layers for the resource

  • provider_list (list[str]) – Filter provider kinds

  • str] property_dict (dict[str,) – Dict containing key, value pairs for new values.

  • delete_props (list[str]) – List of properties to delete

  • diskless_storage_pool (optional[list[str]]) – List of diskless pools to use

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

resource_group_qmvs(rsc_grp_name)

Queries maximum volume size from the given resource group

This is basically the same as the qmvs on controller level, but this API reads all auto-place settings from the given resource group.

Parameters

rsc_grp_name (str) – Name of the resource group to fetch the query filters

resource_group_spawn(rsc_grp_name, rsc_dfn_name, vlm_sizes, partial=False, definitions_only=False, external_name=None)

Spawns resource for the given resource group.

Parameters
  • rsc_grp_name (str) – Name of the resource group to spawn from.

  • rsc_dfn_name (str) – Name of the new resource definition.

  • vlm_sizes (list[str]) – Volume definitions to spawn

  • partial (bool) – If false, the length of the vlm_sizes has to match the number of volume-groups or an error is returned.

  • definitions_only (bool) – Do not auto place resource, just create the definitions

  • external_name (Optional[str]) – External name to set for the resource definition, if this is specified the resource definition name will be ignored

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

resource_list(filter_by_nodes=None, filter_by_resources=None, filter_by_props=None)

Request a list of all resources known to the controller.

Parameters
  • filter_by_nodes (list[str]) – filter resources by nodes

  • filter_by_resources (list[str]) – filter resources by resource names

  • filter_by_props (Optional[list[str]]) – Filter nodes by properties

Returns

A list containing a ResourceResponse object

Return type

list[ResourceResponse]

resource_list_raise(filter_by_nodes=None, filter_by_resources=None, filter_by_props=None)

Request a list of all resources known to the controller.

Parameters
  • filter_by_nodes (list[str]) – filter resources by nodes

  • filter_by_resources (list[str]) – filter resources by resource names

  • filter_by_props (Optional[list[str]]) – Filter nodes by properties

Returns

A ResourceResponse object

Return type

ResourceResponse

Raises
  • LinstorError – if apicall error or no data received.

  • LinstorApiCallError – on an apicall error from controller

resource_modify(node_name, rsc_name, property_dict, delete_props=None)

Modify properties of a given resource.

Parameters
  • node_name (str) – Node name where the resource is deployed.

  • rsc_name (str) – Name of the resource.

  • str] property_dict (dict[str,) – Dict containing key, value pairs for new values.

  • delete_props (list[str]) – List of properties to delete

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

resource_toggle_disk(node_name, rsc_name, storage_pool=None, diskless=False, async_msg=False, migrate_from=None)

Toggles a resource between diskless and having a disk.

Parameters
  • node_name (str) – Node name where the resource is deployed.

  • rsc_name (str) – Name of the resource.

  • async_msg (bool) – True to return without waiting for the action to complete on the satellites.

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

classmethod return_if_error(replies_)

Returns None if any of the replies is an error.

Parameters

replies (list[ApiCallResponse]) – list of api call responses

Returns

None if any is not success, else all given replies

classmethod return_if_failure(replies_)

Returns None if any of the replies is no success.

Parameters

replies (list[ApiCallResponse]) – list of api call responses

Returns

None if any is not success, else all given replies

snapshot_create(node_names, rsc_name, snapshot_name, async_msg=False)

Create a snapshot.

Parameters
  • node_names (list[str]) – Names of the nodes, if empty or None snapshot will be created on all nodes.

  • rsc_name (str) – Name of the resource.

  • snapshot_name (str) – Name of the new snapshot.

  • async_msg (bool) – True to return without waiting for the action to complete on the nodes.

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

snapshot_delete(rsc_name, snapshot_name)

Delete a snapshot.

Parameters
  • rsc_name (str) – Name of the resource.

  • snapshot_name (str) – Name of the snapshot.

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

snapshot_dfn_list(filter_by_nodes=None, filter_by_resources=None)

Request a list of all snapshot definitions known to the controller.

Parameters
  • filter_by_nodes (list[str]) – filter snapshots by nodes

  • filter_by_resources (list[str]) – filter snapshots by resource names

Returns

A LstSnapshotDfn REST response containing all information.

Return type

list[SnapshotsResponse]

snapshot_dfn_list_raise(filter_by_nodes=None, filter_by_resources=None)

Request a list of all snapshot definitions known to the controller.

Parameters
  • filter_by_nodes (list[str]) – filter resources by nodes

  • filter_by_resources (list[str]) – filter resources by resource names

Returns

A MsgLstSnapshotDfn proto message containing all information.

Return type

SnapshotsResponse

Raises
  • LinstorError – if no response

  • LinstorApiCallError – on an apicall error from controller

snapshot_resource_restore(node_names, from_resource, from_snapshot, to_resource)

Restore from a snapshot.

Parameters
  • node_names (list[str]) – Names of the nodes.

  • from_resource (str) – Name of the snapshot resource.

  • from_snapshot (str) – Name of the snapshot.

  • to_resource (str) – Name of the new resource.

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

snapshot_rollback(rsc_name, snapshot_name)

Roll a resource back to a snapshot state.

Parameters
  • rsc_name (str) – Name of the resource.

  • snapshot_name (str) – Name of the snapshot.

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

snapshot_ship(from_node, to_node, rsc_name)

Roll a resource back to a snapshot state.

Parameters
  • rsc_name (str) – Name of the resource.

  • from_node (str) – Snapshot source node.

  • to_node (str) – Snapshot target node.

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

snapshot_shipping_list(filter_by_nodes=None, filter_by_resources=None, filter_by_snapshots=None, filter_by_status=None)

Request a list of all snapshot shippings known to the controller.

Parameters
  • filter_by_nodes (list[str]) – filter resources by nodes

  • filter_by_resources (list[str]) – filter resources by resource names

  • filter_by_snapshots (list[str]) – filter shippings by snapshot names

  • filter_by_status (list[str]) – filter shippings by status

Returns

A MsgLstSnapshotDfn proto message containing all information.

Return type

list[SnapshotShippingResponse]

snapshot_volume_definition_restore(from_resource, from_snapshot, to_resource)

Create volume definitions from a snapshot.

Parameters
  • from_resource (str) – Name of the snapshot resource.

  • from_snapshot (str) – Name of the snapshot.

  • to_resource (str) – Name of the new resource.

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

sos_report_create(since=None)

Api call to create a SOS report on the controller node.

Parameters

since (Optional[datetime]) – used to limit journalctl messages

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

sos_report_download(since=None, to_file=None)

Create and download a sos report from the controller node.

Parameters
  • since (Optional[datetime]) – used to limit journalctl messages

  • to_file (Optional[str]) – path where to store the sos report, if None server given filename will be used.

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

space_reporting_query()

Acquire the hashed space reporting string for commercial customers.

Returns

Space reporting object from controller

Return type

list[SpaceReport]

stats()

Returns a printable string containing network statistics.

Returns

A string containing network stats.s

Return type

str

storage_pool_create(node_name, storage_pool_name, storage_driver, driver_pool_name, shared_space=None, property_dict=None, external_locking=False)

Creates a new storage pool on the given node. If there doesn’t yet exist a storage pool definition the controller will implicitly create one.

Parameters
  • node_name (str) – Node on which to create the storage pool.

  • storage_pool_name (str) – Name of the storage pool.

  • storage_driver (str) – Storage driver to use.

  • driver_pool_name (Optional[str]) – Name of the pool the storage driver should use on the node.

  • shared_space (Optional[str]) – Name of a shared space, if used.

  • property_dict (Optional[dict]) – Initial properties for the storage pool.

  • external_locking (bool) – if the pool uses external locking.

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

storage_pool_delete(node_name, storage_pool_name)

Deletes a storage pool on the given node.

Parameters
  • node_name (str) – Node on which the storage pool resides.

  • storage_pool_name (str) – Name of the storage pool.

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

storage_pool_dfn_create(name)

Creates a new storage pool definition on the controller.

Parameters

name (str) – Storage pool definition name.

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

storage_pool_dfn_delete(name)

Delete a given storage pool definition.

Parameters

name (str) – Storage pool definition name to delete.

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

storage_pool_dfn_list()

Request a list of all storage pool definitions known to the controller.

Returns

A MsgLstStorPoolDfn proto message containing all information.

Return type

list[StoragePoolDefinitionResponse]

storage_pool_dfn_max_vlm_sizes(place_count, storage_pool_name=None, do_not_place_with=None, do_not_place_with_regex=None, replicas_on_same=None, replicas_on_different=None)

Auto places(deploys) a resource to the amount of place_count.

Parameters
  • place_count (int) – Number of placements, on how many different nodes

  • storage_pool_name (str) – Only check for the given storage pool name

  • do_not_place_with (list[str]) – Do not place with resource names in this list

  • do_not_place_with_regex (str) – A regex string that rules out resources

  • replicas_on_same (list[str]) – A list of node property names, their values should match

  • replicas_on_different (list[str]) – A list of node property names, their values should not match

Returns

A list containing ApiCallResponses (with MsgRspMaxVlmSizes)

Return type

Union[list[ApiCallResponse], list[RESTMessageResponse]]

storage_pool_dfn_modify(name, property_dict, delete_props=None)

Modify properties of a given storage pool definition.

Parameters
  • name (str) – Storage pool definition name to modify

  • str] property_dict (dict[str,) – Dict containing key, value pairs for new values.

  • delete_props (list[str]) – List of properties to delete

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

storage_pool_list(filter_by_nodes=None, filter_by_stor_pools=None, filter_by_props=None)

Request a list of all storage pools known to the controller.

Parameters
  • filter_by_nodes (list[str]) – Filter storage pools by nodes.

  • filter_by_stor_pools (list[str]) – Filter storage pools by storage pool names.

  • filter_by_props (Optional[list[str]]) – Filter nodes by properties.

Returns

A MsgLstStorPool proto message containing all information.

Return type

list[RESTMessageResponse]

storage_pool_list_raise(filter_by_nodes=None, filter_by_stor_pools=None, filter_by_props=None)
Parameters
  • filter_by_nodes (Optional[list[str]]) – node names to filter

  • filter_by_stor_pools (Optional[list[str]]) – storage pool names to filter

  • filter_by_props (Optional[list[str]]) – Filter nodes by properties.

Returns

StoragePoolListResponse object

Return type

StoragePoolListResponse

Raises
  • LinstorError – if apicall error or no data received.

  • LinstorApiCallError – on an apicall error from controller

storage_pool_modify(node_name, storage_pool_name, property_dict, delete_props=None)

Modify properties of a given storage pool on the given node.

Parameters
  • node_name (str) – Node on which the storage pool resides.

  • storage_pool_name (str) – Name of the storage pool.

  • str] property_dict (dict[str,) – Dict containing key, value pairs for new values.

  • delete_props (list[str]) – List of properties to delete

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

property username
volume_dfn_create(rsc_name, size, volume_nr=None, minor_nr=None, encrypt=False, storage_pool=None, gross=False)

Create a new volume definition on the controller.

Parameters
  • rsc_name (str) – Name of the resource definition it is linked to.

  • size (int) – Size of the volume definition in kibibytes.

  • volume_nr (int) – Volume number to use.

  • minor_nr (int) – Minor number to use.

  • encrypt (bool) – Encrypt created volumes from this volume definition.

  • storage_pool – Storage pool this volume definition will use.

  • gross (bool) – Specified size should be interpreted as gross size.

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

volume_dfn_delete(rsc_name, volume_nr, async_msg=False)

Delete a given volume definition.

Parameters
  • rsc_name (str) – Resource definition name of the volume definition.

  • volume_nr – Volume number.

  • async_msg (bool) – True to return without waiting for the action to complete on the satellites.

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

volume_dfn_modify(rsc_name, volume_nr, set_properties=None, delete_properties=None, size=None, gross=None)

Modify properties of the given volume definition.

Parameters
  • rsc_name (str) – Name of the resource definition.

  • volume_nr (int) – Volume number of the volume definition.

  • str] set_properties (dict[str,) – Dict containing key, value pairs for new values.

  • delete_properties (list[str]) – List of properties to delete

  • size (int) – New size of the volume definition in kibibytes.

  • gross (Optional[bool]) – Specified size should be interpreted as gross size, False will use net-size again.

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

volume_group_create(resource_grp_name, volume_nr=None, property_dict=None, gross=False)

Create a volume group.

Parameters
  • resource_grp_name (str) – Name of the resource group.

  • volume_nr (int) – Volume number to set, might be None.

  • str] property_dict (dict[str,) – Dict containing key, value pairs for new values.

  • gross (bool) – Specified size should be interpreted as gross size.

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

volume_group_delete(resource_grp_name, volume_nr)

Delete a given resource group.

Parameters
  • resource_grp_name (str) – Resource group name.

  • volume_nr (int) – Volume nr to delete.

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

volume_group_list_raise(resource_grp_name)

Request a list of all resource groups known to the controller.

Returns

A VolumeGroupResponse object

Return type

VolumeGroupResponse

Raises
  • LinstorError – if apicall error or no data received.

  • LinstorApiCallError – on an apicall error from controller

volume_group_modify(resource_grp_name, volume_nr, property_dict=None, delete_props=None, gross=None)

Modify properties of the given volume group.

Parameters
  • resource_grp_name (str) – Name of the resource group to modify.

  • volume_nr (int) – Volume number to edit.

  • str] property_dict (dict[str,) – Dict containing key, value pairs for new values.

  • delete_props (list[str]) – List of properties to delete

  • gross (Optional[bool]) – Specified size should be interpreted as gross size, False will use net-size again.

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

volume_list(filter_by_nodes=None, filter_by_stor_pools=None, filter_by_resources=None, filter_by_props=None)

Request a list of all volumes known to the controller.

Parameters
  • filter_by_nodes (list[str]) – filter resources by nodes

  • filter_by_stor_pools (list[str]) – filter resources by storage pool names

  • filter_by_resources (list[str]) – filter resources by resource names

  • filter_by_props (Optional[list[str]]) – Filter nodes by properties

Returns

A list containing a ResourceResponse object

Return type

list[RESTMessageResponse]

volume_list_raise(filter_by_nodes=None, filter_by_stor_pools=None, filter_by_resources=None, filter_by_props=None)

Request a list of all volumes known to the controller.

Parameters
  • filter_by_nodes (list[str]) – filter resources by nodes

  • filter_by_stor_pools (list[str]) – filter resources by storage pool names

  • filter_by_resources (list[str]) – filter resources by resource names

  • filter_by_props (Optional[list[str]]) – Filter nodes by properties

Returns

A ResourceResponse object

Return type

ResourceResponse

Raises
  • LinstorError – if apicall error or no data received.

  • LinstorApiCallError – on an apicall error from controller

volume_modify(node_name, rsc_name, vlm_nr, property_dict, delete_props=None)

Modify properties of a given resource.

Parameters
  • node_name (str) – Node name where the resource is deployed.

  • rsc_name (str) – Name of the resource.

  • vlm_nr (int) – Number of the volume

  • str] property_dict (dict[str,) – Dict containing key, value pairs for new values.

  • delete_props (list[str]) – List of properties to delete

Returns

A list containing ApiCallResponses from the controller.

Return type

list[ApiCallResponse]

class linstor.linstorapi.MultiLinstor(ctrl_host_list, timeout=300, keep_alive=False)

Bases: linstor.linstorapi.Linstor

connect()

Connects the internal linstor network client.

Returns

True

classmethod controller_uri_list(controller_list)

Converts a simple ‘10.0.0.1,10.0.0.2’ ip/host list to [‘linstor://10.0.0.1’, ‘linstor://10.0.0.2’] uris. :param str controller_list: list of controller addresses separated by comma :return: List of linstor uris :rtype: list[str]

class linstor.linstorapi.ResourceData(node_name, rsc_name, diskless=False, storage_pool=None, node_id=None, layer_list=None, drbd_diskless=False, nvme_initiator=False, active=True)

Bases: object

property active
property diskless
property drbd_diskless
property layer_list
property node_id
property node_name
property nvme_initiator
property rsc_name
property storage_pool

linstor.responses module

Linstor response module

Contains various classes of linstorapi responses wrappers.

class linstor.responses.ApiCallResponse(rest_data)

Bases: linstor.responses.RESTMessageResponse

This is a wrapper class for a proto MsgApiCallResponse. It provides some additional methods for easier state checking of the ApiCallResponse.

property cause
property correction
property data_v0
property details
property error_report_ids
classmethod from_json(json_data)

Creates a ApiCallResponse from a data block.

Parameters

json_data – Parsed json data with “ret_code”, “message” and “details” fields.

Returns

a new ApiCallResponse()

is_error(code=None)

Returns True if the ApiCallResponse is any error and “code” is unset. If “code” is set, return True if the given “code” matches the response code.

Returns

True if it is any error and “code” unset. If “code” is set return True if “code” matches response code. In any other cases (e.g., not an error at all), return False.

is_info()

Returns True if the ApiCallResponse is an info.

Returns

True if it is an info.

is_success()

Returns True if the ApiCallResponse is a success message.

Returns

True if it is a success message.

is_warning()

Returns True if the ApiCallResponse is a warning.

Returns

True if it is a warning.

property message
property object_refs

Returns a dict generator with the object_references.

Returns

Dict with object references

Return type

dict[str, str]

property ret_code

Returns the numeric return code mask.

Returns

Return code mask value

class linstor.responses.Candidate(data)

Bases: linstor.responses.RESTMessageResponse

property all_thin
property max_volume_size
property node_names
property storage_pool
class linstor.responses.ControllerProperties(data)

Bases: linstor.responses.RESTMessageResponse

property properties
class linstor.responses.ControllerVersion(data)

Bases: linstor.responses.RESTMessageResponse

property build_time
property git_hash
property rest_api_version
property version
class linstor.responses.DrbdConnection(rest_data)

Bases: linstor.responses.RESTMessageResponse

property connected
property message
class linstor.responses.DrbdLayer(rest_data)

Bases: linstor.responses.RESTMessageResponse

property port
property secret
class linstor.responses.DrbdResource(data)

Bases: linstor.responses.RESTMessageResponse

property al_size

Get DRBD activity log size :return: al size :rtype: int

property al_stripes

Get DRBD activity log stripes :return: al_stripes :rtype: int

property connections

Connections dict of this DRBD Resource.

Returns

A node to DrbdConnection dict

Return type

dict[str, DrbdConnection]

property node_id

Get DRBD node id :return: node id :rtype: int

property peer_slots

Get DRBD peer slots :return: peer slot count :rtype: int

class linstor.responses.DrbdVolumeData(data)

Bases: linstor.responses.RESTMessageResponse

property allocated_size
property backing_device
property device_path
property drbd_volume_definition
property meta_disk
property usable_size
class linstor.responses.DrbdVolumeDefinition(data)

Bases: linstor.responses.RESTMessageResponse

property minor
property number
property resource_name_suffix
class linstor.responses.DrbdVolumeDefinitionData(rest_data)

Bases: linstor.responses.RESTMessageResponse

property minor
property number
property resource_name_suffix
class linstor.responses.ErrorReport(data)

Bases: linstor.responses.RESTMessageResponse

property data_v0
property datetime
property exception
property exception_message
property id
property module
property node_name
property node_names
property origin_file
property origin_line
Returns

origin line of the exception

Return type

Optional[int]

property peer
property text
property version
class linstor.responses.ExosDefaults(rest_data)

Bases: linstor.responses.RESTMessageResponse

property password
property password_env
property username
property username_env
class linstor.responses.ExosEnclosure(rest_data)

Bases: linstor.responses.RESTMessageResponse

property ctrl_a_ip
property ctrl_b_ip
property health
property health_reason
property name
class linstor.responses.ExosEnclosureEvent(rest_data)

Bases: linstor.responses.RESTMessageResponse

property additional_information
property controller
property event_id
property message
property recommended_action
property severity
property time_stamp
property time_stamp_numeric
class linstor.responses.ExosEnclosureEventListResponse(rest_data)

Bases: linstor.responses.RESTMessageResponse

property exos_events

Returns a list with the most current EXOS events.

Returns

The event list.

Return type

list[ExosEnclosureEvent]

class linstor.responses.ExosExecResponse(rest_data)

Bases: linstor.responses.RESTMessageResponse

class linstor.responses.ExosListResponse(rest_data)

Bases: linstor.responses.RESTMessageResponse

exos_enclosure(encl_name)

Returns the specified enclosure from the list of enclosures.

Parameters

encl_name (str) – EXOS enclosure name

Returns

ExosEnclosure object of the enclosure, or None

Return type

ExosEnclosure

property exos_enclosures

Returns a list with all EXOS enclosures.

Returns

The enclosure list.

Return type

list[ExosEnclosure]

class linstor.responses.ExosMapListResponse(rest_data)

Bases: linstor.responses.RESTMessageResponse

property exos_connections

Returns a list with currently active Linstor node <-> EXOS controller connections.

Returns

The map list.

Return type

list[ExosMapResponse]

class linstor.responses.ExosMapResponse(rest_data)

Bases: linstor.responses.RESTMessageResponse

property connections
property enclosure_name
property node_name
class linstor.responses.FreeSpace(rest_data)

Bases: linstor.responses.RESTMessageResponse

property data_v0
property free_capacity
property total_capacity
class linstor.responses.KeyValueStore(instance_name, props)

Bases: object

property properties

Returns the property dictionary.

Returns

dict containing key values

Return type

dict[str, str]

class linstor.responses.KeyValueStoresResponse(data)

Bases: linstor.responses.RESTMessageResponse

instance(name)

Returns a KeyValueStore object containing the specified KV instance.

Parameters

name (str) – name of the instance wanted

Returns

KeyValueStore object of the instance, if none found an empty is created

Return type

KeyValueStore

instances()

Returns a list of all known instances :return: List with all names of instances :rtype: list[str]

class linstor.responses.LUKSVolumeData(data)

Bases: linstor.responses.RESTMessageResponse

class linstor.responses.MaxVolumeSizeResponse(data)

Bases: linstor.responses.RESTMessageResponse

property candidates
Returns

Return type

list[Candidates]

property default_max_oversubscription_ratio
class linstor.responses.NetInterface(rest_data)

Bases: linstor.responses.RESTMessageResponse

property address
property data_v0
property is_active
property name
property stlt_encryption_type
property stlt_port
class linstor.responses.Node(rest_data)

Bases: linstor.responses.RESTMessageResponse

property connection_status
property data_v0
property flags
property name
property net_interfaces
property properties
property props
property resource_layers
property storage_providers
property type
property unsupported_layers
property unsupported_providers
class linstor.responses.NodeListResponse(rest_data)

Bases: linstor.responses.RESTMessageResponse

property data_v0
node(node_name)

Returns the specified node from the nodelist.

Parameters

node_name (str) – Node name

Returns

Node object of the node, or None

Return type

Node

property nodes

Returns a list with all nodes.

Returns

The node list.

Return type

list[Node]

class linstor.responses.NodeStorageEntry(data)

Bases: linstor.responses.RESTMessageResponse

property device
property model
property serial
property wwn
class linstor.responses.NodeType

Bases: object

AUXILIARY = 'Auxiliary'
COMBINED = 'Combined'
CONTROLLER = 'Controller'
SATELLITE = 'Satellite'
class linstor.responses.PhysicalDevice(data)

Bases: linstor.responses.RESTMessageResponse

property nodes

Returns a node map :return: :rtype: Dict[str, List[NodeStorageEntry]]

property rotational
property size
class linstor.responses.PhysicalStorageList(data)

Bases: linstor.responses.RESTMessageResponse

property physical_devices
class linstor.responses.RESTMessageResponse(rest_data)

Bases: object

A base protobuf wrapper class, all api response use.

data(version)

Returns a specific version data format. :param str version: :return:

property data_v0
property data_v1
class linstor.responses.Resource(rest_data)

Bases: linstor.responses.RESTMessageResponse

property create_datetime
Returns

Creation datetime of this resource

Return type

Optional[datetime]

property data_v0
property flags

Resource flags as string list.

Returns

Resource definition flags as string list

Return type

list[str]

property layer_data

Return resource layer object :return: :rtype: ResourceLayerData

property name
property node_name
property properties

Resource properties.

Returns

Property map

Return type

dict[str, str]

property uuid
property volumes

Resource volumes. :return: Resource volumes :rtype: list[Volume]

class linstor.responses.ResourceConnection(data)

Bases: linstor.responses.RESTMessageResponse

property data_v0
property flags
property node_a
property node_b
property port
property properties
class linstor.responses.ResourceConnectionsResponse(data)

Bases: linstor.responses.RESTMessageResponse

property data_v0
property resource_connections
class linstor.responses.ResourceDefinition(rest_data)

Bases: linstor.responses.RESTMessageResponse

property drbd_data
property external_name

Returns the external name of the resource :return: :rtype: str

property flags

Resource definition flags as string list.

Returns

Resource definition flags as string list

Return type

list[str]

property name

Resource definition name.

Returns

Resource definition name

Return type

str

property properties

Resource definition properties.

Returns

Property map

Return type

dict[str, str]

property resource_group_name

Returns the resource group name linked to the resource.

Returns

Name of the resource group this resource belongs too.

Return type

str

property uuid
property volume_definitions

List of all volume definitions

Returns

Return type

list[VolumeDefinition]

class linstor.responses.ResourceDefinitionResponse(rest_data)

Bases: linstor.responses.RESTMessageResponse

property data_v0

Returns compatibility output for the first machine readable format.

Returns

Dictionary with old resource definition format

property resource_definitions

List of resource definitions :return: List of resource definitions :rtype: list[ResourceDefinition]

class linstor.responses.ResourceGroup(rest_data)

Bases: linstor.responses.RESTMessageResponse

property description

Resource group description.

Returns

Group description

Return type

str

property name

Resource group name.

Returns

Resource group name

Return type

str

property properties

Resource group properties.

Returns

Property map

Return type

dict[str, str]

property select_filter

Returns the select filter for the resource group.

Returns

Select filter class

Return type

SelectFilter

class linstor.responses.ResourceGroupResponse(rest_data)

Bases: linstor.responses.RESTMessageResponse

property resource_groups

List of resource groups :return: List of resource groups :rtype: list[ResourceGroup]

class linstor.responses.ResourceLayerData(data)

Bases: linstor.responses.RESTMessageResponse

property children

Return resource layer list children. :return: List of resource layer data children :rtype: list[ResourceLayerData]

property drbd_resource

Gets the DRBD resource layer data if layer data is DRBD, otherwise None.

Returns

None if it isn’t a drbd resource, otherwise the DrbdResource object

Return type

Optional[DrbdResource]

property name_suffix
property type
class linstor.responses.ResourceResponse(rest_data)

Bases: linstor.responses.RESTMessageResponse

property data_v0

Returns compatibility output for the first machine readable format.

Returns

Dictionary with old resource definition format

property nodes

List of node names, the resource is deployed :return: :rtype: list[str]

property resource_states
Returns

Return type

list[ResourceState]

property resources

Return resource list from controller. :return: List of resources :rtype: list[Resource]

class linstor.responses.ResourceState(data)

Bases: linstor.responses.RESTMessageResponse

property data_v0
property in_use

Indicates if a resource is in use, for a drbd resource this means primary. Other types might be unknown/None :return: bool or None

property name
property node_name
property rsc_name
property volume_states

Returns volume states :return: volume states list :rtype: list[VolumeState]

class linstor.responses.SelectFilter(rest_data)

Bases: linstor.responses.RESTMessageResponse

property diskless_on_remaining
property layer_stack
property not_place_with_rsc
property not_place_with_rsc_regex
property place_count
property provider_list
property replicas_on_different
property replicas_on_same
property storage_pool
property storage_pool_list

Returns the list of storage pools used :return: storage pool list :rtype: List[str]

class linstor.responses.Shipping(data)

Bases: linstor.responses.RESTMessageResponse

property from_node_name

Source node of the shipping :return: source node name :rtype: str

property snapshot_dfn

Return the SnapshotDefinition object of the shipping :return: SnapshotDefinition object of ths shipping :rtype: SnapshotDefinition

property status

Status of the shipping :return: status of the shipping :rtype: apiconsts.SnapshotShipStatus

property to_node_name

Target node of the shipping :return: target node name :rtype: str

class linstor.responses.Snapshot(data)

Bases: linstor.responses.RESTMessageResponse

property create_datetime
Returns

Creation datetime of this resource

Return type

Optional[datetime]

property flags

Resource flags as string list.

Returns

Resource definition flags as string list

Return type

list[str]

property name
property node_name
property uuid
class linstor.responses.SnapshotDefinition(data)

Bases: linstor.responses.RESTMessageResponse

property data_v0
property flags
property name
property nodes

Node name list this snapshot is deployed. :return: :rtype: list[str]

property resource_name
property rsc_name
property snapshot_name
property snapshot_volume_definitions
property snapshots
property uuid
class linstor.responses.SnapshotResponse(data)

Bases: linstor.responses.RESTMessageResponse

property data_v0
property snapshots

Returns snapshot list :return: :rtype: list[SnapshotDefinition]

class linstor.responses.SnapshotShippingResponse(data)

Bases: linstor.responses.RESTMessageResponse

property shippings

Returns snapshot shipping list :return: :rtype: list[Shipping]

class linstor.responses.SnapshotVolumeDefinition(data)

Bases: linstor.responses.RESTMessageResponse

property data_v0
property number
property size
class linstor.responses.SpaceReport(data)

Bases: linstor.responses.RESTMessageResponse

property report
class linstor.responses.StoragePool(rest_data)

Bases: linstor.responses.RESTMessageResponse

DRIVER_KIND_MAP = {'DISKLESS': 'DisklessDriver', 'LVM': 'LvmDriver', 'LVM_THIN': 'LvmThinDriver', 'SPDK': 'SpdkDriver', 'ZFS': 'ZfsDriver', 'ZFS_THIN': 'ZfsThinDriver'}
property data_v0
property driver

Provider kind string :return: provider kind string :rtype: str

property free_space

Returns the free space object of the storage pool :return: :rtype: FreeSpace

property free_space_mgr_name
is_diskless()

Checks if pool is diskless :return: True if it is a diskless pool :rtype: bool

is_fat()

Checks if pool is fat :return: True if it is a fat pool :rtype: bool

is_thin()

Checks if pool is thin :return: True if it is a thin pool :rtype: bool

property name
property node_name

Node name where the storage pool is used :return: node name :rtype: str

property properties

Storage pool properties.

Returns

Property map

Return type

dict[str, str]

property provider_kind

Provider kind string :return: provider kind string :rtype: str

property reports
property static_traits

Static traits.

Returns

Property map

Return type

dict[str, str]

supports_snapshots()
property uuid
class linstor.responses.StoragePoolDefinition(data)

Bases: linstor.responses.RESTMessageResponse

property data_v0
property name
property properties
class linstor.responses.StoragePoolDefinitionResponse(data)

Bases: linstor.responses.RESTMessageResponse

property data_v0
property storage_pool_definitions
class linstor.responses.StoragePoolDriver

Bases: object

Diskless = 'DISKLESS'
EXOS = 'EXOS'
FILE = 'FILE'
FILEThin = 'FILE_THIN'
LVM = 'LVM'
LVMThin = 'LVM_THIN'
OPENFLEX_TARGET = 'OPENFLEX_TARGET'
SPDK = 'SPDK'
ZFS = 'ZFS'
ZFSThin = 'ZFS_THIN'
classmethod diskless_driver()
static list()
static storage_driver_pool_to_props(storage_driver, driver_pool_name)
classmethod storage_props_to_driver_pool(storage_driver, props)

Find the storage pool value for the given storage_driver in the given props.

Parameters
  • storage_driver (str) – String specifying a storage driver [Lvm, LvmThin, Zfs]

  • props – Properties to search the storage pool value.

Returns

If found the storage pool value, else ‘’

Return type

str

class linstor.responses.StoragePoolListResponse(rest_data)

Bases: linstor.responses.RESTMessageResponse

property data_v0
property storage_pools

Returns list of storage pool objects. :return: list of storage pools :rtype: list[StoragePool]

class linstor.responses.StorageVolumeData(data)

Bases: linstor.responses.RESTMessageResponse

class linstor.responses.Volume(data)

Bases: linstor.responses.RESTMessageResponse

property allocated_size
property data_v0
property device_path
property drbd_data
property flags

Volume flags as string list.

Returns

Resource definition flags as string list

Return type

list[str]

property layer_data
property luks_data
property number
property properties

Volume properties.

Returns

Property map

Return type

dict[str, str]

property reports
property storage_data
property storage_pool_driver_name
property storage_pool_name
property usable_size
property uuid
class linstor.responses.VolumeDefinition(rest_data)

Bases: linstor.responses.RESTMessageResponse

property data_v0

Returns compatibility output for the first machine readable format.

Returns

Dictionary with old resource definition format

property drbd_data
property flags

Resource definition flags as string list.

Returns

Resource definition flags as string list

Return type

list[str]

property number

Volume definition number

Returns

Volume definition number

Return type

int

property properties

Resource definition properties.

Returns

Property map

Return type

dict[str, str]

property size

Nett volume size in KiB.

Returns

Nett volume size in KiB.

Return type

int

property uuid
class linstor.responses.VolumeDefinitionResponse(rest_data)

Bases: linstor.responses.RESTMessageResponse

property rest_data
property volume_definitions
Returns

Return type

list[VolumeDefinition]

class linstor.responses.VolumeGroup(rest_data)

Bases: linstor.responses.RESTMessageResponse

property flags

Volume group flags.

Returns

Flags list

Return type

list[str]

property number

Volume number

Returns

volume number

Return type

int

property properties

Volume group properties.

Returns

Property map

Return type

dict[str, str]

class linstor.responses.VolumeGroupResponse(rest_data)

Bases: linstor.responses.RESTMessageResponse

property volume_groups

List of volume groups :return: List of volume groups :rtype: list[VolumeGroup]

class linstor.responses.VolumeLayerData(data)

Bases: linstor.responses.RESTMessageResponse

property layer_type

Returns the name of the layer type. :return: Name of the layer type :rtype: str

class linstor.responses.VolumeResponse(rest_data)

Bases: linstor.responses.RESTMessageResponse

property volumes

Resource volumes. :return: Resource volumes :rtype: list[Volume]

class linstor.responses.VolumeState(data)

Bases: linstor.responses.RESTMessageResponse

property data_v0
property disk_state
Returns

String describing the disk state

Return type

str

property number

Volume number index :return: Volume number index :rtype: int

Module contents