__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__
|