The nova.block_device Module

class BlockDeviceDict(bdm_dict=None, do_not_default=None, **kwargs)

Bases: dict

Represents a Block Device Mapping in Nova.

classmethod from_api(api_dict, image_uuid_specified)

Transform the API format of data to the internally used one.

Only validate if the source_type field makes sense.

classmethod from_legacy(legacy_bdm)
get_image_mapping()
legacy()
create_blank_bdm(size, guest_format=None)
create_image_bdm(image_ref, boot_index=0)

Create a block device dict based on the image_ref.

This is useful in the API layer to keep the compatibility with having an image_ref as a field in the instance requests

ephemeral_num(ephemeral_name)
from_legacy_mapping(legacy_block_device_mapping, image_uuid='', root_device_name=None, no_root=False)

Transform a legacy list of block devices to the new data format.

get_bdm_ephemeral_disk_size(block_device_mappings)
get_bdm_local_disk_num(block_device_mappings)
get_bdm_swap_list(block_device_mappings)
get_bdms_to_connect(bdms, exclude_root_mapping=False)

Will return non-root mappings, when exclude_root_mapping is true. Otherwise all mappings will be returned.

get_device_letter(device_name)
get_root_bdm(bdms)
instance_block_mapping(instance, bdms)
is_ephemeral(device_name)
is_safe_for_update(block_device_dict)

Determine if passed dict is a safe subset for update.

Safe subset in this case means a safe subset of both legacy and new versions of data, that can be passed to an UPDATE query without any transformation.

is_swap_or_ephemeral(device_name)
legacy_mapping(block_device_mapping)

Transform a list of block devices of an instance back to the legacy data format.

mappings_prepend_dev(mappings)

Prepend ‘/dev/’ to ‘device’ entry of swap/ephemeral virtual type.

match_device(device)

Matches device name and returns prefix, suffix.

new_format_is_ephemeral(bdm)
new_format_is_swap(bdm)
prepend_dev(device_name)

Make sure there is a leading ‘/dev/’.

properties_root_device_name(properties)

get root device name from image meta data. If it isn’t specified, return None.

snapshot_from_bdm(snapshot_id, template)

Create a basic volume snapshot BDM from a given template bdm.

strip_dev(device_name)

remove leading ‘/dev/’.

strip_prefix(device_name)

remove both leading /dev/ and xvd or sd or vd or hd.

validate_and_default_volume_size(bdm)
validate_device_name(value)
volume_in_mapping(mount_device, block_device_info)

Previous topic

The nova.baserpc Module

Next topic

The nova.cache_utils Module

Project Source

This Page