文档目录

镜像服务器相关接口

删除镜像服务器(DeleteBackupStorage)

API请求

URLs
DELETE zstack/v1/backup-storage/{uuid}?deleteMode={deleteMode}
Headers
Authorization: OAuth the-session-uuid
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 3cb9fd3d9fad4f64b62086b1aeabf42a" \
-X DELETE http://localhost:8080/zstack/v1/backup-storage/12b157dc061a46739168b6e87bf2657f?deleteMode=Permissive
参数列表
名字 类型 位置 描述 可选值 起始版本
uuid String url 资源的UUID,唯一标示该资源 0.6
deleteMode (可选) String body 删除模式(Permissive 或者 Enforcing, 默认 Permissive) 0.6
systemTags (可选) List body 系统标签 0.6
userTags (可选) List body 用户标签 0.6

API返回

该API成功时返回一个空的JSON结构{},出错时返回的JSON结构包含一个error字段,例如:
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
    }
}

SDK示例

Java SDK
DeleteBackupStorageAction action = new DeleteBackupStorageAction();
action.uuid = "1c8acbc2af8445a5b631350276787580";
action.deleteMode = "Permissive";
action.sessionId = "4caf9cc241604dbca3088779d6772dbe";
DeleteBackupStorageAction.Result res = action.call();
Python SDK
DeleteBackupStorageAction action = DeleteBackupStorageAction()
action.uuid = "06473459fd474a26bb1d79e2edd004f3"
action.deleteMode = "Permissive"
action.sessionId = "a6fead8970fe45cfa6ba92e7dcf08d66"
DeleteBackupStorageAction.Result res = action.call()

查询镜像服务器(QueryBackupStorage)

API请求

URLs
GET zstack/v1/backup-storage
GET zstack/v1/backup-storage/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth dce9c25b65254343b0f9a568a661f348" \
-X GET http://localhost:8080/zstack/v1/backup-storage?q=uuid=435e61f882cf431bb4ae48246489a988
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth fe9a6571fc9949e7a0d31d94fae9b87c" \
-X GET http://localhost:8080/zstack/v1/backup-storage/1ab3b836a88342e1bbc1b1a17d092f0f

可查询字段

运行CLI命令行工具,输入QueryBackupStorage并按Tab键查看所有可查询字段以及可跨表查询的资源名。

API返回

返回示例(imagestore)
{
    "inventories": [
        {
            "attachedZoneUuids": [
                "140ebc2fbdb74ae197323a69d432f25e"
            ],
            "availableCapacity": 4931431059456,
            "createDate": "Apr 11, 2018 2:50:54 PM",
            "description": "",
            "hostname": "172.20.1.115",
            "lastOpDate": "Dec 13, 2019 7:32:49 PM",
            "name": "image-store",
            "sshPort": 22,
            "state": "Enabled",
            "status": "Connected",
            "totalCapacity": 9992857976832,
            "type": "ImageStoreBackupStorage",
            "url": "/zstack_imagestore",
            "username": "root",
            "uuid": "1ab3b836a88342e1bbc1b1a17d092f0f"
        }
    ],
    "success": true
}
返回示例(ceph)
{
    "inventories": [
        {
            "attachedZoneUuids": [
                "195ae9157b9248e3889cc56cfd7d0f8d"
            ],
            "availableCapacity": 297500737536,
            "createDate": "Dec 14, 2019 9:46:05 AM",
            "description": "Test",
            "fsid": "d53902bc-ff50-4d08-8769-9d83448478d3",
            "lastOpDate": "Dec 14, 2019 11:30:40 AM",
            "mons": [
                {
                    "backupStorageUuid": "eed424abee694bcda5a5e414a61ea3d3",
                    "createDate": "Dec 14, 2019 9:46:05 AM",
                    "hostname": "172.24.249.174",
                    "lastOpDate": "Dec 14, 2019 11:21:46 AM",
                    "monAddr": "172.24.249.174",
                    "monPort": 6789,
                    "monUuid": "e6707015afc8405ba0b184ca7a318b63",
                    "sshPassword": "password",
                    "sshPort": 22,
                    "sshUsername": "root",
                    "status": "Connected"
                },
                {
                    "backupStorageUuid": "eed424abee694bcda5a5e414a61ea3d3",
                    "createDate": "Dec 14, 2019 9:46:05 AM",
                    "hostname": "172.24.252.188",
                    "lastOpDate": "Dec 14, 2019 11:21:45 AM",
                    "monAddr": "172.24.252.188",
                    "monPort": 6789,
                    "monUuid": "d5e70424ddac4c03ab06466d600ef4ae",
                    "sshPassword": "password",
                    "sshPort": 22,
                    "sshUsername": "root",
                    "status": "Connected"
                },
                {
                    "backupStorageUuid": "eed424abee694bcda5a5e414a61ea3d3",
                    "createDate": "Dec 14, 2019 9:46:05 AM",
                    "hostname": "172.24.247.108",
                    "lastOpDate": "Dec 14, 2019 11:21:16 AM",
                    "monAddr": "172.24.247.108",
                    "monPort": 6789,
                    "monUuid": "378826f5f690480983f39514e0b00f75",
                    "sshPassword": "password",
                    "sshPort": 22,
                    "sshUsername": "root",
                    "status": "Connected"
                }
            ],
            "name": "ceph-bs",
            "poolAvailableCapacity": 99166913877,
            "poolName": "bak-t-eed424abee694bcda5a5e414a61ea3d3",
            "poolReplicatedSize": 3,
            "poolUsedCapacity": 2787687082,
            "state": "Enabled",
            "status": "Connected",
            "totalCapacity": 305863802880,
            "type": "Ceph",
            "url": "not used",
            "uuid": "eed424abee694bcda5a5e414a61ea3d3"
        }
    ],
    "success": true
}
名字 类型 描述 起始版本
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 0.6
inventories List 详情参考inventories 0.6
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 0.6
description String 错误的概要描述 0.6
details String 错误的详细信息 0.6
elaboration String 保留字段,默认为null 0.6
opaque LinkedHashMap 保留字段,默认为null 0.6
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 0.6
#inventories
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 0.6
name String 资源名称 0.6
url String 0.6
description String 资源的详细描述 0.6
totalCapacity Long 0.6
availableCapacity Long 0.6
type String 0.6
state String 0.6
status String 0.6
createDate Timestamp 创建时间 0.6
lastOpDate Timestamp 最后一次修改时间 0.6
attachedZoneUuids List 0.6

SDK示例

Java SDK
QueryBackupStorageAction action = new QueryBackupStorageAction();
action.conditions = asList("uuid=b8e17834373747ae8b6555db80e74586");
action.sessionId = "f5d478c4facf42f4a3f16c8efbfd9628";
QueryBackupStorageAction.Result res = action.call();
Python SDK
QueryBackupStorageAction action = QueryBackupStorageAction()
action.conditions = ["uuid=0359113913834277bc815b446a6eff25"]
action.sessionId = "dc56b36c279f449ea2d430d2513a4cb0"
QueryBackupStorageAction.Result res = action.call()

重连镜像服务器(ReconnectBackupStorage)

API请求

URLs
PUT zstack/v1/backup-storage/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
"reconnectBackupStorage": {},
"systemTags": [],
"userTags": []
}
Note: 上述示例中systemTagsuserTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"reconnectBackupStorage":{}}' \
http://localhost:8080/zstack/v1/backup-storage/37ea58b550103d40b23420e870bd616f/actions
参数列表
名字 类型 位置 描述 可选值 起始版本
uuid String url 资源的UUID,唯一标示该资源 0.6
systemTags (可选) List body 系统标签 0.6
userTags (可选) List body 用户标签 0.6

API返回

返回示例
{
"inventory": {
"name": "My Backup Storage",
"description": "Public Backup Storage",
"totalCapacity": 1.073741824E9,
"availableCapacity": 9.68884224E8,
"type": "Ceph",
"state": "Enabled",
"status": "Connected",
"createDate": "Jun 7, 2017 9:20:21 PM",
"lastOpDate": "Jun 7, 2017 9:20:21 PM",
"attachedZoneUuids": [
"410e621653de4bab8fd44f81e74b9225"
    ]
  }
}
名字 类型 描述 起始版本
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 0.6
inventory BackupStorageInventory 详情参考inventory 0.6
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 0.6
description String 错误的概要描述 0.6
details String 错误的详细信息 0.6
elaboration String 保留字段,默认为null 0.6
opaque LinkedHashMap 保留字段,默认为null 0.6
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 0.6
#inventory
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 0.6
name String 资源名称 0.6
url String 0.6
description String 资源的详细描述 0.6
totalCapacity Long 0.6
availableCapacity Long 0.6
type String 0.6
state String 0.6
status String 0.6
createDate Timestamp 创建时间 0.6
lastOpDate Timestamp 最后一次修改时间 0.6
attachedZoneUuids List 0.6

