cinderlib.nos_brick module

Helper code to attach/detach out of OpenStack

OS-Brick is meant to be used within OpenStack, which means that there are some issues when using it on non OpenStack systems.

Here we take care of:

  • Making sure we can work without privsep and using sudo directly

  • Replacing an unlink privsep method that would run python code privileged

  • Local attachment of RBD volumes using librados

Some of these changes may be later moved to OS-Brick. For now we just copied it from the nos-brick repository.

class RBDConnector(*args: Any, **kwargs: Any)[source]

Bases: os_brick.initiator.connectors.rbd.RBDConnector

“Connector class to attach/detach RBD volumes locally.

OS-Brick’s implementation covers only 2 cases:

  • Local attachment on controller node.

  • Returning a file object on non controller nodes.

We need a third one, local attachment on non controller node.

check_valid_device(path, run_as_root=True)[source]

Verify an existing RBD handle is connected and valid.

connect_volume(connection_properties)[source]
disconnect_volume(connection_properties, device_info, force=False, ignore_errors=False)[source]
extend_volume(connection_properties)[source]

Refresh local volume view and return current size in bytes.

init(root_helper='sudo')[source]