Reuse Image Storage as Backup Storage

POST/zstack/v1/backup-storage/image-store/disaster

Headers

Authorization: OAuth the-session-uuid

Body

{
  "params": {
    "attachPoint": "/test-bs",
    "endPoint": "test12345-snp99.cn-shanghai.nas.aliyuncs.com",
    "hostname": "192.168.1.8",
    "username": "admin",
    "password": "admin%pass",
    "sshPort": 22,
    "url": "/data/imagestore",
    "name": "ImageStore",
    "importImages": false
  },
  "systemTags": [],
  "userTags": []
}

The systemTags and userTags fields in the above example are optional. They are listed to indicate that the body can contain these two fields.

Curl Example

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"attachPoint":"/test-bs","endPoint":"test12345-snp99.cn-shanghai.nas.aliyuncs.com","hostname":"192.168.1.8","username":"admin","password":"admin%pass","sshPort":22,"url":"/data/imagestore","name":"ImageStore","importImages":false}}' \
http://localhost:8080/zstack/v1/backup-storage/image-store/disaster

Parameter List

NameTypeLocationDescriptionAllowed ValuesStarting Version
attachPoint (optional)Stringbody (included in the params structure)  0.6
endPoint (optional)Stringbody (included in the params structure)  0.6
hostnameStringbody (included in the params structure)  0.6
usernameStringbody (included in the params structure)  0.6
password (optional)Stringbody (included in the params structure)  0.6
sshPort (optional)intbody (included in the params structure)  0.6
urlStringbody (included in the params structure)  0.6
nameStringbody (included in the params structure)Resource name 0.6
description (optional)Stringbody (included in the params structure)Detailed description of the resource 0.6
type (optional)Stringbody (included in the params structure)  0.6
importImages (optional)booleanbody (included in the params structure)  0.6
resourceUuid (optional)Stringbody (included in the params structure)Resource UUID 0.6
tagUuids (optional)Listbody (included in the params structure)Tag UUID list 3.4.0
systemTags (optional)ListbodySystem tags 0.6
userTags (optional)ListbodyUser tags 0.6

API Response

On success, this API returns an empty JSON structure {}. On failure, the returned JSON structure contains an error field, for example:

{
  "error": {
    "code": "SYS.1001",
    "description": "A message or a operation timeout",
    "details": "Create VM on KVM timeout after 300s"
  }
}

SDK Examples

Java SDK

AddDisasterImageStoreBackupStorageAction action = new AddDisasterImageStoreBackupStorageAction();
action.attachPoint = "/test-bs";
action.endPoint = "test12345-snp99.cn-shanghai.nas.aliyuncs.com";
action.hostname = "192.168.1.8";
action.username = "admin";
action.password = "admin%pass";
action.sshPort = 22;
action.url = "/data/imagestore";
action.name = "ImageStore";
action.importImages = false;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddDisasterImageStoreBackupStorageAction.Result res = action.call();

Python SDK

AddDisasterImageStoreBackupStorageAction action = AddDisasterImageStoreBackupStorageAction()
action.attachPoint = "/test-bs"
action.endPoint = "test12345-snp99.cn-shanghai.nas.aliyuncs.com"
action.hostname = "192.168.1.8"
action.username = "admin"
action.password = "admin%pass"
action.sshPort = 22
action.url = "/data/imagestore"
action.name = "ImageStore"
action.importImages = false
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AddDisasterImageStoreBackupStorageAction.Result res = action.call()