SDK示例

Java SDK
ReconnectBackupStorageAction action = new ReconnectBackupStorageAction();
action.uuid = "f68e2350598547198b72bd578d14b037";
action.sessionId = "dcc8725e00f4437889104fe6ce942f96";
ReconnectBackupStorageAction.Result res = action.call(); 
Python SDK
ReconnectBackupStorageAction action = ReconnectBackupStorageAction()
action.uuid = "2f2571f4864c46778544b500d006dfe7"
action.sessionId = "a1c68d6ead48410ab9fd255d4c73f843"
ReconnectBackupStorageAction.Result res = action.call()

更改镜像服务器可用状态(ChangeBackupStorageState)

API请求

URLs
PUT zstack/v1/backup-storage/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
"changeBackupStorageState": {
"stateEvent": "Disabled"
  },
"systemTags": [],
"userTags": []
}
Note: 上述示例中systemTagsuserTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"changeBackupStorageState":{"stateEvent":"disable"}}' \
http://localhost:8080/zstack/v1/backup-storage/7d2e0c9d7b3734f28b3a22eab93ddb63/actions
参数列表
名字 类型 位置 描述 可选值 起始版本
uuid String url 资源的UUID,唯一标示该资源 0.6
stateEvent String body(包含在changeBackupStorageState结构中) 镜像服务器的目标状态
  • enable
  • disable
0.6
systemTags (可选) List body 系统标签 0.6
userTags (可选) List body 用户标签 0.6

API返回

返回示例
{
"inventory": {
"name": "My Backup Storage",
"description": "Public Backup Storage",
"totalCapacity": 1.073741824E9,
"availableCapacity": 9.68884224E8,
"type": "Ceph",
"state": "Disabled",
"status": "Connected",
"createDate": "Jun 7, 2017 9:20:45 PM",
"lastOpDate": "Jun 7, 2017 9:20:45 PM",
"attachedZoneUuids": [
"c1b882e3dfc944348ab63b478a64f257"
    ]
  }
}
名字 类型 描述 起始版本
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 0.6
inventory BackupStorageInventory 详情参考inventory 0.6
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 0.6
description String 错误的概要描述 0.6
details String 错误的详细信息 0.6
elaboration String 保留字段,默认为null 0.6
opaque LinkedHashMap 保留字段,默认为null 0.6
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 0.6
#inventory
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 0.6
name String 资源名称 0.6
url String 0.6
description String 资源的详细描述 0.6
totalCapacity Long 0.6
availableCapacity Long 0.6
type String 0.6
state String 0.6
status String 0.6
createDate Timestamp 创建时间 0.6
lastOpDate Timestamp 最后一次修改时间 0.6
attachedZoneUuids List 0.6

SDK示例

Java SDK
ChangeBackupStorageStateAction action = new ChangeBackupStorageStateAction();
action.uuid = "35b513d450dd484b8aae9c2a5c488a76";
action.stateEvent = "Disabled";
action.sessionId = "6235716916cc4fffbc027a3cca374c5e";
ChangeBackupStorageStateAction.Result res = action.call();
Python SDK
ChangeBackupStorageStateAction action = ChangeBackupStorageStateAction()
action.uuid = "1576b0cf06b041d99e5f615b72bb384f"
action.stateEvent = "Disabled"
action.sessionId = "4226acacae2b489c8ba81e4af682a57a"
ChangeBackupStorageStateAction.Result res = action.call()

获取镜像服务器存储容量(GetBackupStorageCapacity)

API请求

URLs
GET zstack/v1/backup-storage/capacities
Headers
Authorization: OAuth the-session-uuid
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 4804c84fa75e442e890d3a01a5bc2882" \
-X GET http://localhost:8080/zstack/v1/backup-storage/capacities?zoneUuids=6c4a26e1ec274395977b1fd98144dd27&all=true
参数列表
名字 类型 位置 描述 可选值 起始版本
zoneUuids (可选) List query 区域UUID列表 0.6
backupStorageUuids (可选) List query 镜像服务器UUID列表
  • zoneUuids, backupStorageUuids 至少有一个不为空
  • 若zoneUuids, backupStorageUuids均为空,all为真
0.6
all (可选) boolean query 当镜像服务器UUID列表为空时,该项为真表示查询系统中所有的镜像服务器。 0.6
systemTags (可选) List query 系统标签 0.6
userTags (可选) List query 用户标签 0.6

API返回

返回示例
{
"totalCapacity": 1.073741824E9,
"availableCapacity": 9.68884224E8
}
名字 类型 描述 起始版本
totalCapacity long 总容量(以字节计) 0.6
availableCapacity long 可用容量(以字节计) 0.6
success boolean 成功失败标志 0.6
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 0.6
ErrorCode 详情参考error 0.6
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 0.6
description String 错误的概要描述 0.6
details String 错误的详细信息 0.6
elaboration String 保留字段,默认为null 0.6
opaque LinkedHashMap 保留字段,默认为null 0.6
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 0.6

SDK示例

Java SDK
GetBackupStorageCapacityAction action = new GetBackupStorageCapacityAction();
action.zoneUuids = asList("aae3e25dc11b41f8ae41739814949cfe");
action.all = true;
action.sessionId = "fbcc6cc548a44caea69bb492ea13a4bd";
GetBackupStorageCapacityAction.Result res = action.call();
Python SDK
GetBackupStorageCapacityAction action = GetBackupStorageCapacityAction()
action.zoneUuids = [afa2a794d1244f55acc0f8d2d0e5cdc7]
action.all = true
action.sessionId = "1574e3585df94016a047e1d836978f3e"
GetBackupStorageCapacityAction.Result res = action.call()

获取镜像服务器类型列表(GetBackupStorageTypes)

API请求

URLs
GET zstack/v1/backup-storage/types
Headers
Authorization: OAuth the-session-uuid
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 47583a9a72f84121b84135296f3af8cf" \
-X GET http://localhost:8080/zstack/v1/backup-storage/types
参数列表
名字 类型 位置 描述 可选值 起始版本
systemTags (可选) List query 系统标签 0.6
userTags (可选) List query 用户标签 0.6

API返回

返回示例
{
"backupStorageTypes": [
"Ceph",
"ImageStore"
  ]
}
名字 类型 描述 起始版本
types List 镜像服务器类型列表 0.6
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 0.6
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 0.6
description String 错误的概要描述 0.6
details String 错误的详细信息 0.6
elaboration String 保留字段,默认为null 0.6
opaque LinkedHashMap 保留字段,默认为null 0.6
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 0.6

SDK示例

Java SDK
GetBackupStorageTypesAction action = new GetBackupStorageTypesAction();
action.sessionId = "010841c1e6ea46cd9cde645ad31cc2e4";
GetBackupStorageTypesAction.Result res = action.call();
Python SDK
GetBackupStorageTypesAction action = GetBackupStorageTypesAction()
action.sessionId = "0c34591f7bcf4460ba3db2791b164f01"
GetBackupStorageTypesAction.Result res = action.call()

更新镜像服务器信息(UpdateBackupStorage)

API请求

URLs
PUT zstack/v1/backup-storage/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
"updateBackupStorage": {
"name": "New Name"
  },
"systemTags": [],
"userTags": []
}
Note: 上述示例中systemTagsuserTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateBackupStorage":{"name":"New Name"}}' \
http://localhost:8080/zstack/v1/backup-storage/72f0f262f3323515b177d148ad1efb66/actions
参数列表
名字 类型 位置 描述 可选值 起始版本
uuid String url 指定目标镜像服务器的UUID 0.6
name (可选) String body(包含在updateBackupStorage结构中) 镜像服务器的新名称 0.6
description (可选) String body(包含在updateBackupStorage结构中) 镜像服务器新的详细描述 0.6
systemTags (可选) List body 系统标签 0.6
userTags (可选) List body 用户标签 0.6

API返回

