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_alua_tpgs(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)
str(x)
 
_set_dbroot(self)
 
_get_dbroot(self)
 
_get_saveconf(self, so_path, save_file)
Fetch the configuration of all the blocks and return conf with updated storageObject info and its related target configuraion of given storage object path
 
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, target=None, storage_object=None, confirm=False)
Remove entire current configuration.
 
restore(self, config, target=None, storage_object=None, 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, so_path=None)
Write the configuration in json format to a file.
 
restore_from_file(self, restore_file=None, clear_existing=True, target=None, storage_object=None, abort_on_error=False)
Restore the configuration from a file in json format.
 
invalidate_caches(self)
Invalidate any caches used throughout the hierarchy

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

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

Class Variables [hide private]
  _default_dbroot = '/var/target'
  _preferred_dbroot = '/etc/target'

Inherited from node.CFSNode: configfs_dir

Properties [hide private]
  targets
Get the list of Target objects.
  tpgs
Get the list of all the existing TPG objects.
  node_acls
Get the list of all the existing NodeACL objects.
  node_acl_groups
Get the list of all the existing NodeACLGroup objects.
  mapped_luns
Get the list of all the existing MappedLUN objects.
  mapped_lun_groups
Get the list of all the existing MappedLUNGroup objects.
  sessions
Get the list of all the existing sessions.
  network_portals
Get the list of all the existing Network Portal objects.
  storage_objects
Get the list of all the existing Storage objects.
  luns
Get the list of all existing LUN objects.
  fabric_modules
Get the list of all FabricModule objects.
  alua_tpgs
Get the list of all ALUA TPG objects.
  dbroot
Get the target database root

Inherited from node.CFSNode: exists, path

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

 

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

Overrides: object.__init__

__str__(self)
(Informal representation operator)

 

str(x)

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, target=None, storage_object=None, 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, so_path=None)

 

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

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

 

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


Property Details [hide private]

targets

Get the list of Target objects.

Get Method:
_list_targets(self)

tpgs

Get the list of all the existing TPG objects.

Get Method:
_list_tpgs(self)

node_acls

Get the list of all the existing NodeACL objects.

Get Method:
_list_node_acls(self)

node_acl_groups

Get the list of all the existing NodeACLGroup objects.

Get Method:
_list_node_acl_groups(self)

mapped_luns

Get the list of all the existing MappedLUN objects.

Get Method:
_list_mapped_luns(self)

mapped_lun_groups

Get the list of all the existing MappedLUNGroup objects.

Get Method:
_list_mapped_lun_groups(self)

sessions

Get the list of all the existing sessions.

Get Method:
_list_sessions(self)

network_portals

Get the list of all the existing Network Portal objects.

Get Method:
_list_network_portals(self)

storage_objects

Get the list of all the existing Storage objects.

Get Method:
_list_storage_objects(self)

luns

Get the list of all existing LUN objects.

Get Method:
_list_luns(self)

fabric_modules

Get the list of all FabricModule objects.

Get Method:
_list_fabric_modules(self)

alua_tpgs

Get the list of all ALUA TPG objects.

Get Method:
_list_alua_tpgs(self)

dbroot

Get the target database root

Get Method:
_get_dbroot(self)