block_store methods

class ecl.block_store.v2._proxy.Proxy(session)[source]

Bases: ecl.proxy.BaseProxy

availability_zones()[source]

Return a list of availability zones

Returns:A list of availability zone
Return type:AvailabilityZone
create_metadata(volume_id, **metadata)[source]
create_volume(size, name=None, description=None, availability_zone=None, imageRef=None, metadata=None, snapshot_id=None, volume_type=None, source_volid=None)[source]

Create a new volume from attributes

Parameters:
  • size (int) – size of volume to create
  • name (string) – name of volume to create
  • description (string) – description of volume to create
  • availability_zone (string) – availability zone of volume to create
  • imageRef (string) – image ID of volume to create from
  • metadata (dict) – metadata of volume to create
  • snapshot_id (string) – snapshot ID of volume to create
  • volume_type (string) – type of volume to create
  • source_volid (string) – source volume id of volume to create from
Returns:

The results of volume creation

Return type:

Volume

delete_volume(volume, ignore_missing=True)[source]

Delete a volume

Parameters:
  • volume – The value can be either the ID of a volume or a Volume instance.
  • ignore_missing (bool) – When set to False ResourceNotFound will be raised when the volume does not exist. When set to True, no exception will be set when attempting to delete a nonexistent volume.
Returns:

None

extend_volume(volume, new_size)[source]

Extend size of a volume

Parameters:
  • volume – The value can be the ID of a volume or a Volume instance.
  • new_size (string) – size of volume to extend
Returns:

The results of volume extend size

Return type:

Volume

extensions()[source]

Return a list of Extensions

Returns:A list of Extension objects
Return type:Extension
find_availability_zone(name_or_id, ignore_missing=True)[source]

Find a single availability_zone

Parameters:
  • name_or_id – The name or ID of a availability_zone.
  • ignore_missing (bool) – When set to False ResourceNotFound will be raised when the resource does not exist. When set to True, None will be returned when attempting to find a nonexistent resource.
Returns:

One AvailabilityZone or None

find_volume(name_or_id, ignore_missing=True)[source]

Find a single volume

Parameters:
  • name_or_id – The name or ID of a server.
  • ignore_missing (bool) – When set to False ResourceNotFound will be raised when the resource does not exist. When set to True, None will be returned when attempting to find a nonexistent resource.
Returns:

One Volume or None

find_volume_type(name_or_id, ignore_missing=True)[source]

Find a volume type

Parameters:
  • name_or_id – The name or ID of a volume type.
  • ignore_missing (bool) – When set to False ResourceNotFound will be raised when the resource does not exist. When set to True, None will be returned when attempting to find a nonexistent resource.
Returns:

One Type or None

get_default_quota(tenant_id)[source]

Get default quota of a tenant

Parameters:
  • tenant_id – The ID for the tenant for which you want to show quotas. This ID is different from the tenant ID of authentication. That ID is for the admin tenant.
  • user_id – The user ID. Specify in the URI as a query string
Returns:

One DefaultQuota

Raises:

ResourceNotFound when no resource can be found.

get_quota(tenant_id)[source]

Get quota info of a tenant

Parameters:tenant_id – The ID for the tenant for which you want to show quotas. This ID is different from the tenant ID of authentication. That ID is for the admin tenant.
Returns:One Quota
Raises:ResourceNotFound when no resource can be found.
get_quota_detail(tenant_id, user_id)[source]

Get quota info of a tenant

Parameters:
  • tenant_id – The ID for the tenant for which you want to show quotas. This ID is different from the tenant ID of authentication. That ID is for the admin tenant.
  • user_id – The user ID. Specify in the URI as a query string
Returns:

One DetailQuota

Raises:

ResourceNotFound when no resource can be found.

get_volume(volume)[source]

Get a single volume

Parameters:volume – The value can be the ID of a volume or a Volume instance.
Returns:One Volume
Raises:ResourceNotFound when no resource can be found.
limits()[source]