返回示例
{
"inventory": {
"name": "New Name",
"description": "Public Backup Storage",
"totalCapacity": 1.073741824E9,
"availableCapacity": 9.68884224E8,
"type": "Ceph",
"state": "Enabled",
"status": "Connected",
"createDate": "Jun 7, 2017 9:20:36 PM",
"lastOpDate": "Jun 7, 2017 9:20:36 PM",
"attachedZoneUuids": [
"90b2283f6c454453923dcf2f8e188330"
    ]
  }
}
名字 类型 描述 起始版本
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 0.6
inventory BackupStorageInventory 详情参考inventory 0.6
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 0.6
description String 错误的概要描述 0.6
details String 错误的详细信息 0.6
elaboration String 保留字段,默认为null 0.6
opaque LinkedHashMap 保留字段,默认为null 0.6
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 0.6
#inventory
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 0.6
name String 资源名称 0.6
url String 0.6
description String 资源的详细描述 0.6
totalCapacity Long 0.6
availableCapacity Long 0.6
type String 0.6
state String 0.6
status String 0.6
createDate Timestamp 创建时间 0.6
lastOpDate Timestamp 最后一次修改时间 0.6
attachedZoneUuids List 0.6

SDK示例

Java SDK
UpdateBackupStorageAction action = new UpdateBackupStorageAction();
action.uuid = "2fe89c39bc2442aba58d5666d447b7c8";
action.name = "New Name";
action.sessionId = "1c2edd7a86564567ad34b7960808654e";
UpdateBackupStorageAction.Result res = action.call();
Python SDK
UpdateBackupStorageAction action = UpdateBackupStorageAction()
action.uuid = "f85f3310a70e4e01be84364aeb2caa42"
action.name = "New Name"
action.sessionId = "4176bd78f5754872b4963e0d3ddbc529"
UpdateBackupStorageAction.Result res = action.call()

从镜像服务器导出镜像(ExportImageFromBackupStorage)

API请求

URLs
PUT zstack/v1/backup-storage/{backupStorageUuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
"exportImageFromBackupStorage": {
"imageUuid": "bd09de6529704e168923b77e5c1445c3"
  },
"systemTags": [],
"userTags": []
}
Note: 上述示例中systemTagsuserTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"exportImageFromBackupStorage":{"imageUuid":"0538b97654be3249a962327ace7c5520"}}' \
http://localhost:8080/zstack/v1/backup-storage/03c75cf832863825b43696ea22d5d1ad/actions
参数列表
名字 类型 位置 描述 可选值 起始版本
backupStorageUuid String url 镜像存储UUID 1.7
imageUuid String body(包含在exportImageFromBackupStorage结构中) 镜像UUID 1.7
exportFormat (可选) String body(包含在exportImageFromBackupStorage结构中) 导出镜像的保存格式 3.9.0
systemTags (可选) List body 系统标签 1.7
userTags (可选) List body 用户标签 1.7

API返回

返回示例
{"imageUrl": "http://bs-host-name/path/to/image.qcow2",
  "exportMd5Sum": "8a239d17b045dea51c4677fa90a42ed8"
}
名字 类型 描述 起始版本
imageUrl String 被导出镜像的访问地址 1.7
exportMd5Sum String 被导出镜像的md5值 3.9.0
success boolean 导出成功失败标志 1.7
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 1.7
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 0.6
description String 错误的概要描述 0.6
details String 错误的详细信息 0.6
elaboration String 保留字段,默认为null 0.6
opaque LinkedHashMap 保留字段,默认为null 0.6
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 0.6

SDK示例

Java SDK
ExportImageFromBackupStorageAction action = new ExportImageFromBackupStorageAction();
action.backupStorageUuid = "b95c2eef6b8d44248305bc21b58324dd";
action.imageUuid = "a8e908dd49a444d2ad37dd729a2d881f";
action.sessionId = "f58bf3e6d8294d488573fc62511a2ad0";
ExportImageFromBackupStorageAction.Result res = action.call();
Python SDK
ExportImageFromBackupStorageAction action = ExportImageFromBackupStorageAction()
action.backupStorageUuid = "dda8b4f308534e98a5fc2facdbc7936e"
action.imageUuid = "7ed5c3c65ae941dabe9ecc00b7a1b015"
action.sessionId = "f724920d165944218cd71b76e755757e"
ExportImageFromBackupStorageAction.Result res = action.call()

从镜像服务器元数据中同步镜像(SyncImage)

API请求

URLs
PUT zstack/v1/backup-storage/image-store/{imageStoreUuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "syncImage": {},
  "systemTags": [],
  "userTags": []
}
Note: 上述示例中systemTagsuserTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"syncImage":{}}' \
http://localhost:8080/zstack/v1/backup-storage/image-store/81f447310d194ef5a8c0f7bbdcdc8401/actions
参数列表
名字 类型 位置 描述 可选值 起始版本
imageStoreUuid String url 镜像服务器UUID 4.7.11
systemTags (可选) List body 系统标签 4.7.11
userTags (可选) List body 用户标签 4.7.11

API返回

该API成功时返回一个空的JSON结构{},出错时返回的JSON结构包含一个error字段,例如:
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 4.7.11
description String 错误的概要描述 4.7.11
details String 错误的详细信息 4.7.11
elaboration String 保留字段,默认为null 4.7.11
opaque LinkedHashMap 保留字段,默认为null 4.7.11
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 4.7.11

SDK示例

Java SDK
SyncImageAction action = new SyncImageAction();
action.imageStoreUuid = "cff07127e2134fe28396a1aaeb70a1cf";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
SyncImageAction.Result res = action.call();
Python SDK
SyncImageAction action = SyncImageAction()
action.imageStoreUuid = "8a1247ffe8354566adb6ccae56aa1db3"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
SyncImageAction.Result res = action.call()

从镜像服务器删除导出的镜像(DeleteExportedImageFromBackupStorage)

API请求

URLs
DELETE/v1/backup-storage/{backupStorageUuid}/exported-images/{imageUuid}
Headers
Authorization: OAuth the-session-uuid
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth bb7d8495054d412fa8c7c16b8625222c" \
-X DELETE http://localhost:8080/zstack/v1/backup-storage/c03c38ab9d184143891718c4b3f664d1/exported-images/dce27bd0a0ae4aaa8771ac33d481ec52?
参数列表
名字 类型 位置 描述 可选值 起始版本
backupStorageUuid String url 镜像存储UUID 1.7
imageUuid String url 镜像UUID 1.7
systemTags (可选) List body 系统标签 1.7
userTags (可选) List body 用户标签 1.7

API返回

该API成功时返回一个空的JSON结构{},出错时返回的JSON结构包含一个error字段,例如:
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
    }
}

SDK示例

Java SDK
DeleteExportedImageFromBackupStorageAction action = new DeleteExportedImageFromBackupStorageAction();
action.backupStorageUuid = "9c781fd5c7334e8492c9d3409ad0c63a";
action.imageUuid = "b9b4f79d505040eba37ad6e4581b64fd";
action.sessionId = "ecce8dd56c3a476c8dd1ac90aeb0d321";
DeleteExportedImageFromBackupStorageAction.Result res = action.call();
Python SDK
DeleteExportedImageFromBackupStorageAction action = DeleteExportedImageFromBackupStorageAction()
action.backupStorageUuid = "29e4e1a659004403bd9b3738b36dd37e"
action.imageUuid = "2ba013855b8f4c688d977b545272541f"
action.sessionId = "e2c772523e104f3da969630930e68a17"
DeleteExportedImageFromBackupStorageAction.Result res = action.call()

挂载镜像服务器至区域(AttachBackupStorageToZone)

API请求

URLs
POST zstack/v1/zones/{zoneUuid}/backup-storage/{backupStorageUuid}
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {},
  "systemTags": [],
  "userTags": []
}
Note: 上述示例中systemTagsuserTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{}}' http://localhost:8080/zstack/v1/zones/5776b543bc713f6d9abca9cd605c8199/backup-storage/53ef01cbf71d3bd68206908b87e51403
参数列表
名字 类型 位置 描述 可选值 起始版本
zoneUuid String url 区域UUID 0.6
backupStorageUuid String url 镜像存储UUID 0.6
systemTags (可选) List body 系统标签 0.6
userTags (可选) List body 用户标签 0.6

API返回

