SoftLayer.block

Block Storage Manager

license:MIT, see LICENSE for more details.
class SoftLayer.managers.block.BlockStorageManager(client)[source]

Manages SoftLayer Block Storage volumes.

See product information here: http://www.softlayer.com/block-storage

Parameters:client (SoftLayer.API.BaseClient) – the client instance
authorize_host_to_volume(volume_id, hardware_ids=None, virtual_guest_ids=None, ip_address_ids=None, **kwargs)[source]

Authorizes hosts to Block Storage Volumes

Parameters:
  • volume_id – The Block volume to authorize hosts to
  • hardware_ids – A List of SoftLayer_Hardware ids
  • virtual_guest_ids – A List of SoftLayer_Virtual_Guest ids
  • ip_address_ids – A List of SoftLayer_Network_Subnet_IpAddress ids
Returns:

Returns an array of SoftLayer_Network_Storage_Allowed_Host objects which now have access to the given Block volume

cancel_block_volume(volume_id, reason='No longer needed', immediate=False)[source]

Cancels the given block storage volume.

Parameters:
  • volume_id (integer) – The volume ID
  • reason (string) – The reason for cancellation
  • immediate_flag (boolean) – Cancel immediately or on anniversary date
cancel_snapshot_space(volume_id, reason='No longer needed', immediate=False)[source]

Cancels snapshot space for a given volume.

Parameters:
  • volume_id (integer) – The volume ID
  • reason (string) – The reason for cancellation
  • immediate_flag (boolean) – Cancel immediately or on anniversary date
create_or_update_lun_id(volume_id, lun_id)[source]

Set the LUN ID on a volume.

Parameters:
  • volume_id (integer) – The id of the volume
  • lun_id (integer) – LUN ID to set on the volume
Returns:

a SoftLayer_Network_Storage_Property object

create_snapshot(volume_id, notes='', **kwargs)[source]

Creates a snapshot on the given block volume.

Parameters:
  • volume_id (integer) – The id of the volume
  • notes (string) – The notes or “name” to assign the snapshot
Returns:

Returns the id of the new snapshot

deauthorize_host_to_volume(volume_id, hardware_ids=None, virtual_guest_ids=None, ip_address_ids=None, **kwargs)[source]

Revokes authorization of hosts to Block Storage Volumes

Parameters:
  • volume_id – The Block volume to deauthorize hosts to
  • hardware_ids – A List of SoftLayer_Hardware ids
  • virtual_guest_ids – A List of SoftLayer_Virtual_Guest ids
  • ip_address_ids – A List of SoftLayer_Network_Subnet_IpAddress ids
Returns:

Returns an array of SoftLayer_Network_Storage_Allowed_Host objects which have access to the given Block volume

delete_snapshot(snapshot_id)[source]

Deletes the specified snapshot object.

Parameters:snapshot_id – The ID of the snapshot object to delete.
disable_snapshots(volume_id, schedule_type)[source]

Disables snapshots for a specific block volume at a given schedule

Parameters:
  • volume_id (integer) – The id of the volume
  • schedule_type (string) – ‘HOURLY’|’DAILY’|’WEEKLY’
Returns:

Returns whether successfully disabled or not

enable_snapshots(volume_id, schedule_type, retention_count, minute, hour, day_of_week, **kwargs)[source]

Enables snapshots for a specific block volume at a given schedule

Parameters:
  • volume_id (integer) – The id of the volume
  • schedule_type (string) – ‘HOURLY’|’DAILY’|’WEEKLY’
  • retention_count (integer) – Number of snapshots to be kept
  • minute (integer) – Minute when to take snapshot
  • hour (integer) – Hour when to take snapshot
  • day_of_week (string) – Day when to take snapshot
Returns:

Returns whether successfully scheduled or not

failback_from_replicant(volume_id, replicant_id)[source]

Failback from a volume replicant.

Parameters:
  • volume_id (integer) – The id of the volume
  • replicant_id (integer) – ID of replicant to failback from
Returns:

Returns whether failback was successful or not

failover_to_replicant(volume_id, replicant_id, immediate=False)[source]

Failover to a volume replicant.

Parameters:
  • volume_id (integer) – The id of the volume
  • replicant_id (integer) – ID of replicant to failover to
  • immediate (boolean) – Flag indicating if failover is immediate
Returns:

Returns whether failover was successful or not

get_block_volume_access_list(volume_id, **kwargs)[source]

Returns a list of authorized hosts for a specified volume.

Parameters:
  • volume_id – ID of volume.
  • kwargs
Returns:

Returns a list of authorized hosts for a specified volume.

get_block_volume_details(volume_id, **kwargs)[source]

Returns details about the specified volume.

Parameters:
  • volume_id – ID of volume.
  • kwargs
Returns:

Returns details about the specified volume.

get_block_volume_snapshot_list(volume_id, **kwargs)[source]

