The nova.api.ec2.ec2utils
Module¶
-
camelcase_to_underscore
(str)¶
-
dict_from_dotted_str
(items)¶ parse multi dot-separated argument into dict. EBS boot uses multi dot-separated arguments like BlockDeviceMapping.1.DeviceName=snap-id Convert the above into {‘block_device_mapping’: {‘1’: {‘device_name’: snap-id}}}
-
ec2_id_to_glance_id
(context, ec2_id)¶
-
ec2_id_to_id
(ec2_id)¶ Convert an ec2 ID (i-[base 16 number]) to an instance id (int).
-
ec2_inst_id_to_uuid
(context, ec2_id)¶ “Convert an instance id to uuid.
-
ec2_snap_id_to_uuid
(ec2_id)¶ Get the corresponding UUID for the given ec2-id.
-
ec2_vol_id_to_uuid
(ec2_id)¶ Get the corresponding UUID for the given ec2-id.
-
get_instance_uuid_from_int_id
(context, reqid)¶
-
get_int_id_from_instance_uuid
(context, reqid)¶
-
get_int_id_from_snapshot_uuid
(context, reqid)¶
-
get_int_id_from_volume_uuid
(context, reqid)¶
-
get_ip_info_for_instance
(context, instance)¶ Return a dictionary of IP information for an instance.
-
get_ip_info_for_instance_from_nw_info
(nw_info)¶
-
get_snapshot_uuid_from_int_id
(context, reqid)¶
-
get_volume_uuid_from_int_id
(context, reqid)¶
-
glance_id_to_ec2_id
(context, glance_id, image_type='ami')¶
-
glance_id_to_id
(context, reqid)¶ Convert a glance id to an internal (db) id.
-
id_to_ec2_id
(instance_id, template='i-%08x')¶ Convert an instance ID (int) to an ec2 ID (i-[base 16 number]).
-
id_to_ec2_inst_id
(instance_id)¶ Get or create an ec2 instance ID (i-[base 16 number]) from uuid.
-
id_to_ec2_snap_id
(snapshot_id)¶ Get or create an ec2 volume ID (vol-[base 16 number]) from uuid.
-
id_to_ec2_vol_id
(volume_id)¶ Get or create an ec2 volume ID (vol-[base 16 number]) from uuid.
-
id_to_glance_id
(context, reqid)¶ Convert an internal (db) id to a glance id.
-
image_ec2_id
(image_id, image_type='ami')¶ Returns image ec2_id using id and three letter type.
-
image_type
(image_type)¶ Converts to a three letter image type.
aki, kernel => aki ari, ramdisk => ari anything else => ami
-
is_ec2_timestamp_expired
(request, expires=None)¶ Checks the timestamp or expiry time included in an EC2 request and returns true if the request is expired
-
memoize
(func)¶
-
regex_from_ec2_regex
(ec2_re)¶ Converts an EC2-style regex to a python regex. Approach is based on python fnmatch.
-
reset_cache
()¶
-
resource_type_from_id
(context, resource_id)¶ Get resource type by ID
Returns a string representation of the Amazon resource type, if known. Returns None on failure.
Parameters: - context – context under which the method is called
- resource_id – resource_id to evaluate
-
search_opts_from_filters
(filters)¶
-
status_to_ec2_attach_status
(volume)¶ Get the corresponding EC2 attachment state.
According to EC2 API, the valid attachment status in response is: attaching | attached | detaching | detached