返回示例
{
"inventory": {
"name": "My Backup Storage",
"description": "Public Backup Storage",
"totalCapacity": 1073741824,
"availableCapacity": 968884224,
"type": "Ceph",
"state": "Enabled",
"status": "Connected",
"createDate": "Jun 7, 2017 9:20:19 PM",
"lastOpDate": "Jun 7, 2017 9:20:19 PM",
"attachedZoneUuids": [
"73799602dbf64c0d85694de34fc596c3"
    ]
  }
}
名字 类型 描述 起始版本
success boolean 4.7.0
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 0.6
inventory BackupStorageInventory 详情参考inventory 0.6
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 0.6
description String 错误的概要描述 0.6
details String 错误的详细信息 0.6
elaboration String 保留字段,默认为null 0.6
opaque LinkedHashMap 保留字段,默认为null 0.6
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 0.6
#inventory
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 0.6
name String 资源名称 0.6
url String 0.6
description String 资源的详细描述 0.6
totalCapacity Long 0.6
availableCapacity Long 0.6
type String 0.6
state String 0.6
status String 0.6
createDate Timestamp 创建时间 0.6
lastOpDate Timestamp 最后一次修改时间 0.6
attachedZoneUuids List 0.6

SDK示例

Java SDK
AttachBackupStorageToZoneAction action = new AttachBackupStorageToZoneAction();
action.zoneUuid = "426c6d907d3546378bd0007a74fc68e4";
action.backupStorageUuid = "d60efb0b61c3420a8e2d90d30054548f";
action.sessionId = "1b44ab68b73b4336a34aa10f6dc93cf8";
AttachBackupStorageToZoneAction.Result res = action.call();
Python SDK
AttachBackupStorageToZoneAction action = AttachBackupStorageToZoneAction()
action.zoneUuid = "a590b4b45fbf441499bc0eebc23966d8"
action.backupStorageUuid = "62be70c887354bcfbec52c64e88a6718"
action.sessionId = "bf4faf33fd544650928a0d0732a2f1c1"
AttachBackupStorageToZoneAction.Result res = action.call()

从区域中卸载已经挂载的镜像服务器(DetachBackupStorageFromZone)

API请求

URLs
DELETE/v1/zones/{zoneUuid}/backup-storage/{backupStorageUuid}
Headers
Authorization: OAuth the-session-uuid
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth d0143df7af864c029c386e8957d218b6" \
-X DELETE http://localhost:8080/zstack/v1/zones/cb571dd2f60740de9fea4d9003a9f33f/backup-storage/8cbfbfd5b24a4d01aaa7da5a6fc96169?
参数列表
名字 类型 位置 描述 可选值 起始版本
backupStorageUuid String url 镜像存储UUID 0.6
zoneUuid String url 区域UUID 0.6
systemTags (可选) List body 系统标签 0.6
userTags (可选) List body 用户标签 0.6

API返回

返回示例
{
"inventory": {
"name": "My Backup Storage",
"description": "Public Backup Storage",
"totalCapacity": 1.073741824E9,
"availableCapacity": 9.68884224E8,
"type": "Ceph",
"state": "Enabled",
"status": "Connected",
"createDate": "Jun 7, 2017 9:20:21 PM",
"lastOpDate": "Jun 7, 2017 9:20:21 PM",
"attachedZoneUuids": [
"c57c33405b544ee580e6892a796cff96"
    ]
  }
}
名字 类型 描述 起始版本
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 0.6
inventory BackupStorageInventory 详情参考inventory 0.6
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 0.6
description String 错误的概要描述 0.6
details String 错误的详细信息 0.6
elaboration String 保留字段,默认为null 0.6
opaque LinkedHashMap 保留字段,默认为null 0.6
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 0.6
#inventory
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 0.6
name String 资源名称 0.6
url String 0.6
description String 资源的详细描述 0.6
totalCapacity Long 0.6
availableCapacity Long 0.6
type String 0.6
state String 0.6
status String 0.6
createDate Timestamp 创建时间 0.6
lastOpDate Timestamp 最后一次修改时间 0.6
attachedZoneUuids List 0.6

SDK示例

Java SDK
DetachBackupStorageFromZoneAction action = new DetachBackupStorageFromZoneAction();
action.backupStorageUuid = "a1b0bc9a79984c43bbf04da9d3ae6a4d";
action.zoneUuid = "c2be518dc66a4f3cb513d0cda54e9e96";
action.sessionId = "6256e305d8eb4d969dc244ae0b8fc7cb";
DetachBackupStorageFromZoneAction.Result res = action.call();
Python SDK
DetachBackupStorageFromZoneAction action = DetachBackupStorageFromZoneAction()
action.backupStorageUuid = "86342d8a57fb42c19113ff5311947874"
action.zoneUuid = "c33c4fb6a91d4c13a75014262256bfbd"
action.sessionId = "0b9369db754a4e01b6ab28bc1140bebc"
DetachBackupStorageFromZoneAction.Result res = action.call()

跨镜像服务器迁移镜像(BackupStorageMigrateImage)

API请求

URLs
PUT zstack/v1/backup-storage/images/{imageUuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "backupStorageMigrateImage": {
    "srcBackupStorageUuid": "94a166b9be264f1cafc6de4373117711",
    "dstBackupStorageUuid": "01e8e16d56f44880bfe00bdd22da37ed"
  },
  "systemTags": [],
  "userTags": []
}
Note: 上述示例中systemTagsuserTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"backupStorageMigrateImage":{"srcBackupStorageUuid":"dc0d29bb93a93c9b859919c42b8ea583","dstBackupStorageUuid":"1a1c9bfe9f1d328c846e829339f91184"}}' \
http://localhost:8080/zstack/v1/backup-storage/images/728c33a3e6a5319c9276fb43ae982de7/actions
参数列表
名字 类型 位置 描述 可选值 起始版本
imageUuid String url 镜像UUID 2.2
srcBackupStorageUuid String body(包含在backupStorageMigrateImage结构中) 源镜像服务器UUID 2.2
dstBackupStorageUuid String body(包含在backupStorageMigrateImage结构中) 目标镜像服务器UUID 2.2
systemTags (可选) List body 系统标签 2.2
userTags (可选) List body 用户标签 2.2

API返回

返回示例
{
  "inventory": {
    "uuid": "5030c88a703e41b986d140880ad79bcd",
    "name": "TinyLinux",
    "url": "http://192.168.1.20/share/images/tinylinux.qcow2",
    "mediaType": "RootVolumeTemplate",
    "platform": "Linux",
    "format": "qcow2",
    "backupStorageRefs": [
      {
        "id": 0.0,
        "imageUuid": "5030c88a703e41b986d140880ad79bcd",
        "backupStorageUuid": "21df59afa9414a0aa405cb4c4fef2fee",
        "installPath": "ceph://zs-images/f0b149e053b34c7eb7fe694b182ebffd",
        "status": "Ready"
      }
    ]
  }
}
名字 类型 描述 起始版本
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。详情参考error 2.2
inventory ImageInventory 详情参考inventory 2.2
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 2.2
description String 错误的概要描述 2.2
details String 错误的详细信息 2.2
elaboration String 保留字段,默认为null 2.2
opaque LinkedHashMap 保留字段,默认为null 2.2
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 2.2
#inventory
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 2.2
name String 资源名称 2.2
description String 资源的详细描述 2.2
state String 2.2
status String 2.2
size Long 2.2
actualSize Long 2.2
md5Sum String 2.2
url String 2.2
mediaType String 2.2
guestOsType String 2.2
type String 2.2
platform String 2.2
format String 2.2
system Boolean 2.2
createDate Timestamp 创建时间 2.2
lastOpDate Timestamp 最后一次修改时间 2.2
backupStorageRefs List 详情参考backupStorageRefs 2.2
#backupStorageRefs
名字 类型 描述 起始版本
imageUuid String 镜像UUID 2.2
backupStorageUuid String 镜像存储UUID 2.2
installPath String 2.2
exportUrl String 2.2
exportMd5Sum String 2.2
status String 2.2
createDate Timestamp 创建时间 2.2
lastOpDate Timestamp 最后一次修改时间 2.2

SDK示例

Java SDK
BackupStorageMigrateImageAction action = new BackupStorageMigrateImageAction();
action.imageUuid = "c128546f17ba4dfc92055232549fd335";
action.srcBackupStorageUuid = "5346ba40a0d34caeb0b93f1b1a0db365";
action.dstBackupStorageUuid = "1a2dd487461f403eb47ac8c976c129a2";
action.sessionId = "c9fd105944334cddb33c03a1b3d3f423";
BackupStorageMigrateImageAction.Result res = action.call();
Python SDK
BackupStorageMigrateImageAction action = BackupStorageMigrateImageAction()
action.imageUuid = "ecda1a5ff835474897b59aedd04bee5e"
action.srcBackupStorageUuid = "84242c5298634005b748140d01538d6a"
action.dstBackupStorageUuid = "593ed6cba5b046aeb33b77a6ac1fa927"
action.sessionId = "6a214423493146078b5a2c9b3f74b80d"
BackupStorageMigrateImageAction.Result res = action.call()

