Package rtslib :: Module root :: Class RTSRoot
[hide private]
[frames] | no frames]

Class RTSRoot

  object --+    
           |    
node.CFSNode --+
               |
              RTSRoot

This is an interface to the root of the configFS object tree. Is allows one to start browsing Target and StorageObjects, as well as helper methods to return arbitrary objects from the configFS tree.

>>> import rtslib.root as root
>>> rtsroot = root.RTSRoot()
>>> rtsroot.path
'/sys/kernel/config/target'
>>> rtsroot.exists
True
>>> rtsroot.targets # doctest: +ELLIPSIS
[...]
>>> rtsroot.tpgs # doctest: +ELLIPSIS
[...]
>>> rtsroot.storage_objects # doctest: +ELLIPSIS
[...]
>>> rtsroot.network_portals # doctest: +ELLIPSIS
[...]
Instance Methods [hide private]
 
__init__(self)
Instantiate an RTSRoot object.
 
_list_targets(self)
 
_list_storage_objects(self)
 
_list_tpgs(self)
 
_list_node_acls(self)
 
_list_node_acl_groups(self)
 
_list_mapped_luns(self)
 
_list_mapped_lun_groups(self)
 
_list_network_portals(self)
 
_list_luns(self)
 
_list_sessions(self)
 
_list_fabric_modules(self)
 
__str__(self)
 
dump(self)
Returns a dict representing the complete state of the target config, suitable for serialization/deserialization, and then handing to restore().
 
clear_existing(self, confirm=False)
Remove entire current configuration.
 
restore(self, config, clear_existing=False, abort_on_error=False)
Takes a dict generated by dump() and reconfigures the target to match.
 
save_to_file(self, save_file=None)
Write the configuration in json format to a file.
 
restore_from_file(self, restore_file=None, clear_existing=True, abort_on_error=False)
Restore the configuration from a file in json format.

Inherited from node.CFSNode: __eq__, __ne__, delete, get_attribute, get_parameter, list_attributes, list_parameters, set_attribute, set_parameter

Class Variables [hide private]
  targets = property(_list_targets, doc= "Get the list of Target...
  tpgs = property(_list_tpgs, doc= "Get the list of all the exis...
  node_acls = property(_list_node_acls, doc= "Get the list of al...
  node_acl_groups = property(_list_node_acl_groups, doc= "Get th...
  mapped_luns = property(_list_mapped_luns, doc= "Get the list o...
  mapped_lun_groups = property(_list_mapped_lun_groups, doc= "Ge...
  sessions = property(_list_sessions, doc= "Get the list of all ...
  network_portals = property(_list_network_portals, doc= "Get th...
  storage_objects = property(_list_storage_objects, doc= "Get th...
  luns = property(_list_luns, doc= "Get the list of all existing...
  fabric_modules = property(_list_fabric_modules, doc= "Get the ...

Inherited from node.CFSNode: configfs_dir, exists, path

Method Details [hide private]

__init__(self)
(Constructor)

 

Instantiate an RTSRoot object. Basically checks for configfs setup and base kernel modules (tcm)

Overrides: node.CFSNode.__init__

__str__(self)
(Informal representation operator)

 
Overrides: object.__str__
(inherited documentation)

dump(self)

 

Returns a dict representing the complete state of the target config, suitable for serialization/deserialization, and then handing to restore().

Overrides: node.CFSNode.dump

restore(self, config, clear_existing=False, abort_on_error=False)

 

Takes a dict generated by dump() and reconfigures the target to match.
Returns list of non-fatal errors that were encountered.
Will refuse to restore over an existing configuration unless clear_existing
    is True.

save_to_file(self, save_file=None)

 

Write the configuration in json format to a file. Save file defaults to '/etc/targets/saveconfig.json'.

restore_from_file(self, restore_file=None, clear_existing=True, abort_on_error=False)

 

Restore the configuration from a file in json format.
Restore file defaults to '/etc/targets/saveconfig.json'.
Returns a list of non-fatal errors. If abort_on_error is set,
  it will raise the exception instead of continuing.


Class Variable Details [hide private]

targets

Value:
property(_list_targets, doc= "Get the list of Target objects.")

tpgs

Value:
property(_list_tpgs, doc= "Get the list of all the existing TPG object\
s.")

node_acls

Value:
property(_list_node_acls, doc= "Get the list of all the existing NodeA\
CL objects.")

node_acl_groups

Value:
property(_list_node_acl_groups, doc= "Get the list of all the existing\
 NodeACLGroup objects.")

mapped_luns

Value:
property(_list_mapped_luns, doc= "Get the list of all the existing Map\
pedLUN objects.")

mapped_lun_groups

Value:
property(_list_mapped_lun_groups, doc= "Get the list of all the existi\
ng MappedLUNGroup objects.")

sessions

Value:
property(_list_sessions, doc= "Get the list of all the existing sessio\
ns.")

network_portals

Value:
property(_list_network_portals, doc= "Get the list of all the existing\
 Network Portal objects.")

storage_objects

Value:
property(_list_storage_objects, doc= "Get the list of all the existing\
 Storage objects.")

luns

Value:
property(_list_luns, doc= "Get the list of all existing LUN objects.")

fabric_modules

Value:
property(_list_fabric_modules, doc= "Get the list of all FabricModule \
objects.")