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

Module storage

source code

Utility functions for storage.

Functions [hide private]
 
GetDiskTemplatesOfStorageTypes(*storage_types)
Given the storage type, returns a list of disk templates based on that storage type.
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
 
DiskTemplateSupportsSpaceReporting(disk_template)
Check whether the disk template supports storage space reporting.
source code
list of tuples (string, string)
GetStorageUnits(cfg, disk_templates)
Get the cluster's storage units for the given disk templates.
source code
tuple
LookupSpaceInfoByDiskTemplate(storage_space_info, disk_template)
Looks up the storage space info for a given disk template.
source code
tuple
LookupSpaceInfoByStorageType(storage_space_info, storage_type)
Looks up the storage space info for a given storage type.
source code
 
osminor(dev)
Return the device minor number from a raw device number.
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

GetStorageUnits(cfg, disk_templates)

source code 

Get the cluster's storage units for the given disk templates.

If any lvm-based disk template is requested, spindle information is added to the request.

Parameters:
  • cfg (config.ConfigWriter) - Cluster configuration
  • disk_templates (list of string) - list of disk templates for which the storage units will be computed
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.

LookupSpaceInfoByDiskTemplate(storage_space_info, disk_template)

source code 

Looks up the storage space info for a given disk template.

Parameters:
  • storage_space_info (list of dicts) - result of GetNodeInfo
  • disk_template (string) - disk template to get storage space info
Returns: tuple
returns the element of storage_space_info that matches the given disk template

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

osminor(dev)

source code 

Return the device minor number from a raw device number.

This is a replacement for os.minor working around the issue that Python's os.minor still has the old definition. See Ganeti issue 1058 for more details.