获取候选列表(GetBackupStorageCandidatesForImageMigration)

获取镜像迁移的目标镜像服务器候选列表。

API请求

URLs
GET zstack/v1/backup-storage/{srcBackupStorageUuid}/migration-candidates
Headers
Authorization: OAuth the-session-uuid
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 3de5faeefb2d404ab8794990b744538c" \
-X GET http://localhost:8080/zstack/v1/backup-storage/3c738531e0b64399a354022d59a46ebb/migration-candidates
参数列表
名字 类型 位置 描述 可选值 起始版本
srcBackupStorageUuid String url 待迁移镜像所在镜像服务器UUID 2.2
systemTags (可选) List query 系统标签 2.2
userTags (可选) List query 用户标签 2.2

API返回

返回示例
{
  "inventories": [
    {
      "uuid": "7ed005f5dcfd4ca7b1883b97c803f53b",
      "name": "BS-1"
    }
  ]
}
名字 类型 描述 起始版本
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 2.2
inventories List 详情参考inventories 2.2
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 2.2
description String 错误的概要描述 2.2
details String 错误的详细信息 2.2
elaboration String 保留字段,默认为null 2.2
opaque LinkedHashMap 保留字段,默认为null 2.2
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 2.2
#inventories
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 2.2
name String 资源名称 2.2
url String 2.2
description String 资源的详细描述 2.2
totalCapacity Long 2.2
availableCapacity Long 2.2
type String 2.2
state String 2.2
status String 2.2
createDate Timestamp 创建时间 2.2
lastOpDate Timestamp 最后一次修改时间 2.2
attachedZoneUuids List 2.2

SDK示例

Java SDK
GetBackupStorageCandidatesForImageMigrationAction action = new GetBackupStorageCandidatesForImageMigrationAction();
action.srcBackupStorageUuid = "cf9fb97b3045411ab5345fe678116bf8";
action.sessionId = "2887bb5380f242f8ab43ae2d8649cb73";
GetBackupStorageCandidatesForImageMigrationAction.Result res = action.call();
Python SDK
GetBackupStorageCandidatesForImageMigrationAction action = GetBackupStorageCandidatesForImageMigrationAction()
action.srcBackupStorageUuid = "962c8f5399354df591c08fc3d25b58c1"
action.sessionId = "ab7451c36d8c4c3ea85d3c7395389fda"
GetBackupStorageCandidatesForImageMigrationAction.Result res = action.call()

镜像仓库服务器相关接口

添加镜像仓库服务器(AddImageStoreBackupStorage)

API请求

URLs
POST zstack/v1/backup-storage/image-store
Headers
Authorization: OAuth the-session-uuid
Body
{
"params": {
"hostname": "192.168.1.8",
"username": "admin",
"password": "admin%pass",
"sshPort": 22.0,
"url": "/data/imagestore",
"name": "ImageStore",
"importImages": false
  },
"systemTags": [],
"userTags": []
}
Note: 上述示例中systemTagsuserTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"hostname":"192.168.1.8","username":"admin","password":"admin%pass","sshPort":22.0,"url":"/data/imagestore","name":"ImageStore","importImages":false}}' \
http://localhost:8080/zstack/v1/backup-storage/image-store
参数列表
名字 类型 位置 描述 可选值 起始版本
hostname String body(包含在params结构中) 服务器主机地址 1.6
username String body(包含在params结构中) 服务器 SSH 用户名 (用于 Ansible 部署) 1.6
password String body(包含在params结构中) 服务器 SSH 用户密码 1.6
sshPort (可选) int body(包含在params结构中) 服务器 SSH 端口 1.6
url String body(包含在params结构中) 镜像仓库本地数据存放路径 1.6
name String body(包含在params结构中) 镜像仓库服务器名称 1.6
description (可选) String body(包含在params结构中) 镜像仓库的详细描述 1.6
type (可选) String body(包含在params结构中) 这里是 ImageStoreBackupStorage 1.6
importImages (可选) boolean body(包含在params结构中) 是否导入镜像 1.9
resourceUuid (可选) String body(包含在params结构中) 资源UUID。若指定,镜像服务器会使用该字段值作为UUID 1.6
systemTags (可选) List body(包含在params结构中) 系统标签 1.6
userTags (可选) List body(包含在params结构中) 用户标签 1.6
Note:
  • ZStack Cloud添加镜仓库服务器时,支持指定镜像仓库存放路径的挂载方式。SystemTags增加fsInfo选项。
    • 选项格式为:fsInfo::type::$TYPE::url::$URL::options::$OPTIONS
    • 例如:fsInfo::type::nfs::url::172.32.1.119:/nas/nfs2::options::nolock,vers=3,rsize=32768,wsize=32768

API返回

该API成功时返回一个空的JSON结构{},出错时返回的JSON结构包含一个error字段,例如:
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
    }
}

SDK示例

Java SDK
AddImageStoreBackupStorageAction action = new AddImageStoreBackupStorageAction();
action.hostname = "192.168.1.8";
action.username = "admin";
action.password = "admin%pass";
action.sshPort = 22.0;
action.url = "/data/imagestore";
action.name = "ImageStore";
action.importImages = false;
action.sessionId = "5171f258102a43368597dedd6317622b";
AddImageStoreBackupStorageAction.Result res = action.call();
Python SDK
AddImageStoreBackupStorageAction action = AddImageStoreBackupStorageAction()
action.hostname = "192.168.1.8"
action.username = "admin"
action.password = "admin%pass"
action.sshPort = 22.0
action.url = "/data/imagestore"
action.name = "ImageStore"
action.importImages = false
action.sessionId = "7b360d3775524a9780474b07ff68ed15"
AddImageStoreBackupStorageAction.Result res = action.call()

查询镜像仓库服务器(QueryImageStoreBackupStorage)

API请求

URLs
GET zstack/v1/backup-storage/image-store
GET zstack/v1/backup-storage/image-store/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth f3580612efa9402082b0b57447e3fbc9" \
-X GET http://localhost:8080/zstack/v1/backup-storage/image-store?q=uuid=5870d2edddff4ccc9f27a67e3a23391a
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 3831efab7c7a40ce88149e508f433169" \
-X GET http://localhost:8080/zstack/v1/backup-storage/image-store/3f326deb28fa4176964867d888b197a4

可查询字段

运行CLI命令行工具,输入QueryImageStoreBackupStorage并按Tab键查看所有可查询字段以及可跨表查询的资源名。

API返回

返回示例
{
  "inventories": [
    {
      "hostname": "127.0.0.1",
      "username": "zstack",
      "sshPort": 22.0,
      "uuid": "744dc382db7b3598af79246b67e45230",
      "name": "ImageStoreBS",
      "url": "/Cloud_bs",
      "description": "My ImageStore Backup Storage.",
      "totalCapacity": 1.099511627776E12,
      "availableCapacity": 5.49755813888E11,
      "type": "ImageStoreBackupStorage",
      "state": "Enabled",
      "status": "Connected",
      "createDate": "Nov 14, 2017 10:20:57 PM",
      "lastOpDate": "Nov 14, 2017 10:20:57 PM",
      "attachedZoneUuids": [
        "c3affca1fde2388691216e0f7884f515"
      ]
    }
  ]
}
名字 类型 描述 起始版本
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 0.6
inventories List 详情参考inventories 0.6
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 0.6
description String 错误的概要描述 0.6
details String 错误的详细信息 0.6
elaboration String 保留字段,默认为null 0.6
opaque LinkedHashMap 保留字段,默认为null 0.6
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 0.6
#inventories
名字 类型 描述 起始版本
hostname String 0.6
username String 0.6
sshPort Integer 0.6
uuid String 资源的UUID,唯一标示该资源 0.6
name String 资源名称 0.6
url String 0.6
description String 资源的详细描述 0.6
totalCapacity Long 0.6
availableCapacity Long 0.6
type String 0.6
state String 0.6
status String 0.6
createDate Timestamp 创建时间 0.6
lastOpDate Timestamp 最后一次修改时间 0.6
attachedZoneUuids List 0.6

SDK示例

Java SDK
QueryImageStoreBackupStorageAction action = new QueryImageStoreBackupStorageAction();
action.conditions = asList("uuid=d087b11dccd94ea8933ecc37b193fd50");
action.sessionId = "3b90553d582f4ec2aebfb8a384e4e447";
QueryImageStoreBackupStorageAction.Result res = action.call();
Python SDK
QueryImageStoreBackupStorageAction action = QueryImageStoreBackupStorageAction()
action.conditions = ["uuid=0c5b7c9cb2d84636aa2bbe20ce576ff8"]
action.sessionId = "89dbffa3dab64d5693b61cacce2d2268"
QueryImageStoreBackupStorageAction.Result res = action.call()

