Package ganeti :: Package storage :: Module filestorage :: Class FileDeviceHelper
[hide private]
[frames] | no frames]

Class FileDeviceHelper

source code


Instance Methods [hide private]
 
__init__(self, path, _file_path_acceptance_fn=None)
Create a new file device helper.
source code
boolean
Exists(self, assert_exists=None)
Check for the existence of the given file.
source code
boolean
Remove(self)
Remove the file backing the block device.
source code
int
Size(self)
Return the actual disk size in bytes.
source code
 
Grow(self, amount, dryrun, backingstore, _excl_stor)
Grow the file
source code

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

Class Methods [hide private]
FileDeviceHelper
CreateFile(cls, path, size, create_folders=False, _file_path_acceptance_fn=None)
Create a new file and its file device helper.
source code
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

CreateFile(cls, path, size, create_folders=False, _file_path_acceptance_fn=None)
Class Method

source code 

Create a new file and its file device helper.

Parameters:
  • size - the size in MiBs the file should be truncated to.
  • create_folders - create the directories for the path if necessary (using ganeti.utils.io.Makedirs)
Returns: FileDeviceHelper
The FileDeviceHelper object representing the object.
Raises:

__init__(self, path, _file_path_acceptance_fn=None)
(Constructor)

source code 

Create a new file device helper.

Raises:
Overrides: object.__init__

Exists(self, assert_exists=None)

source code 

Check for the existence of the given file.

Parameters:
  • assert_exists - creates an assertion on the result value:
    • if true, raise errors.BlockDeviceError if the file doesn't exist
    • if false, raise errors.BlockDeviceError if the file does exist
Returns: boolean
True if the file exists

Remove(self)

source code 

Remove the file backing the block device.

Returns: boolean
True if the removal was successful

Size(self)

source code 

Return the actual disk size in bytes.

Returns: int
The file size in bytes.

Grow(self, amount, dryrun, backingstore, _excl_stor)

source code 

Grow the file

Parameters:
  • amount - the amount (in mebibytes) to grow by.