Package rtslib :: Module node :: Class CFSNode
[hide private]
[frames] | no frames]

Class CFSNode

object --+
         |
        CFSNode
Known Subclasses:

Instance Methods [hide private]
 
__init__(self)
x.__init__(...) initializes x; see help(type(x)) for signature
 
__nonzero__(self)
 
__str__(self)
str(x)
 
_check_self(self)
 
_create_in_cfs_ine(self, mode)
Creates the configFS node if it does not already exist depending on the mode.
 
_exists(self)
 
_get_path(self)
 
_is_fresh(self)
 
_list_files(self, path, writable=None)
List files under a path depending on their owner's write permissions.
 
delete(self)
If the underlying configFS object does not exists, this method does nothing.
 
get_attribute(self, attribute)
Returns: The named attribute's value, as a string.
 
get_auth_attr(self, auth_attr)
Returns: The named auth_attr's value, as a string.
 
get_parameter(self, parameter)
Returns: The named parameter value as a string.
 
list_attributes(self, writable=None)
Returns: A list of existing attribute names as strings.
 
list_auth_attrs(self, writable=None)
Returns: A list of existing attribute names as strings.
 
list_parameters(self, writable=None)
Returns: The list of existing RFC-3720 parameter names.
 
set_attribute(self, attribute, value)
Sets the value of a named attribute.
 
set_auth_attr(self, auth_attr, value)
Sets the value of a named auth_attr.
 
set_parameter(self, parameter, value)
Sets the value of a named RFC-3720 parameter.

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __subclasshook__

Class Variables [hide private]
  alua_metadata_dir = '/var/target/alua/iSCSI'
  configfs_dir = '/sys/kernel/config/target'
Properties [hide private]
  exists
Is True as long as the underlying configFS object exists.
  is_fresh
Is True if the underlying configFS object has been created when instantiating this particular object.
  path
Get the configFS object path.

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

__str__(self)
(Informal representation operator)

 

str(x)

Overrides: object.__str__
(inherited documentation)

_create_in_cfs_ine(self, mode)

 

Creates the configFS node if it does not already exist depending on the mode. any -> makes sure it exists, also works if the node already does exist lookup -> make sure it does NOT exist create -> create the node which must not exist beforehand Upon success (no exception raised), self._fresh is True if a node was created, else self._fresh is False.

_list_files(self, path, writable=None)

 

List files under a path depending on their owner's write permissions.

Parameters:
  • path (str) - The path under which the files are expected to be. If the path itself is not a directory, an empty list will be returned.
  • writable (bool or None) - If None (default), returns all parameters, if True, returns read-write parameters, if False, returns just the read-only parameters.
Returns:
List of file names filtered according to their write perms.

delete(self)

 

If the underlying configFS object does not exists, this method does nothing. If the underlying configFS object exists, this method attempts to delete it.

get_attribute(self, attribute)

 
Parameters:
  • attribute - The attribute's name. It is case-sensitive.
Returns:
The named attribute's value, as a string.

get_auth_attr(self, auth_attr)

 
Parameters:
  • auth_attr - The auth_attr's name. It is case-sensitive.
Returns:
The named auth_attr's value, as a string.

get_parameter(self, parameter)

 
Parameters:
  • parameter (string) - The RFC-3720 parameter's name. It is case-sensitive.
Returns:
The named parameter value as a string.

list_attributes(self, writable=None)

 
Parameters:
  • writable (bool or None) - If None (default), returns all attributes, if True, returns read-write attributes, if False, returns just the read-only attributes.
Returns:
A list of existing attribute names as strings.

list_auth_attrs(self, writable=None)

 
Parameters:
  • writable (bool or None) - If None (default), returns all auth attrs, if True, returns read-write auth attrs, if False, returns just the read-only auth attrs.
Returns:
A list of existing attribute names as strings.

list_parameters(self, writable=None)

 
Parameters:
  • writable (bool or None) - If None (default), returns all parameters, if True, returns read-write parameters, if False, returns just the read-only parameters.
Returns:
The list of existing RFC-3720 parameter names.

set_attribute(self, attribute, value)

 

Sets the value of a named attribute. The attribute must exist in configFS.

Parameters:
  • attribute (string) - The attribute's name. It is case-sensitive.
  • value (string) - The attribute's value.

set_auth_attr(self, auth_attr, value)

 

Sets the value of a named auth_attr. The auth_attr must exist in configFS.

Parameters:
  • auth_attr (string) - The auth_attr's name. It is case-sensitive.
  • value (string) - The auth_attr's value.

set_parameter(self, parameter, value)

 

Sets the value of a named RFC-3720 parameter. The parameter must exist in configFS.

Parameters:
  • parameter (string) - The RFC-3720 parameter's name. It is case-sensitive.
  • value (string) - The parameter's value.

Property Details [hide private]

exists

Is True as long as the underlying configFS object exists. If the underlying configFS objects gets deleted either by calling the delete() method, or by any other means, it will be False.

Get Method:
_exists(self)

is_fresh

Is True if the underlying configFS object has been created when instantiating this particular object. Is False if this object instantiation just looked up the underlying configFS object.

Get Method:
_is_fresh(self)

path

Get the configFS object path.

Get Method:
_get_path(self)