Package rtslib :: Module tcm :: Class FileIOStorageObject
[hide private]
[frames] | no frames]

Class FileIOStorageObject

  object --+        
           |        
node.CFSNode --+    
               |    
   StorageObject --+
                   |
                  FileIOStorageObject

An interface to configFS storage objects for fileio backstore.

Instance Methods [hide private]
 
__init__(self, backstore, name, dev=None, size=None, gen_wwn=True, buffered_mode=False)
A FileIOStorageObject can be instantiated in two ways:
 
_configure(self, dev, size, wwn, buffered_mode)
 
_get_mode(self)
 
_get_size(self)
 
_set_buffered_mode(self)
FileIOStorage objects have synchronous mode enable by default.

Inherited from StorageObject: delete, is_configured

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]
  mode
Get the current FileIOStorage mode, buffered or synchronous
  size
Get the current FileIOStorage size in bytes

Inherited from StorageObject: attached_luns, backstore, name, status, udev_path, wwn

Inherited from node.CFSNode: exists, is_fresh, path

Inherited from object: __class__

Method Details [hide private]

__init__(self, backstore, name, dev=None, size=None, gen_wwn=True, buffered_mode=False)
(Constructor)

 

A FileIOStorageObject can be instantiated in two ways:

  • Creation mode: If dev and size are specified, the underlying configFS object will be created with those parameters. No FileIOStorageObject with the same name can pre-exist in the parent FileIOBackstore in that mode, or instantiation will fail.
  • Lookup mode: If dev and size are not set, then the FileIOStorageObject will be bound to the existing configFS object in the parent FileIOBackstore having the specified name. The underlying configFS object must already exist in that mode, or instantiation will fail.
Parameters:
  • backstore (FileIOBackstore) - The parent backstore of the FileIOStorageObject.
  • name (string) - The name of the FileIOStorageObject.
  • dev (string) - The path to the backend file or block device to be used.
    • Examples: dev="/dev/sda", dev="/tmp/myfile"
    • The only block device type that is accepted TYPE_DISK, or partitions of a TYPE_DISK device. For other device types, use pscsi.
  • size (string or int) - The maximum size to allocate for the file. Not used for block devices.
    • If size is an int, it represents a number of bytes
    • If size is a string, the following units can be used :
      • B or no unit present for bytes
      • k, K, kB, KB for kB (kilobytes)
      • m, M, mB, MB for MB (megabytes)
      • g, G, gB, GB for GB (gigabytes)
      • t, T, tB, TB for TB (terabytes) Example: size="1MB" for a one megabytes storage object.
      • The base value for kilo is 1024, aka 1kB = 1024B. Strictly speaking, we use kiB, MiB, etc.
  • gen_wwn (bool) - Should we generate a T10 WWN Unit Serial ?
  • buffered_mode (bool) - Should we create the StorageObject in buffered mode or not ? Byt default, we create it in synchronous mode (non-buffered). This cannot be changed later.
Returns:
A FileIOStorageObject object.
Overrides: object.__init__

_set_buffered_mode(self)

 

FileIOStorage objects have synchronous mode enable by default. This allows to move them to buffered mode. Warning, setting the object back to synchronous mode is not implemented yet, so there is no turning back unless you delete and recreate the FileIOStorageObject.


Property Details [hide private]

mode

Get the current FileIOStorage mode, buffered or synchronous

Get Method:
_get_mode(self)

size

Get the current FileIOStorage size in bytes

Get Method:
_get_size(self)