文档目录

Ceph主存储相关接口

添加Ceph主存储(AddCephPrimaryStorage)

API请求

URLs
POST zstack/v1/primary-storage/ceph
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "monUrls": [
      "root:password@localhost/?monPort\u003d7777"
    ],
    "rootVolumePoolName": "zs-images",
    "dataVolumePoolName": "zs-data-volume",
    "imageCachePoolName": "zs-image-cache",
    "name": "My Ceph Primary Storage",
    "zoneUuid": "d42197a462c34a44989bdf38d5aa2424"
  },
  "systemTags": [],
  "userTags": []
}
Note: 上述示例中systemTagsuserTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"monUrls":["root:password@localhost/?monPort=7777"],"rootVolumePoolName":"zs-images","dataVolumePoolName":"zs-data-volume","imageCachePoolName":"zs-image-cache","name":"My Ceph Primary Storage","zoneUuid":"251a3dffccaf39fc8d190eedcf4395bf"}}' \
http://localhost:8080/zstack/v1/primary-storage/ceph
参数列表
名字 类型 位置 描述 可选值 起始版本
monUrls List body(包含在params结构中) Ceph mon 的地址列表 0.6
rootVolumePoolName (可选) String body(包含在params结构中) 指定 Root Volume 可使用的 Ceph pool 名字 0.6
dataVolumePoolName (可选) String body(包含在params结构中) 指定 Data Volume 可使用的 Ceph pool 名字 0.6
imageCachePoolName (可选) String body(包含在params结构中) 指定镜像缓存可使用的 Ceph pool 名字 0.6
url String body(包含在params结构中) 未使用 0.6
name String body(包含在params结构中) Ceph 主存储的名称 0.6
description (可选) String body(包含在params结构中) Ceph 主存储的详细描述 0.6
type (可选) String body(包含在params结构中) Ceph 主存储的类型,此处为 Ceph 0.6
zoneUuid String body(包含在params结构中) 区域UUID 0.6
resourceUuid (可选) String body(包含在params结构中) 资源UUID。若指定,Ceph 主存储会使用该字段值作为UUID。 0.6
systemTags (可选) List body 系统标签 0.6
userTags (可选) List body 用户标签 0.6
Note:
  • ZStack Cloud添加Ceph主存储时支持标识Ceph的类型为xsky、sandstone、或open-source,SystemTags增加manufacturer选项。
    • 选项格式为:ceph::manufacturer::Platform
    • 例如:ceph::manufacturer::xsky
  • ZStack Cloud添加Ceph主存储时支持标识Ceph的类型为xsky,且支持调用xksy类型Ceph主存储的SDK,SystemTags增加thirdPartyPlatform选项。
    • 选项格式为:ceph::thirdPartyPlatform::TOKEN
    • 例如:ceph::thirdPartyPlatform::68b329da9893e34099c7d8ad5cb9c940

API返回

返回示例
{
  "inventory": {
    "name": "Ceph-1",
    "url": "not used",
    "type": "Ceph",
    "state": "Enabled",
    "status": "Connected",
    "attachedClusterUuids": [
      "2d8583d86bd1472e8ec0e04e26ea273f"
    ]
  }
}
名字 类型 描述 起始版本
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 0.6
inventory PrimaryStorageInventory 详情参考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
zoneUuid String 区域UUID 0.6
name String 资源名称 0.6
url String 0.6
description String 资源的详细描述 0.6
totalCapacity Long 0.6
availableCapacity Long 0.6
totalPhysicalCapacity Long 0.6
availablePhysicalCapacity Long 0.6
systemUsedCapacity Long 0.6
type String 0.6
state String 0.6
status String 0.6
mountPath String 0.6
createDate Timestamp 创建时间 0.6
lastOpDate Timestamp 最后一次修改时间 0.6
attachedClusterUuids List 0.6

SDK示例

