Package ganeti :: Module bdev :: Class FileStorage
[hide private]
[frames] | no frames]

Class FileStorage

source code


File device.

This class represents the a file storage backend device.

The unique_id for the file device is a (file_driver, file_path) tuple.

Instance Methods [hide private]
 
__init__(self, unique_id, children, size)
Initalizes a file device backend.
source code
 
Assemble(self)
Assemble the device.
source code
 
Shutdown(self)
Shutdown the device.
source code
 
Open(self, force=False)
Make the device ready for I/O.
source code
 
Close(self)
Notifies that the device will no longer be used for I/O.
source code
boolean
Remove(self)
Remove the file backing the block device.
source code
 
Rename(self, new_id)
Renames the file.
source code
 
Grow(self, amount)
Grow the file
source code
boolean
Attach(self)
Attach to an existing file.
source code
 
GetActualSize(self)
Return the actual disk size.
source code

Inherited from BlockDev: CombinedSyncStatus, GetSyncStatus, SetInfo, SetSyncSpeed, __repr__

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

Class Methods [hide private]
bdev.FileStorage
Create(cls, unique_id, children, size)
Create a new file.
source code
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, unique_id, children, size)
(Constructor)

source code 

Initalizes a file device backend.

Overrides: object.__init__

Assemble(self)

source code 

Assemble the device.

Checks whether the file device exists, raises BlockDeviceError otherwise.

Overrides: BlockDev.Assemble

Shutdown(self)

source code 

Shutdown the device.

This is a no-op for the file type, as we don't deactivate the file on shutdown.

Overrides: BlockDev.Shutdown

Open(self, force=False)

source code 

Make the device ready for I/O.

This is a no-op for the file type.

Overrides: BlockDev.Open

Close(self)

source code 

Notifies that the device will no longer be used for I/O.

This is a no-op for the file type.

Overrides: BlockDev.Close

Remove(self)

source code 

Remove the file backing the block device.

Returns: boolean
True if the removal was successful
Overrides: BlockDev.Remove

Rename(self, new_id)

source code 

Renames the file.

Overrides: BlockDev.Rename

Grow(self, amount)

source code 

Grow the file

Parameters:
  • amount - the amount (in mebibytes) to grow with
Overrides: BlockDev.Grow

Attach(self)

source code 

Attach to an existing file.

Check if this file already exists.

Returns: boolean
True if file exists
Overrides: BlockDev.Attach

GetActualSize(self)

source code 

Return the actual disk size.

Overrides: BlockDev.GetActualSize

Note: the device needs to be active when this is called

Create(cls, unique_id, children, size)
Class Method

source code 

Create a new file.

Parameters:
  • size - the size of file in MiB
Returns: bdev.FileStorage
an instance of FileStorage
Overrides: BlockDev.Create