重连镜像仓库服务器(ReconnectImageStoreBackupStorage)

API请求

URLs
PUT zstack/v1/backup-storage/image-store/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
"reconnectImageStoreBackupStorage": {},
"systemTags": [],
"userTags": []
}
Note: 上述示例中systemTagsuserTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"reconnectImageStoreBackupStorage":{}}' \
http://localhost:8080/zstack/v1/backup-storage/image-store/a6d3a3c8a24b3f669fcecbb7bc6798ca/actions
参数列表
名字 类型 位置 描述 可选值 起始版本
uuid String url 镜像仓库服务器的UUID 1.6
systemTags (可选) List body(包含在params结构中) 系统标签 1.6
userTags (可选) List body(包含在params结构中) 用户标签 1.6

API返回

返回示例
{
"inventory": {
"name": "ImageStore",
"totalCapacity": 1.073741824E9,
"availableCapacity": 8.05306368E8,
"state": "Enabled",
"status": "Connected",
"attachedZoneUuids": [
"3b8b703c308741ec9a38411d003fdcbe"
    ]
  }
}
名字 类型 描述 起始版本
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 0.6
inventory ImageStoreBackupStorageInventory 详情参考inventory 0.6
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 0.6
description String 错误的概要描述 0.6
details String 错误的详细信息 0.6
elaboration String 保留字段,默认为null 0.6
opaque LinkedHashMap 保留字段,默认为null 0.6
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 0.6
#inventory
名字 类型 描述 起始版本
hostname String 0.6
username String 0.6
sshPort Integer 0.6
uuid String 资源的UUID,唯一标示该资源 0.6
name String 资源名称 0.6
url String 0.6
description String 资源的详细描述 0.6
totalCapacity Long 0.6
availableCapacity Long 0.6
type String 0.6
state String 0.6
status String 0.6
createDate Timestamp 创建时间 0.6
lastOpDate Timestamp 最后一次修改时间 0.6
attachedZoneUuids List 0.6

SDK示例

Java SDK
ReconnectImageStoreBackupStorageAction action = new ReconnectImageStoreBackupStorageAction();
action.uuid = "35f288ca1e2f4f719c4f284277f78545";
action.sessionId = "af42d38e4ccc499ea5ca72ea82beae11";
ReconnectImageStoreBackupStorageAction.Result res = action.call();
Python SDK
ReconnectImageStoreBackupStorageAction action = ReconnectImageStoreBackupStorageAction()
action.uuid = "751f52d7c74140119ca865261e30cafa"
action.sessionId = "075295f4c9fe45c185d1821e6c4d0f71"
ReconnectImageStoreBackupStorageAction.Result res = action.call()

更新镜像仓库服务器信息(UpdateImageStoreBackupStorage)

API请求

URLs
PUT zstack/v1/backup-storage/image-store/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
"updateImageStoreBackupStorage": {
"hostname": "192.168.1.18"
  },
"systemTags": [],
"userTags": []
}
Note: 上述示例中systemTagsuserTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateImageStoreBackupStorage":{"hostname":"192.168.1.18"}}' \
http://localhost:8080/zstack/v1/backup-storage/image-store/fa603f20ce2c370a8ba9d1928c3d6173/actions
参数列表
名字 类型 位置 描述 可选值 起始版本
username (可选) String body(包含在updateImageStoreBackupStorage结构中) SSH 用户名 (用于 Ansible 部署) 1.6
password (可选) String body(包含在updateImageStoreBackupStorage结构中) SSH 用户密码 1.6
hostname (可选) String body(包含在updateImageStoreBackupStorage结构中) 镜像服务器主机名 1.6
sshPort (可选) Integer body(包含在updateImageStoreBackupStorage结构中) SSH 端口号 1.6
uuid String url 镜像服务器的UUID 1.6
name (可选) String body(包含在updateImageStoreBackupStorage结构中) 镜像服务器的新名称 1.6
description (可选) String body(包含在updateImageStoreBackupStorage结构中) 镜像服务器的更新详细描述 1.6
systemTags (可选) List body(包含在updateImageStoreBackupStorage结构中) 系统标签 1.6
userTags (可选) List body(包含在updateImageStoreBackupStorage结构中) 用户标签 1.6

API返回

返回示例
{
"inventory": {
"name": "New Name",
"description": "Public Backup Storage",
"totalCapacity": 1.073741824E9,
"availableCapacity": 9.68884224E8,
"type": "Ceph",
"state": "Enabled",
"status": "Connected",
"createDate": "Jun 7, 2017 9:20:12 PM",
"lastOpDate": "Jun 7, 2017 9:20:12 PM",
"attachedZoneUuids": [
"7c99892d8d5542faae4d1dd7d17be252"
    ]
  }
}
名字 类型 描述 起始版本
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 0.6
inventory BackupStorageInventory 详情参考inventory 0.6
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 0.6
description String 错误的概要描述 0.6
details String 错误的详细信息 0.6
elaboration String 保留字段,默认为null 0.6
opaque LinkedHashMap 保留字段,默认为null 0.6
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 0.6
#inventory
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 0.6
name String 资源名称 0.6
url String 0.6
description String 资源的详细描述 0.6
totalCapacity Long 0.6
availableCapacity Long 0.6
type String 0.6
state String 0.6
status String 0.6
createDate Timestamp 创建时间 0.6
lastOpDate Timestamp 最后一次修改时间 0.6
attachedZoneUuids List 0.6

SDK示例

Java SDK
UpdateImageStoreBackupStorageAction action = new UpdateImageStoreBackupStorageAction();
action.hostname = "192.168.1.18";
action.uuid = "b7220dfd8c604483819df54af3e2e5df";
action.sessionId = "d9f658720aa84cc190cb26f84b4a9137";
UpdateImageStoreBackupStorageAction.Result res = action.call();
Python SDK
UpdateImageStoreBackupStorageAction action = UpdateImageStoreBackupStorageAction()
action.hostname = "192.168.1.18"
action.uuid = "9cf8df2338b9497d886ccb49dfb4278c"
action.sessionId = "4b8bc0b578ca4da1bb5baf1802480de2"
UpdateImageStoreBackupStorageAction.Result res = action.call()

从镜像仓库回收磁盘空间(ReclaimSpaceFromImageStore)

API请求

URLs
PUT zstack/v1/backup-storage/image-store/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
"reclaimSpaceFromImageStore": {},
"systemTags": [],
"userTags": []
}
Note: 上述示例中systemTagsuserTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"reclaimSpaceFromImageStore":{}}' \
http://localhost:8080/zstack/v1/backup-storage/image-store/ec74c4664f52342e898fb0fa966d915e/actions
参数列表
名字 类型 位置 描述 可选值 起始版本
uuid String url 镜像仓库的UUID,唯一标示该资源 1.10
systemTags (可选) List body(包含在params结构中) 系统标签 1.10
userTags (可选) List body(包含在params结构中) 用户标签 1.10

API返回

该API成功时返回一个空的JSON结构{},出错时返回的JSON结构包含一个error字段,例如:
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
    }
}

SDK示例

Java SDK
ReclaimSpaceFromImageStoreAction action = new ReclaimSpaceFromImageStoreAction();
action.uuid = "1dbdc3a4c7cd47d288f6c71116ae5b1f";
action.sessionId = "2e4a160b40b64fb4a9faa04829000d68";
ReclaimSpaceFromImageStoreAction.Result res = action.call();
Python SDK
ReclaimSpaceFromImageStoreAction action = ReclaimSpaceFromImageStoreAction()
action.uuid = "713fa4965e6f4f70aeb1c96cd9d959ef"
action.sessionId = "87839a65f127443093bc708bcdaf3b0c"
ReclaimSpaceFromImageStoreAction.Result res = action.call()

Ceph镜像服务器相关接口

添加Ceph镜像服务器(AddCephBackupStorage)

API请求