Java SDK
AddCephPrimaryStorageAction action = new AddCephPrimaryStorageAction();
action.monUrls = asList("root:password@localhost/?monPort=7777");
action.rootVolumePoolName = "zs-images";
action.dataVolumePoolName = "zs-data-volume";
action.imageCachePoolName = "zs-image-cache";
action.name = "My Ceph Primary Storage";
action.zoneUuid = "88b49879acd34e11afa5bb3ea9164d5a";
action.sessionId = "33a01ee65ac64450940359dc3181f9b1";
AddCephPrimaryStorageAction.Result res = action.call();
Python SDK
AddCephPrimaryStorageAction action = AddCephPrimaryStorageAction()
action.monUrls = [root:password@localhost/?monPort=7777]
action.rootVolumePoolName = "zs-images"
action.dataVolumePoolName = "zs-data-volume"
action.imageCachePoolName = "zs-image-cache"
action.name = "My Ceph Primary Storage"
action.zoneUuid = "0f05052514554462b437f9cfa272f57f"
action.sessionId = "cb3d5ecb63634ca093ea223c55e6a30a"
AddCephPrimaryStorageAction.Result res = action.call()

查询Ceph主存储(QueryCephPrimaryStorage)

API请求

URLs
GET zstack/v1/primary-storage/ceph
GET zstack/v1/primary-storage/ceph/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 9b17423dbac84ff4ace2e0d5f4d9e0d2" \
-X GET http://localhost:8080/zstack/v1/primary-storage/ceph?q=uuid=c7b3cbd9ae3e44bb9536728191761cb3
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth c0e6df86e0b34164b3e0471d7b0cdcb4" \
-X GET http://localhost:8080/zstack/v1/primary-storage/ceph/1ffb7b09c405477b95563abfcad506a0

可查询字段

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

API返回

返回示例
{
  "inventories": [
    {
      "name": "Ceph-1",
      "url": "not used",
      "type": "Ceph",
      "state": "Enabled",
      "status": "Connected",
      "attachedClusterUuids": [
        "1b70bb2e338f4a278b9efadda42ad26f"
      ]
    }
  ]
}
名字 类型 描述 起始版本
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
zoneUuid String 区域UUID 0.6
name String 资源名称 0.6
url String 0.6
description String 资源的详细描述 0.6
totalCapacity Long 0.6
availableCapacity Long 0.6
totalPhysicalCapacity Long 0.6
availablePhysicalCapacity Long 0.6
systemUsedCapacity Long 0.6
type String 0.6
state String 0.6
status String 0.6
mountPath String 0.6
createDate Timestamp 创建时间 0.6
lastOpDate Timestamp 最后一次修改时间 0.6
attachedClusterUuids List 0.6

SDK示例

Java SDK
QueryCephPrimaryStorageAction action = new QueryCephPrimaryStorageAction();
action.conditions = asList("uuid=d351d433b5974116a4c9649ef5b89e64");
action.sessionId = "172c3d6b977b4cbfbd401ace20ad0442";
QueryCephPrimaryStorageAction.Result res = action.call();
Python SDK
QueryCephPrimaryStorageAction action = QueryCephPrimaryStorageAction()
action.conditions = ["uuid=aa79df396a4943f8b9066c4d8057565d"]
action.sessionId = "0aca367c9e7946d29a63044684d5dd71"
QueryCephPrimaryStorageAction.Result res = action.call()

为Ceph主存储添加mon节点(AddMonToCephPrimaryStorage)

API请求

URLs
POST zstack/v1/primary-storage/ceph/{uuid}/mons
Headers
Authorization: OAuth the-session-uuid
Body
{
"params": {
"monUrls": [
"10.0.1.3"
    ]
  },
"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.3"]}}' \
http://localhost:8080/zstack/v1/primary-storage/ceph/6496e4b29793368dbacf388d83446acc/mons
参数列表
名字 类型 位置 描述 可选值 起始版本
uuid String url Ceph 主存储的UUID 0.6
monUrls List body(包含在params结构中) mon 节点地址列表 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
AddMonToCephPrimaryStorageAction action = new AddMonToCephPrimaryStorageAction();
action.uuid = "d0e3946e312a40c6af85da9163ac2519";
action.monUrls = asList("10.0.1.3");
action.sessionId = "6033eea9a2514c078c7af2a709ead405";
AddMonToCephPrimaryStorageAction.Result res = action.call();
Python SDK
AddMonToCephPrimaryStorageAction action = AddMonToCephPrimaryStorageAction()
action.uuid = "6b631b40a3fa434785a8b0bd49a3f199"
action.monUrls = [10.0.1.3]
action.sessionId = "c455c88362f84aa7acd07bd5f6d3a4d3"
AddMonToCephPrimaryStorageAction.Result res = action.call()

