SDRS API

The Storage Disaster Recovery Service Class

The SDRS high-level interface is available through the sdrs member of a Connection object. The sdrs member will only be added if the otcextensions.sdk.register_otc_extensions(conn) method is called.

Job Operations

class otcextensions.sdk.sdrs.v1._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
get_job(job)

Get single SDRS job by UUID.

Parameters:

job – The id or and instance of :class:’~otcextensions.sdk.sdrs.v1.job.Job’

Returns:

instance of :class: ‘~class:’otcextensions.sdk.sdrs.v1.job.Job’

Active-active domains Operations

class otcextensions.sdk.sdrs.v1._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
get_domains()

Retrieve a generator of Active-active domains

Returns:

A generator of active-active domains :class: ‘~otcextensions.sdk.sdrs.v1.active_domains.ActiveDomain’

Protection group Operations

class otcextensions.sdk.sdrs.v1._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
create_protection_group(**attrs)

Creating a SDRS protection group using attributes

Parameters:

attrs (dict) – Keyword arguments which will be used to create a ProtectionGroup, comprised of the properties on the ProtectionGroup class.

Returns:

The results of config creation

Return type:

ProtectionGroup

protection_groups(**query)

Retrieve a generator of Protection groups

Parameters:

query (dict) – Optional query parameters to be sent to limit the resources being returned. * ‘availability_zone’: Production site AZ * limit: Number of records displayed per page * marker: ID of the last record displayed * name: Protection group name * offset: Offset value * ‘query_type’: Query type of protection group * status: Status

Returns:

A generator of protection groups :class: ~otcextensions.sdk.sdrs.v1.protection_group.ProtectionGroup instances

get_protection_group(protection_group)

Get the protection group by UUID.

Parameters:

protection_group – key id or an instance of :class: ~otcextensions.sdk.sdrs.v1.protection_group.ProtectionGroup

Returns:

instance of :class: ~otcextensions.sdk.sdrs.v1.protection_group.ProtectionGroup

delete_protection_group(protection_group, ignore_missing=True)

Delete a single SDRS protection group.

Parameters:
  • protection_group – The value can be the ID of a protection_group or a :class: ~otcextensions.sdk.sdrs.v1.protection_group.ProtectionGroup instance.

  • ignore_missing (bool) – When set to False :class: ~otcextensions.sdk.sdrs.v1.protection_group.ProtectionGroup will be raised when the group does not exist. When set to True, no exception will be set when attempting to delete a nonexistent protection group.

find_protection_group(name_or_id, ignore_missing=True)

Find a single SDRS protection group by name or id

Parameters:
  • name_or_id – The name or ID of a protection group

  • ignore_missing (bool) – When set to False ResourceNotFound will be raised when the group does not exist. When set to True, no exception will be set when attempting to find a nonexistent protection group.

Returns:

a :class: ~otcextensions.sdk.sdrs.v1.protection_group.ProtectionGroup

update_protection_group(protection_group, name)

Update SDRS protection group name

Parameters:
  • protection_group – The value can be the ID of a protection group or a :class: ~otcextensions.sdk.sdrs.v1.protection_group.ProtectionGroup instance.

  • name (str) – name to be updated for protection group

Returns:

a :class: ~otcextensions.sdk.sdrs.v1.protection_group.ProtectionGroup

enable_protection(protection_group)

Enable protection for existing protection group

Parameters:

protection_group – The value can be the ID of a protection group or a :class: ~otcextensions.sdk.sdrs.v1.protection_group.ProtectionGroup instance.

Returns:

The result is the job id of an action

disable_protection(protection_group)

Disable protection for existing protection group

Parameters:

protection_group – The value can be the ID of a protection group or a :class: ~otcextensions.sdk.sdrs.v1.protection_group.ProtectionGroup instance.

Returns:

The result is the job id of an action

perform_failover(protection_group)

Perform failover for protection group

Parameters:

protection_group – The value can be the ID of a protection group or a :class: ~otcextensions.sdk.sdrs.v1.protection_group.ProtectionGroup instance.