Return a list of Limit

Returns:show Limit objects
Return type:Limit
types()[source]

Return a list of types

Returns:A list of Type objects
Return type:Type
update_bootable(volume, bootable=False)[source]
Parameters:
  • volume – The value can be the ID of a volume or a Volume instance.
  • bootable (boolean) – bootable status to update
Returns:

None

update_metadata(volume_id, **metadata)[source]
update_volume(volume, **body)[source]

Create a new volume from attributes

Parameters:
  • volume – The value can be the ID of a volume or a Volume instance.
  • name (string) – name of volume to update
  • description (string) – description of volume to update
Returns:

The results of volume update

Return type:

Volume

upload_to_image(volume, container_format=None, disk_format=None, image_name=None, force=False)[source]
Parameters:
  • volume – The value can be the ID of a volume or a Volume instance.
  • container_format (string) – Select one of the following (bare, ovf, ami, aki, ari)
  • disk_format (string) – Select one of the following (raw, vmdk, vdi, qcow2)
  • image_name (string) – Name of image to upload
  • force (boolean) – Whether to upload a volume of attached state. When the state of volume is available, the value of force option does not affect the operation.
Returns:

Object describes detail of volume_upload_image

volumes()[source]

Return a list of volume

Returns:A list of Volume objects
Return type:Volume

availability_zone

class ecl.block_store.v2.availability_zone.AvailabilityZone(attrs=None, loaded=False)[source]

Bases: ecl.resource.Resource

allow_list = True
base_path = '/os-availability-zone'
hosts = None

hosts of availability zone

id_attribute = 'name'
name = None

name of availability zone

resources_key = 'availabilityZoneInfo'
service = {'region_name': None, 'service_name': None, 'interface': 'public', 'version': None, 'service_type': 'volumev2', 'requires_project_id': True, 'api_version': None}
state = None

state of availability zone

extension

class ecl.block_store.v2.extension.Extension(attrs=None, loaded=False)[source]

Bases: ecl.resource.Resource

alias = None

Alias of the extension.

allow_list = True
base_path = '/extensions'
description = None

Description of the extension.

A list of links.

name = None

Name of the extension.

namespace = None

Namespace of the extension.

resource_key = 'extension'
resources_key = 'extensions'
service = {'region_name': None, 'service_name': None, 'interface': 'public', 'version': None, 'service_type': 'volumev2', 'requires_project_id': True, 'api_version': None}
updated = None

A updated representing this Extension.

limit

class ecl.block_store.v2.limit.Limit(attrs=None, loaded=False)[source]

Bases: ecl.resource.Resource

absolute = None

A list of absolute props of the Limit.

allow_retrieve = True
base_path = '/limits'
rate = None

A rate representing this Limit.

resource_key = 'limits'
resources_key = 'limits'
service = {'region_name': None, 'service_name': None, 'interface': 'public', 'version': None, 'service_type': 'volumev2', 'requires_project_id': True, 'api_version': None}

metadata

class ecl.block_store.v2.metadata.Metadata(attrs=None, loaded=False)[source]

Bases: ecl.resource.Resource

allow_create = True
allow_list = True
allow_update = True
base_path = '/volumes/%(volume_id)s/metadata'
resource_key = 'metadata'
resources_key = 'metadata'
service = {'region_name': None, 'service_name': None, 'interface': 'public', 'version': None, 'service_type': 'volumev2', 'requires_project_id': True, 'api_version': None}

quota

class ecl.block_store.v2.quota.DefaultQuota(attrs=None, loaded=False)[source]

Bases: ecl.resource.Resource

allow_retrieve = True
base_path = '/os-quota-sets/%(tenant_id)s/defaults'
id = None
resource_key = 'quota_set'
resources_key = 'quota_sets'
service = {'region_name': None, 'service_name': None, 'interface': 'public', 'version': None, 'service_type': 'volumev2', 'requires_project_id': True, 'api_version': None}
class ecl.block_store.v2.quota.DetailQuota(attrs=None, loaded=False)[source]

