The cinder.volume.utils Module

Volume-related Utilities and helpers.

append_host(host, pool)

Encode pool into host info.

check_for_odirect_support(src, dest, flag='oflag=direct')
clear_volume(volume_size, volume_path, volume_clear=None, volume_clear_size=None, volume_clear_ionice=None)

Unprovision old volumes to prevent data leaking between users.

copy_volume(srcstr, deststr, size_in_m, blocksize, sync=False, execute=<function execute at 0x7f324a24ec08>, ionice=None)
extract_host(host, level='backend', default_pool_name=False)

Extract Host, Backend or Pool information from host string.

Parameters:
  • host – String for host, which could include host@backend#pool info
  • level – Indicate which level of information should be extracted from host string. Level can be ‘host’, ‘backend’ or ‘pool’, default value is ‘backend’
  • default_pool_name – this flag specify what to do if level == ‘pool’ and there is no ‘pool’ info encoded in host string. default_pool_name=True will return DEFAULT_POOL_NAME, otherwise we return None. Default value of this parameter is False.
Returns:

expected level of information

For example:

host = 'HostA@BackendB#PoolC‘ ret = extract_host(host, ‘host’) # ret is ‘HostA’ ret = extract_host(host, ‘backend’) # ret is 'HostA@BackendB‘ ret = extract_host(host, ‘pool’) # ret is ‘PoolC’

host = 'HostX@BackendY‘ ret = extract_host(host, ‘pool’) # ret is None ret = extract_host(host, ‘pool’, True) # ret is ‘_pool0’

generate_password(length=16, symbolgroups=('23456789', 'ABCDEFGHJKLMNPQRSTUVWXYZ', 'abcdefghijkmnopqrstuvwxyz'))

Generate a random password from the supplied symbol groups.

At least one symbol from each group will be included. Unpredictable results if length is less than the number of symbol groups.

Believed to be reasonably secure (with a reasonable password length!)

generate_username(length=20, symbolgroups=('23456789', 'ABCDEFGHJKLMNPQRSTUVWXYZ', 'abcdefghijkmnopqrstuvwxyz'))
get_all_physical_volumes(vg_name=None)
get_all_volume_groups(vg_name=None)
get_all_volumes(vg_name=None)
notify_about_cgsnapshot_usage(context, cgsnapshot, event_suffix, extra_usage_info=None, host=None)
notify_about_consistencygroup_usage(context, group, event_suffix, extra_usage_info=None, host=None)
notify_about_replication_error(context, volume, suffix, extra_error_info=None, host=None)
notify_about_replication_usage(context, volume, suffix, extra_usage_info=None, host=None)
notify_about_snapshot_usage(context, snapshot, event_suffix, extra_usage_info=None, host=None)
notify_about_volume_usage(context, volume, event_suffix, extra_usage_info=None, host=None)
null_safe_str(s)
setup_blkio_cgroup(srcpath, dstpath, bps_limit, execute=<function execute at 0x7f324a24ec08>)
supports_thin_provisioning()

Previous topic

The cinder.volume.rpcapi Module

Next topic

The cinder.volume.volume_types Module

This Page