Returns a list of snapshots for the specified volume.

Parameters:
  • volume_id – ID of volume.
  • kwargs
Returns:

Returns a list of snapshots for the specified volume.

get_replication_locations(volume_id)[source]

Acquires list of the datacenters to which a volume can be replicated.

Parameters:volume_id – The ID of the primary volume to be replicated
Returns:Returns an array of SoftLayer_Network_Storage objects
get_replication_partners(volume_id)[source]

Acquires list of replicant volumes pertaining to the given volume.

Parameters:volume_id – The ID of the primary volume to be replicated
Returns:Returns an array of SoftLayer_Location objects
list_block_volumes(datacenter=None, username=None, storage_type=None, **kwargs)[source]

Returns a list of block volumes.

Parameters:
  • datacenter – Datacenter short name (e.g.: dal09)
  • username – Name of volume.
  • storage_type – Type of volume: Endurance or Performance
  • kwargs
Returns:

Returns a list of block volumes.

list_volume_schedules(volume_id)[source]

Lists schedules for a given volume

Parameters:volume_id (integer) – The id of the volume
Returns:Returns list of schedules assigned to a given volume
order_block_volume(storage_type, location, size, os_type, iops=None, tier_level=None, snapshot_size=None, service_offering='storage_as_a_service', hourly_billing_flag=False)[source]

Places an order for a block volume.

Parameters:
  • storage_type – ‘performance’ or ‘endurance’
  • location – Datacenter in which to order iSCSI volume
  • size – Size of the desired volume, in GB
  • os_type – OS Type to use for volume alignment, see help for list
  • iops – Number of IOPs for a “Performance” order
  • tier_level – Tier level to use for an “Endurance” order
  • snapshot_size – The size of optional snapshot space, if snapshot space should also be ordered (None if not ordered)
  • service_offering – Requested offering package to use in the order (‘storage_as_a_service’, ‘enterprise’, or ‘performance’)
  • hourly_billing_flag – Billing type, monthly (False) or hourly (True), default to monthly.
order_duplicate_volume(origin_volume_id, origin_snapshot_id=None, duplicate_size=None, duplicate_iops=None, duplicate_tier_level=None, duplicate_snapshot_size=None, hourly_billing_flag=False)[source]

Places an order for a duplicate block volume.

Parameters:
  • origin_volume_id – The ID of the origin volume to be duplicated
  • origin_snapshot_id – Origin snapshot ID to use for duplication
  • duplicate_size – Size/capacity for the duplicate volume
  • duplicate_iops – The IOPS per GB for the duplicate volume
  • duplicate_tier_level – Tier level for the duplicate volume
  • duplicate_snapshot_size – Snapshot space size for the duplicate
  • hourly_billing_flag – Billing type, monthly (False) or hourly (True), default to monthly.
Returns:

Returns a SoftLayer_Container_Product_Order_Receipt

order_modified_volume(volume_id, new_size=None, new_iops=None, new_tier_level=None)[source]

Places an order for modifying an existing block volume.

Parameters:
  • volume_id – The ID of the volume to be modified
  • new_size – The new size/capacity for the volume
  • new_iops – The new IOPS for the volume
  • new_tier_level – The new tier level for the volume
Returns:

Returns a SoftLayer_Container_Product_Order_Receipt

order_replicant_volume(volume_id, snapshot_schedule, location, tier=None, os_type=None)[source]

Places an order for a replicant block volume.

Parameters:
  • volume_id – The ID of the primary volume to be replicated
  • snapshot_schedule – The primary volume’s snapshot schedule to use for replication
  • location – The location for the ordered replicant volume
  • tier – The tier (IOPS per GB) of the primary volume
  • os_type – The OS type of the primary volume
Returns:

Returns a SoftLayer_Container_Product_Order_Receipt

order_snapshot_space(volume_id, capacity, tier, upgrade, **kwargs)[source]

Orders snapshot space for the given block volume.

Parameters:
  • volume_id (integer) – The id of the volume
  • capacity (integer) – The capacity to order, in GB
  • tier (float) – The tier level of the block volume, in IOPS per GB
  • upgrade (boolean) – Flag to indicate if this order is an upgrade
Returns:

Returns a SoftLayer_Container_Product_Order_Receipt

resolve_ids(identifier)

Takes a string and tries to resolve to a list of matching ids.

What exactly ‘identifier’ can be depends on the resolvers

Parameters:identifier (string) – identifying string
Returns list:
restore_from_snapshot(volume_id, snapshot_id)[source]

Restores a specific volume from a snapshot

Parameters:
  • volume_id (integer) – The id of the volume
  • snapshot_id (integer) – The id of the restore point
Returns:

Returns whether succesfully restored or not

set_credential_password(access_id, password)[source]

Sets the password for an access host

Parameters:
  • access_id (integer) – id of the access host
  • password (string) – password to set