Bases: ecl.resource.Resource

allow_retrieve = True
base_path = '/os-quota-sets/%(tenant_id)s/detail'
id = None
resource_key = 'quota_set'
resources_key = 'quota_sets'
service = {'region_name': None, 'service_name': None, 'interface': 'public', 'version': None, 'service_type': 'volumev2', 'requires_project_id': True, 'api_version': None}
class ecl.block_store.v2.quota.Quota(attrs=None, loaded=False)[source]

Bases: ecl.resource.Resource

allow_retrieve = True
base_path = '/os-quota-sets'
id = None
resource_key = 'quota_set'
resources_key = 'quota_sets'
service = {'region_name': None, 'service_name': None, 'interface': 'public', 'version': None, 'service_type': 'volumev2', 'requires_project_id': True, 'api_version': None}

type

class ecl.block_store.v2.type.Type(attrs=None, loaded=False)[source]

Bases: ecl.resource.Resource

allow_list = True
base_path = '/types'
extra_specs = None

A dict of extra specifications. “capabilities” is a usual key.

id = None

A ID representing this type.

name = None

Name of the type.

resource_key = 'volume_type'
resources_key = 'volume_types'
service = {'region_name': None, 'service_name': None, 'interface': 'public', 'version': None, 'service_type': 'volumev2', 'requires_project_id': True, 'api_version': None}

volume

class ecl.block_store.v2.volume.Volume(attrs=None, loaded=False)[source]

Bases: ecl.resource.Resource

allow_create = True
allow_delete = True
allow_list = True
allow_retrieve = True
allow_update = True
attachments = None

TODO(briancurtin): This is currently undocumented in the API.

availability_zone = None

The availability zone.

base_path = '/volumes'
created_at = None

The timestamp of this volume creation.

description = None

The volume description.

extend_size(session, new_size)[source]
id = None

A ID representing this volume.

image_id = None

The ID of the image from which you want to create the volume. Required to create a bootable volume.

is_bootable = None

Enables or disables the bootable attribute. You can boot an instance from a bootable volume. Type: bool

A list of links associated with this volume. Type: list

metadata = None

One or more metadata key and value pairs to associate with the volume.

name = None

The name of this volume.

resource_key = 'volume'
resources_key = 'volumes'
service = {'region_name': None, 'service_name': None, 'interface': 'public', 'version': None, 'service_type': 'volumev2', 'requires_project_id': True, 'api_version': None}
size = None

The size of the volume, in GBs. Type: int

snapshot_id = None

To create a volume from an existing snapshot, specify the ID of the existing volume snapshot. If specified, the volume is created in same availability zone and with same size of the snapshot.

source_volume_id = None

To create a volume from an existing volume, specify the ID of the existing volume. If specified, the volume is created with same size of the source volume.

status = None

One of the following values: creating, available, attaching, in-use deleting, error, error_deleting, backing-up, restoring-backup, error_restoring. For details on these statuses, see the Block Storage API documentation.

update_bootable(session, bootable=False)[source]
upload_to_image(session, container_format=None, disk_format=None, image_name=None, force=False)[source]
volume_type = None

The name of the associated volume type.

class ecl.block_store.v2.volume.VolumeDetail(attrs=None, loaded=False)[source]

Bases: ecl.block_store.v2.volume.Volume

base_path = '/volumes/detail'
consistency_group_id = None

ID of the consistency group.

extended_replication_status = None

Extended replication status on this volume.

host = None

The volume’s current back-end.

is_encrypted = None

True if this volume is encrypted, False if not. Type: bool

migration_id = None

The volume ID that this volume’s name on the back-end is based on.

migration_status = None

The status of this volume’s migration (None means that a migration is not currently in progress).

project_id = None

The project ID associated with current back-end.

replication_driver_data = None

Data set by the replication driver

replication_status = None

Status of replication on this volume.