• Storage Disaster Recovery Service

sdrs
  1. Help Center
  2. Storage Disaster Recovery Service
  3. API Reference
  4. API
  5. Protected Instance
  6. Creating a Protected Instance

Creating a Protected Instance

Function

This API is used to create a protected instance. When a protected instance is created, the default name of the target server is the same as the name of the source server, but their IDs are different. To modify a server name, click the server name on the protected instance details page to switch to the server details page and modify the server name.

Constraints and Limitations

  • The status of the protection group must be available.
  • priority_station of the protection group must be source.
  • The protection status of the protection group must be stopped.
  • No shared disk has been attached to the server.
  • No protected instance has been created using the server.
  • The server must be in the same VPC as the protection group.
  • The destination AZ must support the creation of servers of the same flavors as the servers in the source AZ.
  • If protection is enabled for servers created during capacity expansion of an Auto Scaling (AS) group, these servers cannot be deleted when the capacity of the AS group is reduced.
  • If the source server runs Windows and you choose the key login mode, ensure that the key pair of the source server exists when you create a protected instance. Otherwise, the target server may fail to create, causing the protected instance creation failure.
    NOTE:

    If the key pair of the source server has been deleted, create a key pair with the same name.

URI

  • URI format

    POST /v1/{project_id}/protected-instances

  • Parameter description

    Parameter

    Mandatory

    Type

    Description

    project_id

    Yes

    string

    Specifies the tenant ID.

Request

  • Parameter description

    Parameter

    Mandatory

    Type

    Description

    protected_instance

    Yes

    map

    Specifies the information about a protected instance.

  • protected_instance field description

    Parameter

    Mandatory

    Type

    Description

    server_group_id

    Yes

    string

    Specifies the ID of the protection group where a protected instance is added.

    server_id

    Yes

    string

    Specifies the ID of the source server.

    NOTE:

    When the interface is successfully invoked, the target server will be automatically created.

    name

    Yes

    string

    Specifies the name of a protected instance. The name can contain a maximum of 64 bytes. The value can contain only letters (a to z and A to Z), digits (0 to 9), decimal points (.), underscores (_), and hyphens (-).

    description

    No

    string

    Specifies the description of a protected instance. The description can contain a maximum of 64 bytes. The value cannot contain the left angle bracket (<) or right angle bracket (>).

    primary_subnet_id

    No

    string

    Specifies the subnet ID of the primary NIC on the target server.

    primary_ip_address

    No

    string

    Specifies the IP address of the primary NIC on the target server.

  • Example request
    {  
             "protected_instance":{  
                   "server_group_id": "523ab8ad-3759-4933-9436-4cf4ebb20867",  
                   "server_id": "403b603d-1d91-42cc-a357-81f3c2daf43f",  
                   "name": "test_protected_instance_name",  
                   "description": "my description",
                   "primary_subnet_id": "a32217fh-3413-c313-6342-3124d3491502", 
                   "primary_ip_address": "192.168.0.5"
             }  
      }

Response

  • Parameter description

    Parameter

    Type

    Description

    job_id

    string

    Specifies the job ID.

  • Example response
    { 
       "job_id": "0000000062db92d70162db9d200f00bb" 
     }

    Or

    { 
         "error": { 
             "message": "XXXX",  
             "code": "XXX" 
         } 
     }

    In this example, error represents a general error, including badrequest (shown below) and itemNotFound.

    { 
         "badrequest": { 
             "message": "XXXX",  
             "code": "XXX" 
         } 
     }

Returned Values

  • Normal

    Returned Value

    Description

    200

    The server has accepted the request.

  • Abnormal

    Returned Value

    Description

    400 Bad Request

    The server failed to process the request.

    401 Unauthorized

    You must enter a username and the password to access the requested page.

    403 Forbidden

    You are forbidden to access the requested page.

    404 Not Found

    The server could not find the requested page.

    405 Method Not Allowed

    You are not allowed to use the method specified in the request.

    406 Not Acceptable

    The response generated by the server could not be accepted by the client.

    407 Proxy Authentication Required

    You must use the proxy server for authentication so that the request can be processed.

    408 Request Timeout

    The request timed out.

    409 Conflict

    The request could not be processed due to a conflict.

    500 Internal Server Error

    Failed to complete the request because of a service error.

    501 Not Implemented

    Failed to complete the request because the server does not support the requested function.

    502 Bad Gateway

    Failed to complete the request because the server receives an invalid response from an upstream server.

    503 Service Unavailable

    Failed to complete the request because the system is unavailable.

    504 Gateway Timeout

    A gateway timeout error occurred.