Package ganeti :: Package utils :: Module storage
[hide private]
[frames] | no frames]

Module storage

source code

Utility functions for storage.

Functions [hide private]
 
GetDiskTemplatesOfStorageType(storage_type)
Given the storage type, returns a list of disk templates based on that storage type.
source code
 
GetLvmDiskTemplates()
Returns all disk templates that use LVM.
source code
 
IsDiskTemplateEnabled(disk_template, enabled_disk_templates)
Checks if a particular disk template is enabled.
source code
 
IsFileStorageEnabled(enabled_disk_templates)
Checks if file storage is enabled.
source code
 
IsSharedFileStorageEnabled(enabled_disk_templates)
Checks if shared file storage is enabled.
source code
 
IsLvmEnabled(enabled_disk_templates)
Check whether or not any lvm-based disk templates are enabled.
source code
 
LvmGetsEnabled(enabled_disk_templates, new_enabled_disk_templates)
Checks whether lvm was not enabled before, but will be enabled after the operation.
source code
string
_GetDefaultStorageUnitForDiskTemplate(cfg, disk_template)
Retrieves the identifier of the default storage entity for the given storage type.
source code
(string, string)
_GetDefaultStorageUnitForSpindles(cfg)
Creates a 'spindle' storage unit, by retrieving the volume group name and associating it to the lvm-pv storage type.
source code
list of tuples (string, string)
GetStorageUnitsOfCluster(cfg, include_spindles=False)
Examines the cluster's configuration and returns a list of storage units and their storage keys, ordered by the order in which they are enabled.
source code
tuple
LookupSpaceInfoByStorageType(storage_space_info, storage_type)
Looks up the storage space info for a given storage type.
source code

Imports: logging, constants


Function Details [hide private]

_GetDefaultStorageUnitForDiskTemplate(cfg, disk_template)

source code 

Retrieves the identifier of the default storage entity for the given storage type.

Parameters:
  • cfg (objects.ConfigData) - the configuration data
  • disk_template (string) - a disk template, for example 'drbd'
Returns: string
identifier for a storage unit, for example the vg_name for lvm storage

_GetDefaultStorageUnitForSpindles(cfg)

source code 

Creates a 'spindle' storage unit, by retrieving the volume group name and associating it to the lvm-pv storage type.

Returns: (string, string)
tuple (storage_type, storage_key), where storage type is 'lvm-pv' and storage_key the name of the default volume group

GetStorageUnitsOfCluster(cfg, include_spindles=False)

source code 

Examines the cluster's configuration and returns a list of storage units and their storage keys, ordered by the order in which they are enabled.

Parameters:
  • cfg (config.ConfigWriter) - Cluster configuration
  • include_spindles (boolean) - flag to include an extra storage unit for physical volumes
Returns: list of tuples (string, string)
list of storage units, each storage unit being a tuple of (storage_type, storage_key); storage_type is in constants.STORAGE_TYPES and the storage_key a string to identify an entity of that storage type, for example a volume group name for LVM storage or a file for file storage.

LookupSpaceInfoByStorageType(storage_space_info, storage_type)

source code 

Looks up the storage space info for a given storage type.

Note that this lookup can be ambiguous if storage space reporting for several units of the same storage type was requested. This function is only supposed to be used for legacy code in situations where it actually is unambiguous.

Parameters:
  • storage_space_info (list of dicts) - result of GetNodeInfo
  • storage_type (string) - a storage type, which is included in the storage_units list
Returns: tuple
returns the element of storage_space_info that matches the given storage type