URLs
POST zstack/v1/backup-storage/ceph
Headers
Authorization: OAuth the-session-uuid
Body
{
"params": {
"monUrls": [
"10.0.1.2"
    ],
"poolName": "zs-images",
"name": "My Ceph Backup Storage",
"importImages": false
  },
"systemTags": [],
"userTags": []
}
Note: 上述示例中systemTagsuserTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"monUrls":["10.0.1.2"],"poolName":"zs-images","name":"My Ceph Backup Storage","importImages":false}}' \
http://localhost:8080/zstack/v1/backup-storage/ceph
参数列表
名字 类型 位置 描述 可选值 起始版本
monUrls List body(包含在params结构中) Ceph mon 的地址列表 0.6
poolName (可选) String body(包含在params结构中) 用于存放镜像的 Ceph pool 的名字 0.6
url String body(包含在params结构中) 未使用 0.6
name String body(包含在params结构中) 镜像服务器名字 0.6
description (可选) String body(包含在params结构中) 镜像服务器的详细描述 0.6
type (可选) String body(包含在params结构中) 镜像服务器的类型,此处为 Ceph 0.6
importImages (可选) boolean body(包含在params结构中) 添加后是否导入镜像 1.9
resourceUuid (可选) String body(包含在params结构中) 资源UUID。若指定,镜像服务器会使用该字段值作为UUID。 0.6
systemTags (可选) List body 系统标签 0.6
userTags (可选) List body 用户标签 0.6

API返回

返回示例
{
"inventory": {
"name": "My Backup Storage",
"description": "Public Backup Storage",
"totalCapacity": 1.073741824E9,
"availableCapacity": 9.68884224E8,
"type": "Ceph",
"state": "Enabled",
"status": "Connected",
"createDate": "Jun 7, 2017 9:20:17 PM",
"lastOpDate": "Jun 7, 2017 9:20:17 PM",
"attachedZoneUuids": [
"812bb731a83847ffba9d8caa3a4633d2"
    ]
  }
}
名字 类型 描述 起始版本
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 0.6
inventory BackupStorageInventory 详情参考inventory 0.6
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 0.6
description String 错误的概要描述 0.6
details String 错误的详细信息 0.6
elaboration String 保留字段,默认为null 0.6
opaque LinkedHashMap 保留字段,默认为null 0.6
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 0.6
#inventory
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 0.6
name String 资源名称 0.6
url String 0.6
description String 资源的详细描述 0.6
totalCapacity Long 0.6
availableCapacity Long 0.6
type String 0.6
state String 0.6
status String 0.6
createDate Timestamp 创建时间 0.6
lastOpDate Timestamp 最后一次修改时间 0.6
attachedZoneUuids List 0.6

SDK示例

Java SDK
AddCephBackupStorageAction action = new AddCephBackupStorageAction();
action.monUrls = asList("10.0.1.2");
action.poolName = "zs-images";
action.name = "My Ceph Backup Storage";
action.importImages = false;
action.sessionId = "a6df67e34a4840a38f6cdb1f5fdeeaa9";
AddCephBackupStorageAction.Result res = action.call();
Python SDK
AddCephBackupStorageAction action = AddCephBackupStorageAction()
action.monUrls = [10.0.1.2]
action.poolName = "zs-images"
action.name = "My Ceph Backup Storage"
action.importImages = false
action.sessionId = "fb435a60b1a84c3e82fd9dc90d933b39"
AddCephBackupStorageAction.Result res = action.call()

查询Ceph镜像服务器(QueryCephBackupStorage)

API请求

URLs
GET zstack/v1/backup-storage/ceph
GET zstack/v1/backup-storage/ceph/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth d380f3382f294e7bac14527b517d0c49" \
-X GET http://localhost:8080/zstack/v1/backup-storage/ceph?q=uuid=005420eeec6c4a6292939ea7fa8a954b
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 0aab3ffc9f9c49fba1932c9f2cf38434" \\
-X GET http://localhost:8080/zstack/v1/backup-storage/ceph/3e3c2f5e4f5d476ba1ef8e5ba42be06b

可查询字段

运行CLI命令行工具,输入QueryCephBackupStorage并按Tab键查看所有可查询字段以及可跨表查询的资源名。

API返回

返回示例
{
"inventories": [
    {
"name": "My Backup Storage",
"description": "Public Backup Storage",
"totalCapacity": 1.073741824E9,
"availableCapacity": 9.68884224E8,
"type": "Ceph",
"state": "Enabled",
"status": "Connected",
"createDate": "Jun 7, 2017 9:21:12 PM",
"lastOpDate": "Jun 7, 2017 9:21:12 PM",
"attachedZoneUuids": [
"1613a61a681b4d7790ffc1d2bd2870d3"
      ]
    }
  ]
}
名字 类型 描述 起始版本
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 0.6
inventories List 详情参考inventories 0.6
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 0.6
description String 错误的概要描述 0.6
details String 错误的详细信息 0.6
elaboration String 保留字段,默认为null 0.6
opaque LinkedHashMap 保留字段,默认为null 0.6
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 0.6
#inventories
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 0.6
name String 资源名称 0.6
url String 0.6
description String 资源的详细描述 0.6
totalCapacity Long 0.6
availableCapacity Long 0.6
type String 0.6
state String 0.6
status String 0.6
createDate Timestamp 创建时间 0.6
lastOpDate Timestamp 最后一次修改时间 0.6
attachedZoneUuids List 0.6

SDK示例

Java SDK
QueryCephBackupStorageAction action = new QueryCephBackupStorageAction();
action.conditions = asList("uuid=fd7807cb1d744273bf8632362f2095aa");
action.sessionId = "940c1b37499e4e3c831625717ddb1c8f";
QueryCephBackupStorageAction.Result res = action.call();
Python SDK
QueryCephBackupStorageAction action = QueryCephBackupStorageAction()
action.conditions = ["uuid=2c8474f249234365993ba771e4b495ba"]
action.sessionId = "2b7bb843955e4574b8ca8862d0223f8d"
QueryCephBackupStorageAction.Result res = action.call()

更新Ceph镜像服务器mon节点(UpdateCephBackupStorageMon)

API请求

URLs
PUT zstack/v1/backup-storage/ceph/mons/{monUuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
"updateCephBackupStorageMon": {
"hostname": "10.0.1.4"
  },
"systemTags": [],
"userTags": []
}
Note: 上述示例中systemTagsuserTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateCephBackupStorageMon":{"hostname":"10.0.1.4"}}' \
http://localhost:8080/zstack/v1/backup-storage/ceph/mons/c239e1d3164b3383bd12828632f706d6/actions
参数列表
名字 类型 位置 描述 可选值 起始版本
monUuid String url mon节点UUID 0.6
hostname (可选) String body(包含在updateCephBackupStorageMon结构中) mon节点新主机IP地址 0.6
sshUsername (可选) String body(包含在updateCephBackupStorageMon结构中) mon节点主机 ssh 用户名 0.6
sshPassword (可选) String body(包含在updateCephBackupStorageMon结构中) mon节点主机 ssh 用户密码 0.6
sshPort (可选) Integer body(包含在updateCephBackupStorageMon结构中) mon节点主机 ssh 端口 0.6
monPort (可选) Integer body(包含在updateCephBackupStorageMon结构中) mon节点的端口 0.6
systemTags (可选) List body 系统标签 0.6
userTags (可选) List body 用户标签 0.6

API返回

返回示例
{
"inventory": {
"mons": [
      {
"monAddr": "10.0.1.4",
"monUuid": "e1fd732039e64d3bb81d779cdea2e0e1"
      }
    ],
"name": "My Ceph Backup Storage",
"description": "Public Ceph Backup Storage",
"totalCapacity": 1.073741824E9,
"availableCapacity": 9.68884224E8,
"type": "Ceph",
"state": "Enabled",
"status": "Connected",
"createDate": "Jun 7, 2017 9:20:08 PM",
"lastOpDate": "Jun 7, 2017 9:20:08 PM",
"attachedZoneUuids": [
"073a93204ff54164af04748a7c2697c6"
    ]
  }
}
名字 类型 描述 起始版本
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 0.6
inventory CephBackupStorageInventory 详情参考inventory 0.6
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 0.6
description String 错误的概要描述 0.6
details String 错误的详细信息 0.6
elaboration String 保留字段,默认为null 0.6
opaque LinkedHashMap 保留字段,默认为null 0.6
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 0.6
#inventory
名字 类型 描述 起始版本
fsid String 0.6
poolName String 0.6
uuid String 资源的UUID,唯一标示该资源 0.6
name String 资源名称 0.6
url String 0.6
description String 资源的详细描述 0.6
totalCapacity Long 0.6
availableCapacity Long 0.6
type String 0.6
state String 0.6
status String 0.6
createDate Timestamp 创建时间 0.6
lastOpDate Timestamp 最后一次修改时间 0.6
attachedZoneUuids List 0.6
poolUsedCapacity Long 2.3.2
poolReplicatedSize Integer 2.3.2

poolAvailableCapacity