从Ceph主存储删除mon节点(RemoveMonFromCephPrimaryStorage)

API请求

URLs
DELETE/v1/primary-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 b57c6816e9b64ae881a356f9308bb6c7" \
-X DELETE http://localhost:8080/zstack/v1/primary-storage/ceph/31db2011f3944c85ae24a7ca607302e5/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": "c72a3fc6e06649de811bf90ba8c9c574"
      }
    ],
"name": "My Ceph Primary Storage",
"description": "Public Ceph Primary Storage",
"totalCapacity": 1.073741824E9,
"availableCapacity": 9.68884224E8,
"type": "Ceph",
"state": "Enabled",
"status": "Connected",
"createDate": "Jun 7, 2017 9:21:07 PM",
"lastOpDate": "Jun 7, 2017 9:21:07 PM",
"attachedClusterUuids": [
"c0f667d99bfc41c1a133528a2089a9a7"
    ]
  }
}
名字 类型 描述 起始版本
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 0.6
inventory CephPrimaryStorageInventory 详情参考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
rootVolumePoolName String 0.6
dataVolumePoolName String 0.6
imageCachePoolName String 0.6
uuid String 资源的UUID,唯一标示该资源 0.6
zoneUuid String 区域UUID 0.6
name String 资源名称 0.6
url String 0.6
description String 资源的详细描述 0.6
totalCapacity Long 0.6
availableCapacity Long 0.6
totalPhysicalCapacity Long 0.6
availablePhysicalCapacity Long 0.6
systemUsedCapacity Long 0.6
type String 0.6
state String 0.6
status String 0.6
mountPath String 0.6
createDate Timestamp 创建时间 0.6
lastOpDate Timestamp 最后一次修改时间 0.6
attachedClusterUuids List 0.6
mons List 详情参考mons 0.6
#mons
名字 类型 描述 起始版本
hostname String 0.6
monPort Integer 0.6
createDate Timestamp 创建时间 0.6
lastOpDate Timestamp 最后一次修改时间 0.6
primaryStorageUuid String 主存储UUID 0.6
monAddr String 0.6
sshUsername String 0.6
sshPassword String 0.6
sshPort Integer 0.6
status String 0.6
monUuid String 0.6

SDK示例

Java SDK
RemoveMonFromCephPrimaryStorageAction action = new RemoveMonFromCephPrimaryStorageAction();
action.uuid = "05aa4826fdbd4021b72e4d9a5db67bbc";
action.monHostnames = asList("10.0.1.2");
action.sessionId = "2412a720a3bb4992887979298217b300";
RemoveMonFromCephPrimaryStorageAction.Result res = action.call();
Python SDK
RemoveMonFromCephPrimaryStorageAction action = RemoveMonFromCephPrimaryStorageAction()
action.uuid = "fb3dca5509154ca48698f374794f4d93"
action.monHostnames = [10.0.1.2]
action.sessionId = "9eb682deaa894cea80e1608056492948"
RemoveMonFromCephPrimaryStorageAction.Result res = action.call()

更新Ceph主存储mon节点(UpdateCephPrimaryStorageMon)

API请求

