Package rtslib :: Module target :: Class TPG
[hide private]
[frames] | no frames]

Class TPG

  object --+    
           |    
node.CFSNode --+
               |
              TPG

This is a an interface to Target Portal Groups in configFS. A TPG is identified by its parent Target object and its TPG Tag. To a TPG object is attached a list of NetworkPortals. Targets without the 'tpgts' feature cannot have more than a single TPG, so attempts to create more will raise an exception.

Instance Methods [hide private]
 
__init__(self, parent_target, tag, mode='any')
Returns: A TPG object.
 
_get_tag(self)
 
_get_parent_target(self)
 
_list_network_portals(self)
 
_get_enable(self)
 
_set_enable(self, boolean)
Enables or disables the TPG.
 
_get_nexus(self)
Gets the nexus initiator WWN, or None if the TPG does not have one.
 
_set_nexus(self, nexus_wwn=None)
Sets the nexus initiator WWN.
 
_create_in_cfs_ine(self, mode)
Creates the configFS node if it does not already exist depending on the mode.
 
_list_node_acls(self)
 
_list_luns(self)
 
_control(self, command)
 
_get_alua_metadata_path(self)
 
has_feature(self, feature)
Whether or not this TPG has a certain feature.
 
delete(self)
Recursively deletes a TPG object.
 
node_acl(self, node_wwn, mode='any')
Same as NodeACL() but without specifying the parent_tpg.
 
network_portal(self, ip_address, port, mode='any')
Same as NetworkPortal() but without specifying the parent_tpg.
 
lun(self, lun, storage_object=None, alias=None)
Same as LUN() but without specifying the parent_tpg.
 
has_enable(self)
Returns True if the TPG has the enable attribute, else False.

Inherited from node.CFSNode: __nonzero__, __str__, get_attribute, get_auth_attr, get_parameter, list_attributes, list_auth_attrs, list_parameters, set_attribute, set_auth_attr, set_parameter

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

Class Variables [hide private]

Inherited from node.CFSNode: alua_metadata_dir, configfs_dir

Properties [hide private]
  alua_metadata_path
Get the ALUA metadata directory path for the TPG.
  tag
Get the TPG Tag as an int.
  parent_target
Get the parent Target object to which the TPG is attached.
  enable
Get or set a boolean value representing the enable status of the TPG.
  network_portals
Get the list of NetworkPortal objects currently attached to the TPG.
  node_acls
Get the list of NodeACL objects currently attached to the TPG.
  luns
Get the list of LUN objects currently attached to the TPG.
  nexus
Get or set (once) the TPG's Nexus is used.

Inherited from node.CFSNode: exists, is_fresh, path

Inherited from object: __class__

Method Details [hide private]

__init__(self, parent_target, tag, mode='any')
(Constructor)

 

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

Parameters:
  • parent_target (Target) - The parent Target object of the TPG.
  • tag (int > 0) - The TPG Tag (TPGT).
  • mode (string) - An optionnal string containing the object creation mode:
    • 'any' means the configFS object will be either looked up or created.
    • 'lookup' means the object MUST already exist configFS.
    • 'create' means the object must NOT already exist in configFS.
Returns:
A TPG object.
Overrides: object.__init__

_set_enable(self, boolean)

 

Enables or disables the TPG. Raises an error if trying to disable a TPG without an enable attribute (but enabling works in that case).

_set_nexus(self, nexus_wwn=None)

 

Sets the nexus initiator WWN. Raises an exception if the nexus is already set or if the TPG does not use a nexus.

_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.

Overrides: node.CFSNode._create_in_cfs_ine
(inherited documentation)

delete(self)

 

Recursively deletes a TPG object. This will delete all attached LUN, NetworkPortal and Node ACL objects and then the TPG itself. Before starting the actual deletion process, all sessions will be disconnected.

Overrides: node.CFSNode.delete

Property Details [hide private]

alua_metadata_path

Get the ALUA metadata directory path for the TPG.

Get Method:
_get_alua_metadata_path(self)

tag

Get the TPG Tag as an int.

Get Method:
_get_tag(self)

parent_target

Get the parent Target object to which the TPG is attached.

Get Method:
_get_parent_target(self)

enable

Get or set a boolean value representing the enable status of the TPG. True means the TPG is enabled, False means it is disabled.

Get Method:
_get_enable(self)
Set Method:
_set_enable(self, boolean) - Enables or disables the TPG.

network_portals

Get the list of NetworkPortal objects currently attached to the TPG.

Get Method:
_list_network_portals(self)

node_acls

Get the list of NodeACL objects currently attached to the TPG.

Get Method:
_list_node_acls(self)

luns

Get the list of LUN objects currently attached to the TPG.

Get Method:
_list_luns(self)

nexus

Get or set (once) the TPG's Nexus is used.

Get Method:
_get_nexus(self) - Gets the nexus initiator WWN, or None if the TPG does not have one.
Set Method:
_set_nexus(self, nexus_wwn=None) - Sets the nexus initiator WWN.