cinder.privsep.targets.nvmet module

NVMet Python Interface using privsep

This file adds the privsep support to the nvmet package so it can be easily consumed by Cinder nvmet target.

It also:

  • Adds some methods to the Root class to be able to get a specific subsystem or port directly without having to go through all the existing ones.

  • Presents the CFSNotFound exception as a NotFound exception which is easier to consume.

class Namespace(*args: Any, **kwargs: Any)

Bases: Namespace

delete()
classmethod setup(subsys, n, err_func=None)
class Port(*args: Any, **kwargs: Any)

Bases: Port

add_subsystem(nqn)
delete()
remove_subsystem(nqn)
classmethod setup(root, n, err_func=None)
class Root(*args: Any, **kwargs: Any)

Bases: Root

property ports
class Subsystem(*args: Any, **kwargs: Any)

Bases: Subsystem

delete()
property namespaces
classmethod setup(t, err_func=None)
deserialize(data)

Deserialize an instance, specially nvmet instances.

Reverse operation of the serialize method. Converts an nvmet instance serialized in a tuple into an actual nvmet instance.

deserialize_params(args, kwargs)

Deserialize function arguments using deserialize method.

privsep_setup(cls_name, *args, **kwargs)

Wrapper for _privsep_setup that accepts err_func argument.

serialize(instance)

Serialize parameters, specially nvmet instances.

The idea is to be able to pass an nvmet instance to privsep methods, since they are sometimes required as parameters (ie: port.setup) and also to pass the instance where do_privsep_call has to call a specific method.

Instances are passed as a tuple, with the name of the class as the first element, and in the second element the kwargs necessary to instantiate the instance of that class.

To differentiate nvmet instances from tuples there is a ‘tuple’ value that can be passed in the first element of the tuple to differentiate them.

All other instances as passed unaltered.