URLs
PUT zstack/v1/primary-storage/ceph/mons/{monUuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
"updateCephPrimaryStorageMon": {
"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 '{"updateCephPrimaryStorageMon":{"hostname":"10.0.1.4"}}' \
http://localhost:8080/zstack/v1/primary-storage/ceph/mons/cda8b731b2e23b8eb1081dec0f7a0a60/actions
参数列表
名字 类型 位置 描述 可选值 起始版本
monUuid String url mon节点UUID 0.6
hostname (可选) String body(包含在updateCephPrimaryStorageMon结构中) mon节点新主机IP地址 0.6
sshUsername (可选) String body(包含在updateCephPrimaryStorageMon结构中) mon节点主机 ssh 用户名 0.6
sshPassword (可选) String body(包含在updateCephPrimaryStorageMon结构中) mon节点主机 ssh 用户密码 0.6
sshPort (可选) Integer body(包含在updateCephPrimaryStorageMon结构中) mon节点主机 ssh 端口 0.6
monPort (可选) Integer body(包含在updateCephPrimaryStorageMon结构中) mon的新端口 0.6
systemTags (可选) List body 系统标签 0.6
userTags (可选) List body 用户标签 0.6

API返回

返回示例
{
"inventory": {
"mons": [
      {
"monAddr": "10.0.1.4",
"monUuid": "d557e48870b04ef699509d2998084bdb"
      }
    ],
"name": "My Ceph Primary Storage",
"description": "Public Ceph Primary Storage",
"totalCapacity": 1.073741824E9,
"availableCapacity": 9.68884224E8,
"type": "Ceph",
"state": "Enabled",
"status": "Connected",
"createDate": "Jun 7, 2017 9:21:22 PM",
"lastOpDate": "Jun 7, 2017 9:21:22 PM",
"attachedClusterUuids": [
"3fa1f7c2bbb544e1a04ba9f9da935abe"
    ]
  }
}
名字 类型 描述 起始版本
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 0.6
inventory CephPrimaryStorageInventory 详情参考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
rootVolumePoolName String 0.6
dataVolumePoolName String 0.6
imageCachePoolName String 0.6
uuid String 资源的UUID,唯一标示该资源 0.6
zoneUuid String 区域UUID 0.6
name String 资源名称 0.6
url String 0.6
description String 资源的详细描述 0.6
totalCapacity Long 0.6
availableCapacity Long 0.6
totalPhysicalCapacity Long 0.6
availablePhysicalCapacity Long 0.6
systemUsedCapacity Long 0.6
type String 0.6
state String 0.6
status String 0.6
mountPath String 0.6
createDate Timestamp 创建时间 0.6
lastOpDate Timestamp 最后一次修改时间 0.6
attachedClusterUuids List 0.6
mons List 详情参考mons 0.6
#mons
名字 类型 描述 起始版本
hostname String 0.6
monPort Integer 0.6
createDate Timestamp 创建时间 0.6
lastOpDate Timestamp 最后一次修改时间 0.6
primaryStorageUuid String 主存储UUID 0.6
monAddr String 0.6
sshUsername String 0.6
sshPassword String 0.6
sshPort Integer 0.6
status String 0.6
monUuid String 0.6

SDK示例

Java SDK
UpdateCephPrimaryStorageMonAction action = new UpdateCephPrimaryStorageMonAction();
action.monUuid = "3341eaef160045d6b6fd085a22a3c69f";
action.hostname = "10.0.1.4";
action.sessionId = "359aceecda5e478e81d4eaea9e86bca8";
UpdateCephPrimaryStorageMonAction.Result res = action.call();
Python SDK
UpdateCephPrimaryStorageMonAction action = UpdateCephPrimaryStorageMonAction()
action.monUuid = "70bc5237403848f6b5b6a60079c3ab91"
action.hostname = "10.0.1.4"
action.sessionId = "b1737cdb77c4420ba72aab66c4438521"
UpdateCephPrimaryStorageMonAction.Result res = action.call()

添加Ceph主存储池(AddCephPrimaryStoragePool)

API请求

URLs
POST zstack/v1/primary-storage/ceph/{primaryStorageUuid}/pools
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "poolName": "highPerformance",
    "aliasName": "alias pool name",
    "description": "for high performance data volumes",
    "isCreate": true
    "type": "ROOT
  },
  "systemTags": [],
  "userTags": []
}
Note: 上述示例中systemTagsuserTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"poolName":"highPerformance","aliasName":"alias pool name","description":"for high performance data volumes","isCreate":true,"type":"Root"}}' http://localhost:8080/zstack/v1/primary-storage/ceph/fe5adfa6042b33cd8ee7b5bcd994245f/pools
参数列表
名字 类型 位置 描述 可选值 起始版本
primaryStorageUuid String url 主存储UUID 0.6
poolName String body(包含在params结构中) 0.6
aliasName (可选) String body(包含在params结构中) 0.6
description (可选) String body(包含在params结构中) 资源的详细描述 0.6
isCreate (可选) boolean body(包含在params结构中) 0.6
type String body(包含在params结构中) 存储池类型 3.1.1
resourceUuid (可选) String body(包含在params结构中) 0.6
systemTags (可选) List body 0.6
userTags (可选) List body 0.6