Returns:

The result is the job id of an action

perform_planned_failover(protection_group, priority_station='target')

Perform failover for protection group

Parameters:
  • protection_group – The value can be the ID of a protection group or a :class: ~otcextensions.sdk.sdrs.v1.protection_group.ProtectionGroup instance.

  • priority_station – direction of planned failover Values: ‘target’ or ‘source’

Returns:

The result is the job id of an action

Protected instance Operations

class otcextensions.sdk.sdrs.v1._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
create_protected_instance(**attrs)

Creating a protected instance using attributes

Parameters:

attrs (dict) – Keyword arguments which will be used to create a ProtectedInstance, comprised of the properties on the Protected instance class.

Returns:

The results of config creation

Return type:

:class ~otcextensions.sdk.sdrs.v1.protected_instance. ProtectedInstance

delete_protected_instance(protected_instance, delete_target_server=False, delete_target_eip=False, ignore_missing=True)

Delete a single SDRS protected instance.

Parameters:
  • protected_instance – The value can be the ID of a protected instance or a :class: ~otcextensions.sdk.sdrs.v1.protected_instance.ProtectedInstance instance.

  • delete_target_server (bool) – Specifies whether target ECS should be deleted after protection group deletion

  • delete_target_eip (bool) – Specifies whether target EIP should be deleted after protection group deletion

  • ignore_missing (bool) – When set to False ResourceNotFound will be raised when the group does not exist. When set to True, no exception will be set when attempting to delete a nonexistent protected instance

Returns:

instance of :class: ~otcextensions.sdk.sdrs.v1.protected_instance.ProtectedInstance

protected_instances(**query)

Retrieve a generator of Protected instances

Parameters:

query (dict) – Optional query parameters to be sent to limit the resources being returned. * ‘availability_zone’: Production site AZ * limit: Number of records displayed per page * marker: ID of the last record displayed * name: Protection group name * offset: Offset value * ‘protected_instance_ids’: Protected instance ID list * ‘query_type’: Query type of protected instance * ‘server_group_id’: Protection group ID * ‘server_group_ids’: Protection groups ID list * status: Status

Returns:

A generator of protected instances :class: ~otcextensions.sdk.sdrs.v1.protected_instance.ProtectedInstance instances

get_protected_instance(instance_id)

Get the SDRS protected instance by UUID.

Parameters:

instance_id – key id or an instance of :class: ~otcextensions.sdk.sdrs.v1.protected_instance.ProtectedInstance

Returns:

instance of :class: ~otcextensions.sdk.sdrs.v1.protected_instance.ProtectedInstance

update_protected_instance(instance_id, name)

Update SDRS protected instance name

Parameters:
  • instance_id – The value can be the ID of a protected instance or a ProtectedInstance instance.

  • name (str) – name to be updated for protected instance

Returns:

ProtectedInstance`

find_protected_instance(name_or_id, ignore_missing=True)

Find a single SDRS protected instance by name or id

Parameters:
  • name_or_id – The name or ID of a protected instance

  • ignore_missing (bool) – When set to False ResourceNotFound will be raised when the instance does not exist. When set to True, no exception will be set when attempting to find a nonexistent protected instance.

Returns:

Protected instance

Return type:

ProtectedInstance

attach_replication_pair(protected_instance, replication, device='/dev/vdb')

Attach replication pair to protected instance

Parameters:
  • protected_instance – The value can be the ID of a protected instance or :class: ~otcextensions.sdk.sdrs.v1.protected_instance.ProtectedInstance

  • replication – The value can be the ID of a replication pair or :class: ~otcextensions.sdk.sdrs.v1.replication_pair.ReplicationPair

  • device – Disk device name of replication pair

detach_replication_pair(protected_instance, replication)

Detach replication pair from protected instance

Parameters:
  • protected_instance – The value can be the ID of a protected instance or a :class: ~otcextensions.sdk.sdrs.v1.protected_instance.ProtectedInstance

  • replication – The value can be the ID of a replication pair or :class: ~otcextensions.sdk.sdrs.v1.replication_pair.ReplicationPair

add_nic(protected_instance, subnet_id, security_groups=None, ip_address=None)

Add NIC to a protected instance

Parameters:
  • protected_instance – The value can be the ID of a protected instance or :class: ~otcextensions.sdk.sdrs.v1.protected_instance.ProtectedInstance

  • subnet_id (str) – Subnet ID of the NIC to be added

  • security_groups (list) – list of security groups to be added for NIC in format ‘id’: ‘value’

  • ip_address (str) – IP address of NIC

delete_nic(protected_instance, nic_id)

Delete NIC from a protected instance

Parameters:
  • protected_instance – The value can be the ID of a protected instance or a :class: ~otcextensions.sdk.sdrs.v1.protected_instance.ProtectedInstance

  • nic_id (str) – ID of a Network interface card to be deleted

modify_protected_instance(protected_instance, flavor=None, production_flavor=None, dr_flavor=None)

Modify server(s) flavor of protected instance

Parameters:
  • protected_instance – The value can be the ID of a protected instance or a :class: ~otcextensions.sdk.sdrs.v1.protected_instance.ProtectedInstance

  • flavor (str) – flavor ID for both production and DR sites

  • production_flavor (str) – flavor ID for production site If ‘flavor’ is specified this parameter doesn’t take effect

  • dr_flavor (str) – flavor ID for DR site If ‘flavor’ is specified this parameter doesn’t take effect

Replication pair Operations

class otcextensions.sdk.sdrs.v1._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
create_replication_pair(**attrs)

Create a replication pair using attributes

Parameters:

attrs (dict) – Keyword arguments which will be used to create a ReplicationPair, comprised of the properties on the Replication Pair class.

Returns:

The results of config creation

Return type:

ReplicationPair

delete_replication_pair(replication, server_group_id=None, delete_target_volume=False, ignore_missing=True)

Delete a single SDRS replication pair

Parameters:
  • replication – The value can be the ID of a replication pair or a :class: ~otcextensions.sdk.sdrs.v1.replication_pair.ReplicationPair instance.

  • server_group_id (bool) – Protection group ID of replication pair

  • delete_target_volume (bool) – Specifies whether DR site volume should be deleted after replication pair deletion

  • ignore_missing (bool) – When set to False ResourceNotFound will be raised when the group does not exist. When set to True, no exception will be set when attempting to delete a nonexistent protected instance

Returns:

instance of :class: ~otcextensions.sdk.sdrs.v1.replication_pair.ReplicationPair

replication_pairs(**query)

Retrieve a generator of Replication pairs

Parameters:

query (dict) – Optional query parameters to be sent to limit the resources being returned. * ‘availability_zone’: Production site AZ * limit: Number of records displayed per page * marker: ID of the last record displayed * name: Replication pair name * offset: Offset value * ‘protected_instance_id’: Protected instance ID * ‘protected_instance_ids’: Protected instances ID list * ‘query_type’: Query type of replication pair Values: status_abnormal, general * ‘server_group_id’: Protection group ID * ‘server_group_ids’: Protection groups ID list * status: Status

Returns:

A generator of replication pairs :class: ~otcextensions.sdk.sdrs.v1.replication_pair.ReplicationPair instances

get_replication_pair(replication)

Get the SDRS replication pair by UUID.

Parameters:

replication – key id or an instance of :class: ~otcextensions.sdk.sdrs.v1.replication_pair.ReplicationPair

Returns:

instance of :class: ~otcextensions.sdk.sdrs.v1.replication_pair.ReplicationPair

find_replication_pair(name_or_id, ignore_missing=True)

Find a single SDRS replication pair by name or id

Parameters:
  • name_or_id – The name or ID of a replication pair

  • ignore_missing (bool) – When set to False ResourceNotFound will be raised when the pair does not exist. When set to True, no exception will be set when attempting to find a nonexistent replication pair

Returns:

a :class: ~otcextensions.sdk.sdrs.v1.replication_pair.ReplicationPair

expand_replication_pair(replication, new_size)

Expand replication pair

Parameters:
  • replication – The value can be the ID of a replication pair or a :class: ~otcextensions.sdk.sdrs.v1.replication_pair.ReplicationPair

  • new_size (int) – Replication pair new size

update_replication_pair(replication, name)

Update SDRS replication pair name

Parameters:
  • replication – The value can be the ID of a replication pair or a ReplicationPair instance.

  • name (str) – name to be updated for replication pair

Returns:

Replication pair instance

Return type:

ReplicationPair

Disaster Recovery drill Operations

class otcextensions.sdk.sdrs.v1._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
create_dr_drill(**attrs)

Creating a disaster recovery drill using attributes

Parameters:

attrs (dict) – Keyword arguments which will be used to create a DRDrill, comprised of the properties on the DR drill class.

Returns:

The results of config creation

Return type:

DRDrill

delete_dr_drill(dr_drill, ignore_missing=True)

Delete a single SDRS DR drill

Parameters:
  • dr_drill – The value can be the ID of a dr_drill or a DRDrill instance.

  • ignore_missing (bool) – When set to False DRDrill will be raised when the dr_drill does not exist. When set to True, no exception will be set when attempting to delete a nonexistent DR drill

dr_drills(**query)

Retrieve a generator of DR drills

Parameters:

query (dict) – Optional query parameters to be sent to limit the resources being returned. * ‘drill_vpc_id’: VPC ID used for DR drill * limit: Number of records displayed per page * marker: ID of the last record displayed * name: DR drill name * offset: Offset value * ‘server_group_id’: Protection group ID * status: Status

Returns:

A generator of dr drills DRDrill instances

get_dr_drill(dr_drill)

Get the SDRS DR drill by UUID.

Parameters:

dr_drill – key id or an instance of DRDrill

Returns:

instance of DRDrill

find_dr_drill(name_or_id, ignore_missing=True)

Find a single SDRS DR drill by name or id

Parameters:
  • name_or_id – The name or ID of a DR drill

  • ignore_missing (bool) – When set to False ResourceNotFound will be raised when the pair does not exist. When set to True, no exception will be set when attempting to find a nonexistent DR drill

Returns:

a DRDrill

update_dr_drill(dr_drill, name)

Update SDRS DR drill name

Parameters:
  • dr_drill – The value can be the ID of a DR drill or a DRDrill instance.

  • name (str) – name to be updated for DR drill

Return type:

DRDrill

Task Center Operations

class otcextensions.sdk.sdrs.v1._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
failed_tasks(**query)

Retrieve a generator of Failed tasks

Parameters:

query (dict) – Optional query parameters to be sent to limit the resources being returned. * ‘failure_status’: query the task failure status * limit: Number of records displayed per page * marker: ID of the last record displayed * offset: Offset value * ‘resource_name’: protection group name * resource_type: type of the resource * server_group_id: protection group ID

Returns:

A generator of failed tasks FailedTask instances

delete_failed_task(failed_job_id, ignore_missing=True)

Delete a single Failed task

Parameters:
  • failed_job_id – The value can be the ID of a failed task or a FailedTask instance.

  • ignore_missing (bool) – When set to False FailedTask will be raised when the dr_drill does not exist. When set to True, no exception will be set when attempting to delete a nonexistent Failed task

delete_all_failed_tasks()

Delete all failed tasks of all protection groups

delete_protection_group_tasks(protection_group)

Delete all failed tasks of a single protection group

Parameters:

protection_group – The value can be the ID of a protection group or a :class: ~otcextensions.sdk.sdrs.v1.protection_group.ProtectionGroup instance.

Quota Operations

class otcextensions.sdk.sdrs.v1._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
quotas()

Retrieve a generator of SDRS quotas

Returns:

A generator of resource quotas Quota instances