Long 2.3.2
mons List 详情参考mons 0.6
#mons
名字 类型 描述 起始版本
hostname String 0.6
monPort Integer 0.6
createDate Timestamp 创建时间 0.6
lastOpDate Timestamp 最后一次修改时间 0.6
backupStorageUuid String 镜像存储UUID 0.6
monAddr String 0.6
sshPort Integer 0.6
status String 0.6
sshUsername String 0.6
sshPassword String 0.6
monUuid String 0.6

SDK示例

Java SDK
UpdateCephBackupStorageMonAction action = new UpdateCephBackupStorageMonAction();
action.monUuid = "84b6fb1a92354d7081ac68d49c2c8346";
action.hostname = "10.0.1.4";
action.sessionId = "7012077b892a4102a98bc1a6a10b1b4f";
UpdateCephBackupStorageMonAction.Result res = action.call();
Python SDK
UpdateCephBackupStorageMonAction action = UpdateCephBackupStorageMonAction()
action.monUuid = "622aa943b0204bf3a6c44e63321823f4"
action.hostname = "10.0.1.4"
action.sessionId = "5958f913a1464da58e1be33de69d470b"
UpdateCephBackupStorageMonAction.Result res = action.call()

Ceph镜像服务器添加mon节点(AddMonToCephBackupStorage)

API请求

URLs
DELETE zstack/v1/backup-storage/ceph/{uuid}/mons
Headers
Authorization: OAuth the-session-uuid
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"monUrls":["10.0.1.3"]}}' \
http://localhost:8080/zstack/v1/backup-storage/ceph/5229b4e9acf934e1a80337a8090d72d1/mons
参数列表
名字 类型 位置 描述 可选值 起始版本
uuid String url Ceph镜像服务器的UUID 0.6
monUrls List body mon节点名字列表 0.6
systemTags (可选) List body 系统标签 0.6
userTags (可选) List body 用户标签 0.6

API返回

返回示例
{
"inventory": {
"mons": [
      {
"monAddr": "10.0.1.2",
"monUuid": "d79571a057c94c41b0fad2ca688a6cec"
      }
    ],
"name": "My Ceph Backup Storage",
"description": "Public Ceph Backup Storage",
"totalCapacity": 1.073741824E9,
"availableCapacity": 9.68884224E8,
"type": "Ceph",
"state": "Enabled",
"status": "Connected",
"createDate": "Jun 7, 2017 9:20:30 PM",
"lastOpDate": "Jun 7, 2017 9:20:30 PM",
"attachedZoneUuids": [
"4fd92cde485a4225b97c86846c9f586c"
    ]
  }
}
名字 类型 描述 起始版本
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 0.6
inventory CephBackupStorageInventory 详情参考inventory 0.6
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 0.6
description String 错误的概要描述 0.6
details String 错误的详细信息 0.6
elaboration String 保留字段,默认为null 0.6
opaque LinkedHashMap 保留字段,默认为null 0.6
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 0.6
#inventory
名字 类型 描述 起始版本
fsid String 0.6
poolName String 0.6
uuid String 资源的UUID,唯一标示该资源 0.6
name String 资源名称 0.6
url String 0.6
description String 资源的详细描述 0.6
totalCapacity Long 0.6
availableCapacity Long 0.6
type String 0.6
state String 0.6
status String 0.6
createDate Timestamp 创建时间 0.6
lastOpDate Timestamp 最后一次修改时间 0.6
attachedZoneUuids List 0.6

poolAvailableCapacity

Long 2.3.2
poolUsedCapacity Long 2.3.2
poolReplicatedSize Integer 2.3.2
mons List 详情参考mons 0.6
#mons
名字 类型 描述 起始版本
hostname String 0.6
monPort Integer 0.6
createDate Timestamp 创建时间 0.6
lastOpDate Timestamp 最后一次修改时间 0.6
backupStorageUuid String 镜像存储UUID 0.6
monAddr String 0.6
sshPort Integer 0.6
status String 0.6
sshUsername String 0.6
sshPassword String 0.6
monUuid String 0.6

SDK示例

Java SDK
RemoveMonFromCephBackupStorageAction action = new RemoveMonFromCephBackupStorageAction();
action.uuid = "728cc9123a694a39a9e1915d9e50ee9f";
action.monHostnames = asList("10.0.1.2");
action.sessionId = "e12938edf7634fcebba3938d07acde47";
RemoveMonFromCephBackupStorageAction.Result res = action.call();
Python SDK
RemoveMonFromCephBackupStorageAction action = RemoveMonFromCephBackupStorageAction()
action.uuid = "eede3cd9cbca4b3289e92a976619b67d"
action.monHostnames = [10.0.1.2]
action.sessionId = "fb2ddd76c26f43729fe5346e196c8532"
RemoveMonFromCephBackupStorageAction.Result res = action.call()

Ceph镜像服务器删除mon节点(RemoveMonFromCephBackupStorage)

API请求

URLs
DELETE zstack/v1/backup-storage/ceph/{uuid}/mons?monHostnames={monHostnames}
Headers
Authorization: OAuth the-session-uuid
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 861c8d1f7c6c483fbde2a23f8e846e4a" \
-X DELETE http://localhost:8080/zstack/v1/backup-storage/ceph/3a6bd95933784fc49717392356cb67f3/mons?monHostnames=10.0.1.2
参数列表
名字 类型 位置 描述 可选值 起始版本
uuid String url Ceph镜像服务器的UUID 0.6
monHostnames List body mon节点名字列表 0.6
systemTags (可选) List body 系统标签 0.6
userTags (可选) List body 用户标签 0.6

API返回

返回示例
{
"inventory": {
"mons": [
      {
"monAddr": "10.0.1.2",
"monUuid": "d79571a057c94c41b0fad2ca688a6cec"
      }
    ],
"name": "My Ceph Backup Storage",
"description": "Public Ceph Backup Storage",
"totalCapacity": 1.073741824E9,
"availableCapacity": 9.68884224E8,
"type": "Ceph",
"state": "Enabled",
"status": "Connected",
"createDate": "Jun 7, 2017 9:20:30 PM",
"lastOpDate": "Jun 7, 2017 9:20:30 PM",
"attachedZoneUuids": [
"4fd92cde485a4225b97c86846c9f586c"
    ]
  }
}
名字 类型 描述 起始版本
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 0.6
inventory CephBackupStorageInventory 详情参考inventory 0.6
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 0.6
description String 错误的概要描述 0.6
details String 错误的详细信息 0.6
elaboration String 保留字段,默认为null 0.6
opaque LinkedHashMap 保留字段,默认为null 0.6
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 0.6
#inventory
名字 类型 描述 起始版本
fsid String 0.6
poolName String 0.6
uuid String 资源的UUID,唯一标示该资源 0.6
name String 资源名称 0.6
url String 0.6
description String 资源的详细描述 0.6
totalCapacity Long 0.6
availableCapacity Long 0.6
type String 0.6
state String 0.6
status String 0.6
createDate Timestamp 创建时间 0.6
lastOpDate Timestamp 最后一次修改时间 0.6
attachedZoneUuids List 0.6
poolUsedCapacity Long 2.3.2
poolReplicatedSize Integer 2.3.2

poolAvailableCapacity

Long 2.3.2
mons List 详情参考mons 0.6
#mons
名字 类型 描述 起始版本
hostname String 0.6
monPort Integer 0.6
createDate Timestamp 创建时间 0.6
lastOpDate Timestamp 最后一次修改时间 0.6
backupStorageUuid String 镜像存储UUID 0.6
monAddr String 0.6
sshPort Integer 0.6
status String 0.6
sshUsername String 0.6
sshPassword String 0.6
monUuid String 0.6

SDK示例

Java SDK
RemoveMonFromCephBackupStorageAction action = new RemoveMonFromCephBackupStorageAction();
action.uuid = "728cc9123a694a39a9e1915d9e50ee9f";
action.monHostnames = asList("10.0.1.2");
action.sessionId = "e12938edf7634fcebba3938d07acde47";
RemoveMonFromCephBackupStorageAction.Result res = action.call();
Python SDK
RemoveMonFromCephBackupStorageAction action = RemoveMonFromCephBackupStorageAction()
action.uuid = "eede3cd9cbca4b3289e92a976619b67d"
action.monHostnames = [10.0.1.2]
action.sessionId = "fb2ddd76c26f43729fe5346e196c8532"
RemoveMonFromCephBackupStorageAction.Result res = action.call()
开发手册 | 4.8.38 | ZStack Cloud · ZCF | ZStack 资源中心