API返回

返回示例
{
  "inventory": {
    "uuid": "97ac9dc5fc223f80918747a8a398478b",
    "primaryStorageUuid": "82b127a3f6cc3ec7bd7ff01069310099",
    "poolName": "pool name",
    "aliasName": "alias name",
    "description": "description",
    "createDate": "Nov 14, 2017 10:20:57 PM",
    "lastOpDate": "Nov 14, 2017 10:20:57 PM",
    "type": "Data"
  }
}
名字 类型 描述 起始版本
success boolean 0.6
error ErrorCode 详情参考error 0.6
inventory CephPrimaryStoragePoolInventory 详情参考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
primaryStorageUuid String 主存储UUID 0.6
poolName String 0.6
aliasName String 0.6
description String 资源的详细描述 0.6
createDate Timestamp 创建时间 0.6
lastOpDate Timestamp 最后一次修改时间 0.6
type String 0.6

availableCapacity

Long 2.3.2
usedCapacity Long 2.3.2
replicatedSize Integer 2.3.2

SDK示例

Java SDK
AddCephPrimaryStoragePoolAction action = new AddCephPrimaryStoragePoolAction();
action.primaryStorageUuid = "fe5adfa6042b33cd8ee7b5bcd994245f";
action.poolName = "highPerformance";
action.aliasName = "alias pool name";
action.description = "for high performance data volumes";
action.isCreate = true;
action.type = "Root"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddCephPrimaryStoragePoolAction.Result res = action.call();
Python SDK
AddCephPrimaryStoragePoolAction action = AddCephPrimaryStoragePoolAction()
action.primaryStorageUuid = "fe5adfa6042b33cd8ee7b5bcd994245f"
action.poolName = "highPerformance"
action.aliasName = "alias pool name"
action.type = "Root"
action.description = "for high performance data volumes"
action.isCreate = true
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AddCephPrimaryStoragePoolAction.Result res = action.call()

删除Ceph主存储池(DeleteCephPrimaryStoragePool)

API请求

URLs
DELETE zstack/v1/primary-storage/ceph/pools/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/primary-storage/ceph/pools/5d9ee6f791d33de3a3aff68f7a746282?
参数列表
名字 类型 位置 描述 可选值 起始版本
uuid String url 资源的UUID,唯一标示该资源 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
DeleteCephPrimaryStoragePoolAction action = new DeleteCephPrimaryStoragePoolAction();
action.uuid = "5d9ee6f791d33de3a3aff68f7a746282";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteCephPrimaryStoragePoolAction.Result res = action.call();
Python SDK
DeleteCephPrimaryStoragePoolAction action = DeleteCephPrimaryStoragePoolAction()
action.uuid = "5d9ee6f791d33de3a3aff68f7a746282"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeleteCephPrimaryStoragePoolAction.Result res = action.call()

查询Ceph主存储池(QueryCephPrimaryStoragePool)

API请求

URLs
GET zstack/v1/primary-storage/ceph/pools
GET zstack/v1/primary-storage/ceph/pools/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/primary-storage/ceph/pools?q=name=highPerformance
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/primary-storage/ceph/pools/d4e5d23825ff3004856e1720eff59131

可查询字段

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

API返回

返回示例
{
  "inventories": [
    {
      "primaryStorageUuid": "d0e638ede3263a9080c41ce860106043",
      "poolName": "test pool",
      "aliasName": "alias test pool",
      "description": "high performance",
      "createDate": "Nov 14, 2017 10:20:57 PM",
      "lastOpDate": "Nov 14, 2017 10:20:57 PM",
      "type": "Data"
    }
  ]
}
名字 类型 描述 起始版本
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
primaryStorageUuid String 主存储UUID 0.6
poolName String 0.6
aliasName String 0.6
description String 资源的详细描述 0.6
createDate Timestamp 创建时间 0.6
lastOpDate Timestamp 最后一次修改时间 0.6
type String 0.6
usedCapacity Long 2.3.2
replicatedSize Integer 2.3.2

availableCapacity

Long 2.3.2

SDK示例

