class documentation

class FileDeviceHelper(object):

View In Hierarchy

Undocumented

Class Method CreateFile Create a new file and its file device helper.
Method __init__ Create a new file device helper.
Method Exists Check for the existence of the given file.
Method Grow Grow the file
Method Move Move file to a location inside the file storage dir.
Method Remove Remove the file backing the block device.
Method Size Return the actual disk size in bytes.
Instance Variable file_path_acceptance_fn Undocumented
Instance Variable path Undocumented
@classmethod
def CreateFile(cls, path, size, create_folders=False, _file_path_acceptance_fn=None):

Create a new file and its file device helper.

Parameters
pathUndocumented
sizethe size in MiBs the file should be truncated to.
create_folderscreate the directories for the path if necessary (using ganeti.utils.io.Makedirs)
_file_path_acceptance_fnUndocumented
Returns
FileDeviceHelperThe FileDeviceHelper object representing the object.
Raises
errors.FileStoragePathErrorif the file path is disallowed by policy
def __init__(self, path, _file_path_acceptance_fn=None):

Create a new file device helper.

Raises
errors.FileStoragePathErrorif the file path is disallowed by policy
def Exists(self, assert_exists=None):

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
booleanTrue if the file exists
def Grow(self, amount, dryrun, backingstore, _excl_stor):

Grow the file

Parameters
amountthe amount (in mebibytes) to grow by.
dryrunUndocumented
backingstoreUndocumented
_excl_storUndocumented
def Move(self, new_path):

Move file to a location inside the file storage dir.

def Remove(self):

Remove the file backing the block device.

Returns
booleanTrue if the removal was successful
def Size(self):

Return the actual disk size in bytes.

Returns
intThe file size in bytes.
file_path_acceptance_fn =

Undocumented

path =

Undocumented