Java SDK
QueryCephPrimaryStoragePoolAction action = new QueryCephPrimaryStoragePoolAction();
action.conditions = asList("name=highPerformance");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryCephPrimaryStoragePoolAction.Result res = action.call();
Python SDK
QueryCephPrimaryStoragePoolAction action = QueryCephPrimaryStoragePoolAction()
action.conditions = ["name=highPerformance"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryCephPrimaryStoragePoolAction.Result res = action.call()

更新Ceph主存储池(UpdateCephPrimaryStoragePool)

API请求

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

API返回

返回示例
{
  "inventory": {
    "uuid": "7f0e174e86e739d695b0e5b9674e3638",
    "primaryStorageUuid": "6b247ebee1e4326998f10e03a5f8c230",
    "poolName": "pool name",
    "aliasName": "alias name",
    "description": "description",
    "createDate": "Nov 14, 2017 10:20:57 PM",
    "lastOpDate": "Nov 14, 2017 10:20:57 PM",
    "type": "Data"
  }
}
名字 类型 描述 起始版本
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 0.6
inventory CephPrimaryStoragePoolInventory 详情参考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
primaryStorageUuid String 主存储UUID 0.6
poolName String 0.6
aliasName String 0.6
description String 资源的详细描述 0.6
createDate Timestamp 创建时间 0.6
lastOpDate Timestamp 最后一次修改时间 0.6
type String 0.6
usedCapacity Long 2.3.2
replicatedSize Integer 2.3.2

availableCapacity

Long 2.3.2

SDK示例

Java SDK
UpdateCephPrimaryStoragePoolAction action = new UpdateCephPrimaryStoragePoolAction();
action.uuid = "8b2d94a2a12332a7ace559238644472c";
action.aliasName = "alias";
action.description = "description";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateCephPrimaryStoragePoolAction.Result res = action.call();
Python SDK
UpdateCephPrimaryStoragePoolAction action = UpdateCephPrimaryStoragePoolAction()
action.uuid = "8b2d94a2a12332a7ace559238644472c"
action.aliasName = "alias"
action.description = "description"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateCephPrimaryStoragePoolAction.Result res = action.call()

查询Ceph OSD组(QueryCephOsdGroup)

API请求

URLs
GET zstack/v1/primary-storage/ceph/osdgroups
GET zstack/v1/primary-storage/ceph/osdgroups/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/primary-storage/ceph/osdgroups\
q=uuid=b2c53eee77bc3bfea5374d417babff07
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/primary-storage/ceph/osdgroups/9ee0973b0e79393e9f7d03a6e3a6f645

可查询字段

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

API返回

返回示例
{
  "inventories": [
    {
      "osds": "osd.1",
      "availableCapacity": 0.0,
      "availablePhysicalCapacity": 1024.0,
      "totalPhysicalCapacity": 1024.0,
      "createDate": "Nov 14, 2017 10:20:57 PM",
      "lastOpDate": "Nov 14, 2017 10:20:57 PM"
    }
  ]
}
名字 类型 描述 起始版本
success boolean 4.5.0
inventories List 详情参考inventories 4.5.0
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 4.5.0
#inventories
名字 类型 描述 起始版本
primaryStorageUuid String 主存储UUID 4.5.0
osds String 4.5.0
availableCapacity long 4.5.0
availablePhysicalCapacity long 4.5.0
totalPhysicalCapacity long 4.5.0
createDate Timestamp 创建时间 4.5.0
lastOpDate Timestamp 最后一次修改时间 4.5.0
uuid String 资源的UUID,唯一标示该资源 4.5.0
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 4.5.0
description String 错误的概要描述 4.5.0
details String 错误的详细信息 4.5
elaboration String 保留字段,默认为null 4.5.0
opaque LinkedHashMap 保留字段,默认为null 4.5.0
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 4.5.0

SDK示例

Java SDK
QueryCephOsdGroupAction action = new QueryCephOsdGroupAction();
action.conditions = asList("uuid=3e479fc0962c3561a854d868fce5ab3e");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryCephOsdGroupAction.Result res = action.call();
Python SDK
QueryCephOsdGroupAction action = QueryCephOsdGroupAction()
action.conditions = ["uuid=45906504e89335809e54a79897eb1357"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryCephOsdGroupAction.Result res = action.call()
开发手册 | 5.4.12 | ZStack Cloud · ZCF | ZStack 资源中心