文档目录

SAN存储相关接口

添加SAN存储(AddSharedBlockGroupPrimaryStorage)

API请求

URLs
POST zstack/v1/primary-storage/sharedblockgroup
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "diskUuids": [
      "1b5682b663b937a59adb9e318cab6b05"
    ],
    "name": "shared-block-group-1",
    "type": "SharedBlock",
    "zoneUuid": "eee8b39ad50b300c8935e554a967691b"
  },
  "systemTags": [],
  "userTags": []
}
Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"diskUuids":["1b5682b663b937a59adb9e318cab6b05"],"name":"shared-block-group-1","type":"SharedBlock","zoneUuid":"eee8b39ad50b300c8935e554a967691b"}}' http://localhost:8080/zstack/v1/primary-storage/sharedblockgroup
参数列表
名字 类型 位置 描述 可选值 起始版本
diskUuids List body(包含在params结构中) 磁盘唯一表示(例如UUID, WWN, WWID) 2.3.2
name String body(包含在params结构中) 资源名称 2.3.2
description (可选) String body(包含在params结构中) 资源的详细描述 2.3.2
type (可选) String body(包含在params结构中) 数据存储类型,此处为 SharedBlock 2.3.2
url String body(包含在params结构中) 未使用 2.3.2
zoneUuid String body(包含在params结构中) 数据中心UUID 2.3.2
resourceUuid (可选) String body(包含在params结构中) 2.3.2
systemTags (可选) List body 2.3.2
userTags (可选) List body 2.3.2
Note:
  • ZStack ZSphere添加SAN存储时支持指定硬盘默认置备方式,SystemTags增加primaryStorageVolumeProvisioningStrategy选项。
    • 选项格式为:primaryStorageVolumeProvisioningStrategy::ThinProvisioning, primaryStorageVolumeProvisioningStrategy::ThickProvisioning
    • 例如:primaryStorageVolumeProvisioningStrategy::ThinProvisioning, primaryStorageVolumeProvisioningStrategy::ThickProvisioning

API返回

返回示例
{
  "inventory": {
    "name": "PS1",
    "url": "/Cloud_ps",
    "type": "LocalStorage",
    "state": "Enabled",
    "status": "Connected",
    "attachedClusterUuids": [
      "c6e9684e8bb93a9192c946dcd0564b39"
    ]
  }
}
名字 类型 描述 起始版本
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 2.3.2
inventory PrimaryStorageInventory 详情参考inventory 2.3.2
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 2.3.2
description String 错误的概要描述 2.3.2
details String 错误的详细信息 2.3.2
elaboration String 保留字段,默认为null 2.3.2
opaque LinkedHashMap 保留字段,默认为null 2.3.2
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 2.3.2
#inventory
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 2.3.2
zoneUuid String 数据中心UUID 2.3.2
name String 资源名称 2.3.2
url String 2.3.2
description String 资源的详细描述 2.3.2
totalCapacity Long 2.3.2
availableCapacity Long 2.3.2
totalPhysicalCapacity Long 2.3.2
availablePhysicalCapacity Long 2.3.2
systemUsedCapacity Long 2.3.2
type String 2.3.2
state String 2.3.2
status String 2.3.2
mountPath String 2.3.2
createDate Timestamp 创建时间 2.3.2
lastOpDate Timestamp 最后一次修改时间 2.3.2
attachedClusterUuids List 2.3.2

SDK示例

Java SDK
AddSharedBlockGroupPrimaryStorageAction action = new AddSharedBlockGroupPrimaryStorageAction();
action.diskUuids = asList("1b5682b663b937a59adb9e318cab6b05");
action.name = "shared-block-group-1";
action.type = "SharedBlock";
action.zoneUuid = "eee8b39ad50b300c8935e554a967691b";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddSharedBlockGroupPrimaryStorageAction.Result res = action.call();
Python SDK
AddSharedBlockGroupPrimaryStorageAction action = AddSharedBlockGroupPrimaryStorageAction()
action.diskUuids = [1b5682b663b937a59adb9e318cab6b05]
action.name = "shared-block-group-1"
action.type = "SharedBlock"
action.zoneUuid = "eee8b39ad50b300c8935e554a967691b"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AddSharedBlockGroupPrimaryStorageAction.Result res = action.call()

查询连接状态(QuerySharedBlockGroupPrimaryStorageHostRef)

查询SAN存储主机连接状态。

API请求

URLs
GET zstack/v1/sharedblock-group/host-refs
GET zstack/v1/sharedblock-group/{primaryStorageUuid}/host-refs
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/sharedblock-group/host-refs
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/sharedblock-group/{primaryStorageUuid}/host-refs

可查询字段

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

API返回

返回示例
{
  "inventories": [
    {
      "primaryStorageUuid": "a9e96e98cc2c3a3baa23e31503fc93e6",
      "hostUuid": "7c5510f255663a3cbfd53367c0172507",
      "hostId": 100.0,
      "status": "Connected",
      "createDate": "Nov 14, 2017 10:20:57 PM",
      "lastOpDate": "Nov 14, 2017 10:20:57 PM"
    }
  ]
}
名字 类型 描述 起始版本
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 2.3.2
inventories List 详情参考inventories 2.3.2
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 2.3.2
description String 错误的概要描述 2.3.2
details String 错误的详细信息 2.3.2
elaboration String 保留字段,默认为null 2.3.2
opaque LinkedHashMap 保留字段,默认为null 2.3.2
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 2.3.2
#inventories
名字 类型 描述 起始版本
primaryStorageUuid String 数据存储UUID 2.3.2
hostUuid String 主机UUID 2.3.2
hostId Integer 主机ID 2.3.2
createDate Timestamp 创建时间 2.3.2
lastOpDate Timestamp 最后一次修改时间 2.3.2
status PrimaryStorageHostStatus 详情参考status 2.3.2
#status
名字 类型 描述 起始版本
name String 资源名称 2.3.2
ordinal int 2.3.2

SDK示例

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

查询SAN存储(QuerySharedBlockGroupPrimaryStorage)

API请求

URLs
GET zstack/v1/primary-storage/sharedblockgroup
GET zstack/v1/primary-storage/sharedblockgroup/{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/sharedblockgroup
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/primary-storage/sharedblockgroup/ab5776cffa893955a533f7e89cdaf025

可查询字段

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

API返回

返回示例
{
  "inventories": [
    {
      "sharedBlocks": [
        {
          "uuid": "2bf68818dc2c3ffbb9c9f283c8a1f524",
          "sharedBlockGroupUuid": "23ef265b88143074b88ad450afe5cbac",
          "type": "LvmLogicalVolumeBasic",
          "diskUuid": "b4d9459d02533fdeb4dee8b8bf943bed",
          "name": "test shared block",
          "description": "description",
          "state": "Enabled",
          "status": "Connected",
          "createDate": "Nov 14, 2017 10:20:57 PM",
          "lastOpDate": "Nov 14, 2017 10:20:57 PM"
        }
      ],
      "sharedBlockGroupType": "LvmVolumeGroupBasic",
      "uuid": "23ef265b88143074b88ad450afe5cbac",
      "name": "shared block group primary storage",
      "description": "shared block group primary storage description",
      "availableCapacity": 1.073741824E9,
      "availablePhysicalCapacity": 1.073741824E9,
      "type": "SharedBlock",
      "state": "Enabled",
      "status": "Connected",
      "createDate": "Nov 14, 2017 10:20:57 PM",
      "lastOpDate": "Nov 14, 2017 10:20:57 PM"
    }
  ]
}
名字 类型 描述 起始版本
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 2.3.2
inventories List 详情参考inventories 2.3.2
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 2.3.2
description String 错误的概要描述 2.3.2
details String 错误的详细信息 2.3.2
elaboration String 保留字段,默认为null 2.3.2
opaque LinkedHashMap 保留字段,默认为null 2.3.2
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 2.3.2
#inventories
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 2.3.2
zoneUuid String 数据中心UUID 2.3.2
name String 资源名称 2.3.2
url String 未使用 2.3.2
description String 资源的详细描述 2.3.2
totalCapacity Long 总空间 2.3.2
availableCapacity Long 可用空间 2.3.2
totalPhysicalCapacity Long 总物理空间 2.3.2
availablePhysicalCapacity Long 物理可用空间 2.3.2
systemUsedCapacity Long 系统使用空间 2.3.2
type String 数据存储类型 2.3.2
state String 启用状态 2.3.2
status String 连接状态 2.3.2
mountPath String 未使用 2.3.2
createDate Timestamp 创建时间 2.3.2
lastOpDate Timestamp 最后一次修改时间 2.3.2
attachedClusterUuids List 挂载的集群 2.3.2
sharedBlocks List 详情参考sharedBlocks 2.3.2
sharedBlockGroupType SharedBlockGroupType 详情参考sharedBlockGroupType 2.3.2
#sharedBlocks
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 2.3.2
sharedBlockGroupUuid String 共享块设备组UUID 2.3.2
diskUuid String 磁盘唯一标示(例如UUID, WWN, WWID) 2.3.2
name String 资源名称 2.3.2
description String 资源的详细描述 2.3.2
createDate Timestamp 创建时间 2.3.2
lastOpDate Timestamp 最后一次修改时间 2.3.2
type SharedBlockType 详情参考type 2.3.2
state SharedBlockState 详情参考state 2.3.2
status SharedBlockStatus 详情参考status 2.3.2
#type
名字 类型 描述 起始版本
name String 资源名称 2.3.2
ordinal int 2.3.2
#state
名字 类型 描述 起始版本
name String 资源名称 2.3.2
ordinal int 2.3.2
#status
名字 类型 描述 起始版本
name String 资源名称 2.3.2
ordinal int 2.3.2
#sharedBlockGroupType
名字 类型 描述 起始版本
name String 资源名称 2.3.2
ordinal int 2.3.2

SDK示例

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

添加LUN到SAN存储(AddSharedBlockToSharedBlockGroup)

添加共享块设备到SAN存储。

API请求

URLs
POST zstack/v1/primary-storage/sharedblockgroup/{uuid}/sharedblocks
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "diskUuid": "3bc916e4700e36c9ad9575fcf47222ab"
  },
  "systemTags": [],
  "userTags": []
}
Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"diskUuid":"3bc916e4700e36c9ad9575fcf47222ab"}}' http://localhost:8080/zstack/v1/primary-storage/sharedblockgroup/506367e0d66d3fdb92eda345ed347c21/sharedblocks
参数列表
名字 类型 位置 描述 可选值 起始版本
diskUuid String body(包含在params结构中) 磁盘维一标示(例如UUID, WWN, WWID) 2.3.2
uuid String url 数据存储UUID 2.3.2
systemTags (可选) List body 2.3.2
userTags (可选) List body 2.3.2

API返回

返回示例
{
  "inventory": {
    "sharedBlocks": [
      {
        "uuid": "5bc4ef2f6f703bfd9aef732be038103d",
        "sharedBlockGroupUuid": "08f3dd28f1c433fe871e3fe760476981",
        "type": "LvmLogicalVolumeBasic",
        "diskUuid": "b9a89d214e3b37eda7a1aa948c59db13",
        "name": "test shared block",
        "description": "description",
        "state": "Enabled",
        "status": "Connected",
        "createDate": "Nov 14, 2017 10:20:57 PM",
        "lastOpDate": "Nov 14, 2017 10:20:57 PM"
      }
    ],
    "sharedBlockGroupType": "LvmVolumeGroupBasic",
    "uuid": "08f3dd28f1c433fe871e3fe760476981",
    "name": "shared block group primary storage",
    "description": "shared block group primary storage description",
    "availableCapacity": 1.073741824E9,
    "availablePhysicalCapacity": 1.073741824E9,
    "type": "SharedBlock",
    "state": "Enabled",
    "status": "Connected",
    "createDate": "Nov 14, 2017 10:20:57 PM",
    "lastOpDate": "Nov 14, 2017 10:20:57 PM"
  }
}
名字 类型 描述 起始版本
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 2.3.2
inventory SharedBlockGroupPrimaryStorageInventory 详情参考inventory 2.3.2
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 2.3.2
description String 错误的概要描述 2.3.2
details String 错误的详细信息 2.3.2
elaboration String 保留字段,默认为null 2.3.2
opaque LinkedHashMap 保留字段,默认为null 2.3.2
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 2.3.2
#inventory
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 2.3.2
zoneUuid String 数据中心UUID 2.3.2
name String 资源名称 2.3.2
url String 未使用 2.3.2
description String 资源的详细描述 2.3.2
totalCapacity Long 总空间 2.3.2
availableCapacity Long 可用空间 2.3.2
totalPhysicalCapacity Long 总物理空间 2.3.2
availablePhysicalCapacity Long 物理可用空间 2.3.2
systemUsedCapacity Long 系统使用空间 2.3.2
type String 数据存储类型 2.3.2
state String 启用状态 2.3.2
status String 连接状态 2.3.2
mountPath String 未使用 2.3.2
createDate Timestamp 创建时间 2.3.2
lastOpDate Timestamp 最后一次修改时间 2.3.2
attachedClusterUuids List 挂载的集群 2.3.2
sharedBlocks List 详情参考sharedBlocks 2.3.2
sharedBlockGroupType SharedBlockGroupType 详情参考sharedBlockGroupType 2.3.2
#sharedBlocks
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 2.3.2
sharedBlockGroupUuid String 共享块设备组UUID 2.3.2
diskUuid String 磁盘唯一标示(例如UUID, WWN, WWID) 2.3.2
name String 资源名称 2.3.2
description String 资源的详细描述 2.3.2
createDate Timestamp 创建时间 2.3.2
lastOpDate Timestamp 最后一次修改时间 2.3.2
type SharedBlockType 详情参考type 2.3.2
state SharedBlockState 详情参考state 2.3.2
status SharedBlockStatus 详情参考status 2.3.2
#type
名字 类型 描述 起始版本
name String 资源名称 2.3.2
ordinal int 2.3.2
#state
名字 类型 描述 起始版本
name String 资源名称 2.3.2
ordinal int 2.3.2
#status
名字 类型 描述 起始版本
name String 资源名称 2.3.2
ordinal int 2.3.2
#sharedBlockGroupType
名字 类型 描述 起始版本
name String 资源名称 2.3.2
ordinal int 2.3.2

SDK示例

Java SDK
AddSharedBlockToSharedBlockGroupAction action = new AddSharedBlockToSharedBlockGroupAction();
action.diskUuid = "3bc916e4700e36c9ad9575fcf47222ab";
action.uuid = "506367e0d66d3fdb92eda345ed347c21";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddSharedBlockToSharedBlockGroupAction.Result res = action.call();
Python SDK
AddSharedBlockToSharedBlockGroupAction action = AddSharedBlockToSharedBlockGroupAction()
action.diskUuid = "3bc916e4700e36c9ad9575fcf47222ab"
action.uuid = "506367e0d66d3fdb92eda345ed347c21"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AddSharedBlockToSharedBlockGroupAction.Result res = action.call()

获取共享块设备候选清单(GetSharedBlockCandidate)

API请求

URLs
GET zstack/v1/primary-storage/sharedblockgroup/sharedblock-candidates
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/sharedblockgroup/sharedblock-candidates?clusterUuid=a8efc4d72a2334dcad7f71bcb4821d6f
参数列表
名字 类型 位置 描述 可选值 起始版本
clusterUuid String query 集群UUID 2.6.0
systemTags (可选) List query 2.6.0
userTags (可选) List query 2.6.0

API返回

返回示例
{
  "results": [
    {
      "wwid": "ata-Samsung_SSD_850_EVO_M.2_250GB_S33CNX0H600299D",
      "vendor": "DELL",
      "model": "MD32xx",
      "wwn": "0x6b083fe000daf018",
      "serial": "6b083fe000daf018000015505abbe00a",
      "hctl": "",
      "type": "mpath",
      "size": 3.000318820352E13
    },
    {}
  ]
}
名字 类型 描述 起始版本
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 2.6.0
results List 详情参考results 2.6.0
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 2.6.0
description String 错误的概要描述 2.6.0
details String 错误的详细信息 2.6.0
elaboration String 保留字段,默认为null 2.6.0
opaque LinkedHashMap 保留字段,默认为null 2.6.0
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 2.6.0
#results
名字 类型 描述 起始版本
wwid String 设备WWID 2.6.0
vendor String 设备供应商 2.6.0
model String 设备型号 2.6.0
wwn String 设备WWN 2.6.0
serial String 设备序列号 2.6.0
hctl String SCSI设备HCTL 2.6.0
type String 设备类型 2.6.0
size Long 设备大小 2.6.0

SDK示例

Java SDK
GetSharedBlockCandidateAction action = new GetSharedBlockCandidateAction();
action.clusterUuid = "a8efc4d72a2334dcad7f71bcb4821d6f";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetSharedBlockCandidateAction.Result res = action.call();
Python SDK
GetSharedBlockCandidateAction action = GetSharedBlockCandidateAction()
action.clusterUuid = "a8efc4d72a2334dcad7f71bcb4821d6f"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetSharedBlockCandidateAction.Result res = action.call()

刷新共享块设备容量(RefreshSharedblockDeviceCapacity)

API请求

URLs
POST zstack/v1/primary-storage/sharedblockgroup/{sharedBlockGroupUuid}/sharedblocks/{uuid}
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {},
  "systemTags": [],
  "userTags": []
}
Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{}}' http://localhost:8080/zstack/v1/primary-storage/sharedblockgroup/2974c033608537e68a305b0f29412776/sharedblocks/9bd10e4bcc0939a2b041755a160d7b34
参数列表
名字 类型 位置 描述 可选值 起始版本
uuid (可选) String url 共享块设备UUID,如为空则更新共享块存储下所有设备 2.6.0
sharedBlockGroupUuid String url 共享块存储UUID 2.6.0
systemTags (可选) List body 2.6.0
userTags (可选) List body 2.6.0

API返回

返回示例

{
  "inventory": {
    "sharedBlocks": [
      {
        "uuid": "fd474b5a711f3bcab14061e1507b0691",
        "sharedBlockGroupUuid": "9f900d7cc336370da2dccdd832a1613d",
        "type": "LvmLogicalVolumeBasic",
        "diskUuid": "b9bec04964ab30a7bf80bdbf7ec997d9",
        "name": "test shared block",
        "description": "description",
        "state": "Enabled",
        "status": "Connected",
        "createDate": "Nov 14, 2017 10:20:57 PM",
        "lastOpDate": "Nov 14, 2017 10:20:57 PM"
      }
    ],
    "sharedBlockGroupType": "LvmVolumeGroupBasic",
    "uuid": "9f900d7cc336370da2dccdd832a1613d",
    "name": "shared block group primary storage",
    "description": "shared block group primary storage description",
    "availableCapacity": 1.073741824E9,
    "availablePhysicalCapacity": 1.073741824E9,
    "type": "SharedBlock",
    "state": "Enabled",
    "status": "Connected",
    "createDate": "Nov 14, 2017 10:20:57 PM",
    "lastOpDate": "Nov 14, 2017 10:20:57 PM"
  }
}
名字 类型 描述 起始版本
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 2.6.0
inventory SharedBlockGroupPrimaryStorageInventory 详情参考inventory 2.6.0
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 2.6.0
description String 错误的概要描述 2.6.0
details String 错误的详细信息 2.6.0
elaboration String 保留字段,默认为null 2.6.0
opaque LinkedHashMap 保留字段,默认为null 2.6.0
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 2.6.0
#inventory
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 2.6.0
zoneUuid String 数据中心UUID 2.6.0
name String 资源名称 2.6.0
url String 未使用 2.6.0
description String 资源的详细描述 2.6.0
totalCapacity Long 总空间 2.6.0
availableCapacity Long 可用空间 2.6.0
totalPhysicalCapacity Long 总物理空间 2.6.0
availablePhysicalCapacity Long 物理可用空间 2.6.0
systemUsedCapacity Long 系统使用空间 2.6.0
type String 数据存储类型 2.6.0
state String 启用状态 2.6.0
status String 连接状态 2.6.0
mountPath String 未使用 2.6.0
createDate Timestamp 创建时间 2.6.0
lastOpDate Timestamp 最后一次修改时间 2.6.0
attachedClusterUuids List 挂载的集群 2.6.0
sharedBlocks List 详情参考sharedBlocks 2.6.0
sharedBlockGroupType SharedBlockGroupType 详情参考sharedBlockGroupType 2.6.0
#sharedBlocks
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 2.6.0
sharedBlockGroupUuid String 共享块设备组UUID 2.6.0
diskUuid String 磁盘唯一标示(例如UUID, WWN, WWID) 2.6.0
name String 资源名称 2.6.0
description String 资源的详细描述 2.6.0
createDate Timestamp 创建时间 2.6.0
lastOpDate Timestamp 最后一次修改时间 2.6.0
type SharedBlockType 详情参考type 2.6.0
state SharedBlockState 详情参考state 2.6.0
status SharedBlockStatus 详情参考status 2.6.0
#type
名字 类型 描述 起始版本
name String 资源名称 2.6.0
ordinal int 2.6.0
#state
名字 类型 描述 起始版本
name String 资源名称 2.6.0
ordinal int 2.6.0
#status
名字 类型 描述 起始版本
name String 资源名称 2.6.0
ordinal int 2.6.0
#sharedBlockGroupType
名字 类型 描述 起始版本
name String 资源名称 2.6.0
ordinal int 2.6.0

SDK示例

Java SDK

RefreshSharedblockDeviceCapacityAction action = new RefreshSharedblockDeviceCapacityAction();
action.uuid = "9bd10e4bcc0939a2b041755a160d7b34";
action.sharedBlockGroupUuid = "2974c033608537e68a305b0f29412776";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
RefreshSharedblockDeviceCapacityAction.Result res = action.call();
Python SDK

RefreshSharedblockDeviceCapacityAction action = RefreshSharedblockDeviceCapacityAction()
action.uuid = "9bd10e4bcc0939a2b041755a160d7b34"
action.sharedBlockGroupUuid = "2974c033608537e68a305b0f29412776"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
RefreshSharedblockDeviceCapacityAction.Result res = action.call()

查询共享块设备(QuerySharedBlock)

API请求

URLs
GET zstack/v1/sharedblock-group/sharedblocks
GET zstack/v1/sharedblock-group/
GET zstack/v1/sharedblock-group/sharedblock/{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/sharedblock-group/sharedblocks
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/sharedblock-group/
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/sharedblock-group/sharedblock/e6076fa169ed38ba8f66e73c2db7158d

可查询字段

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

API返回

返回示例
{
  "inventories": [
    {
      "uuid": "3787d759b8323d2e8f0b19ef0bfe930b",
      "sharedBlockGroupUuid": "0dcfcb85f7613689886ae34114064cbd",
      "type": "LvmLogicalVolumeBasic",
      "name": "test shared block",
      "description": "description",
      "state": "Enabled",
      "status": "Connected",
      "createDate": "Nov 14, 2017 10:20:57 PM",
      "lastOpDate": "Nov 14, 2017 10:20:57 PM"
    }
  ]
}
名字 类型 描述 起始版本
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 2.3.2
inventories List 详情参考inventories 2.3.2
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 2.3.2
description String 错误的概要描述 2.3.2
details String 错误的详细信息 2.3.2
elaboration String 保留字段,默认为null 2.3.2
opaque LinkedHashMap 保留字段,默认为null 2.3.2
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 2.3.2
#inventories
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 2.3.2
sharedBlockGroupUuid String 共享块设备组UUID 2.3.2
diskUuid String 磁盘唯一标示(例如UUID, WWN, WWID) 2.3.2
name String 资源名称 2.3.2
description String 资源的详细描述 2.3.2
createDate Timestamp 创建时间 2.3.2
lastOpDate Timestamp 最后一次修改时间 2.3.2
type SharedBlockType 详情参考type 2.3.2
state SharedBlockState 详情参考state 2.3.2
status SharedBlockStatus 详情参考status 2.3.2
#type
名字 类型 描述 起始版本
name String 资源名称 2.3.2
ordinal int 2.3.2
#state
名字 类型 描述 起始版本
name String 资源名称 2.3.2
ordinal int 2.3.2
#status
名字 类型 描述 起始版本
name String 资源名称 2.3.2
ordinal int 2.3.2

SDK示例

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

iSCSI服务器相关接口

添加iSCSI服务器(AddIscsiServer)

API请求

URLs
POST zstack/v1/storage-devices/iscsi/servers
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "ip": "10.0.0.201",
    "port": 3260.0
  },
  "systemTags": [],
  "userTags": []
}
Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"ip":"10.0.0.201","port":3260.0}}' http://localhost:8080/zstack/v1/storage-devices/iscsi/servers
参数列表
名字 类型 位置 描述 可选值 起始版本
name (可选) String body(包含在params结构中) 资源名称 3.0.0
ip String body(包含在params结构中) IP地址 3.0.0
port (可选) Integer body(包含在params结构中) 端口,默认为3260 3.0.0
chapUserName (可选) String body(包含在params结构中) CHAP用户名,默认为空 3.0.0
chapUserPassword (可选) String body(包含在params结构中) CHAP密码,默认为空 3.0.0
resourceUuid (可选) String body(包含在params结构中) 3.0.0
systemTags (可选) List body 3.0.0
userTags (可选) List body 3.0.0

API返回

返回示例
{
  "inventory": {
    "uuid": "0b77c2e947ca3b40b79f6342728ec8fc",
    "name": "iscsi-server-10.0.0.201",
    "ip": "10.0.0.201",
    "port": 3260.0,
    "chapUserName": "username",
    "chapUserPassword": "password",
    "state": "Enabled",
    "createDate": "Nov 14, 2017 10:20:57 PM",
    "lastOpDate": "Nov 14, 2017 10:20:57 PM"
  }
}
名字 类型 描述 起始版本
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 3.0.0
inventory IscsiServerInventory 详情参考inventory 3.0.0
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 3.0.0
description String 错误的概要描述 3.0.0
details String 错误的详细信息 3.0.0
elaboration String 保留字段,默认为null 3.0.0
opaque LinkedHashMap 保留字段,默认为null 3.0.0
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 3.0.0
#inventory
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 3.0.0
name String 资源名称 3.0.0
ip String IP地址 3.0.0
port Integer 端口 3.0.0
chapUserName String CHAP用户名 3.0.0
chapUserPassword String CHAP密码 3.0.0
state String 启用状态 3.0.0
createDate Timestamp 创建时间 3.0.0
lastOpDate Timestamp 最后一次修改时间 3.0.0
iscsiTargets List 详情参考iscsiTargets 3.0.0
iscsiClusterRefs List 详情参考iscsiClusterRefs 3.0.0
#iscsiTargets
名字 类型 描述 起始版本
iscsiServerUuid String iSCSI服务器UUID 3.0.0
uuid String 资源的UUID,唯一标示该资源 3.0.0
iqn String iSCSI IQN 3.0.0
createDate Timestamp 创建时间 3.0.0
lastOpDate Timestamp 最后一次修改时间 3.0.0
iscsiLuns List 详情参考iscsiLuns 3.0.0
#iscsiLuns
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 3.0.0
iscsiTargetUuid String iSCSI目标UUID 3.0.0
wwid String 唯一识别ID 3.0.0
vendor String 设备供应商 3.0.0
model String 设备型号 3.0.0
wwn String 设备WWN 3.0.0
serial String 设备序列号 3.0.0
hctl String SCSI设备HCTL 3.0.0
type String 设备类型 3.0.0
path String 设备路径 3.0.0
size Long 设备大小 3.0.0
createDate Timestamp 创建时间 3.0.0
lastOpDate Timestamp 最后一次修改时间 3.0.0
#iscsiClusterRefs
名字 类型 描述 起始版本
iscsiServerUuid String 3.0.0
clusterUuid String 集群UUID 3.0.0
createDate Timestamp 创建时间 3.0.0
lastOpDate Timestamp 最后一次修改时间 3.0.0

SDK示例

Java SDK
AddIscsiServerAction action = new AddIscsiServerAction();
action.ip = "10.0.0.201";
action.port = 3260.0;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddIscsiServerAction.Result res = action.call();
Python SDK
AddIscsiServerAction action = AddIscsiServerAction()
action.ip = "10.0.0.201"
action.port = 3260.0
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AddIscsiServerAction.Result res = action.call()

删除iSCSI服务器(DeleteIscsiServer)

API请求

URLs
DELETE zstack/v1/storage-devices/iscsi/servers/{uuid}?deleteMode={deleteMode}
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/storage-devices/iscsi/servers/7a3f7749fd393899b4b74d2b470e15eb?deleteMode=Permissive
参数列表
名字 类型 位置 描述 可选值 起始版本
uuid String url iSCSI服务器的UUID 3.0.0
deleteMode (可选) String url 3.0.0
systemTags (可选) List body 3.0.0
userTags (可选) List body 3.0.0

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
DeleteIscsiServerAction action = new DeleteIscsiServerAction();
action.uuid = "7a3f7749fd393899b4b74d2b470e15eb";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteIscsiServerAction.Result res = action.call();
Python SDK
DeleteIscsiServerAction action = DeleteIscsiServerAction()
action.uuid = "7a3f7749fd393899b4b74d2b470e15eb"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeleteIscsiServerAction.Result res = action.call()

查询iSCSI服务器(QueryIscsiServer)

API请求

URLs
GET zstack/v1/storage-devices/iscsi/servers
GET zstack/v1/storage-devices/iscsi
GET zstack/v1/storage-devices/iscsi/servers/{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/storage-devices/iscsi/servers
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/storage-devices/iscsi
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/storage-devices/iscsi/servers/cf91d809261735be9f20429880c1d19c

可查询字段

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

API返回

返回示例
{
  "inventories": [
    {
      "uuid": "fd97e8b6d61c399abed358ea6b2fc206",
      "name": "iscsi-server-10.0.0.201",
      "ip": "10.0.0.201",
      "port": 3260.0,
      "chapUserName": "username",
      "chapUserPassword": "password",
      "state": "Enabled",
      "iscsiTargets": [
        {
          "iscsiServerUuid": "fd97e8b6d61c399abed358ea6b2fc206",
          "uuid": "d156429110f13c2ca07bbc04e4031231",
          "iqn": "iqn.2018-01.io.cloud:tsn.00001",
          "state": "Enabled",
          "iscsiLuns": [
            {
              "uuid": "500f63c8f44939bbab102222927f9290",
              "iscsiTargetUuid": "d156429110f13c2ca07bbc04e4031231",
              "wwid": "36b083fe000daf018000015505abbe00a",
              "vendor": "DELL",
              "model": "MD32xx",
              "wwn": "0x6b083fe000daf018",
              "serial": "6b083fe000daf018000015505abbe00a",
              "hctl": "6:0:1:1",
              "type": "mpath",
              "path": "ip-0.0.0.201:3260-iscsi-iqn.2018-01.io.cloud:tsn.00001-lun-0",
              "size": 3.000318820352E13,
              "multipathDeviceUuid": "36b083fe000daf018000015505abbe00a"
            }
          ],
          "createDate": "Nov 14, 2017 10:20:57 PM",
          "lastOpDate": "Nov 14, 2017 10:20:57 PM"
        }
      ],
      "iscsiClusterRefs": [
        {
          "id": 1.0,
          "iscsiServerUuid": "fd97e8b6d61c399abed358ea6b2fc206",
          "clusterUuid": "02db8eb4e3043f55b7f1cf02df735611",
          "createDate": "Nov 14, 2017 10:20:57 PM",
          "lastOpDate": "Nov 14, 2017 10:20:57 PM"
        }
      ],
      "createDate": "Nov 14, 2017 10:20:57 PM",
      "lastOpDate": "Nov 14, 2017 10:20:57 PM"
    }
  ]
}
名字 类型 描述 起始版本
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 3.0.0
inventories List 详情参考inventories 3.0.0
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 3.0.0
description String 错误的概要描述 3.0.0
details String 错误的详细信息 3.0.0
elaboration String 保留字段,默认为null 3.0.0
opaque LinkedHashMap 保留字段,默认为null 3.0.0
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 3.0.0
#inventories
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 3.0.0
name String 资源名称 3.0.0
ip String IP地址 3.0.0
port Integer 端口 3.0.0
chapUserName String CHAP用户名 3.0.0
chapUserPassword String CHAP密码 3.0.0
state String 启用状态 3.0.0
createDate Timestamp 创建时间 3.0.0
lastOpDate Timestamp 最后一次修改时间 3.0.0
iscsiTargets List 详情参考iscsiTargets 3.0.0
iscsiClusterRefs List 详情参考iscsiClusterRefs 3.0.0
#iscsiTargets
名字 类型 描述 起始版本
iscsiServerUuid String iSCSI服务器UUID 3.0.0
uuid String 资源的UUID,唯一标示该资源 3.0.0
iqn String iSCSI IQN 3.0.0
createDate Timestamp 创建时间 3.0.0
lastOpDate Timestamp 最后一次修改时间 3.0.0
iscsiLuns List 详情参考iscsiLuns 3.0.0
#iscsiLuns
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 3.0.0
iscsiTargetUuid String iSCSI目标UUID 3.0.0
wwid String 唯一识别ID 3.0.0
vendor String 设备供应商 3.0.0
model String 设备型号 3.0.0
wwn String 设备WWN 3.0.0
serial String 设备序列号 3.0.0
hctl String SCSI设备HCTL 3.0.0
type String 设备类型 3.0.0
path String 设备路径 3.0.0
size Long 设备大小 3.0.0
createDate Timestamp 创建时间 3.0.0
lastOpDate Timestamp 最后一次修改时间 3.0.0
#iscsiClusterRefs
名字 类型 描述 起始版本
iscsiServerUuid String 3.0.0
clusterUuid String 集群UUID 3.0.0
createDate Timestamp 创建时间 3.0.0
lastOpDate Timestamp 最后一次修改时间 3.0.0

SDK示例

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

刷新iSCSI服务器(RefreshIscsiServer)

API请求

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

API返回

返回示例
{
  "inventory": {
    "uuid": "a4a3ef3c3ed537e6b1040ee4b7d77686",
    "name": "iscsi-server-10.0.0.201",
    "ip": "10.0.0.201",
    "port": 3260.0,
    "chapUserName": "username",
    "chapUserPassword": "password",
    "state": "Enabled",
    "iscsiTargets": [
      {
        "iscsiServerUuid": "a4a3ef3c3ed537e6b1040ee4b7d77686",
        "uuid": "3da0cdedd9763edfab39a897f87454e9",
        "iqn": "iqn.2018-01.io.cloud:tsn.00001",
        "iscsiLuns": [
          {
            "uuid": "f569b3e3baf838e59d8a115458d72a9b",
            "iscsiTargetUuid": "3da0cdedd9763edfab39a897f87454e9",
            "wwid": "36b083fe000daf018000015505abbe00a",
            "vendor": "DELL",
            "model": "MD32xx",
            "wwn": "0x6b083fe000daf018",
            "serial": "6b083fe000daf018000015505abbe00a",
            "hctl": "6:0:1:1",
            "type": "mpath",
            "path": "ip-0.0.0.201:3260-iscsi-iqn.2018-01.io.cloud:tsn.00001-lun-0",
            "size": 3.000318820352E13,
            "multipathDeviceUuid": "36b083fe000daf018000015505abbe00a"
          }
        ],
        "createDate": "Nov 14, 2017 10:20:57 PM",
        "lastOpDate": "Nov 14, 2017 10:20:57 PM"
      }
    ],
    "iscsiClusterRefs": [
      {
        "id": 1.0,
        "iscsiServerUuid": "a4a3ef3c3ed537e6b1040ee4b7d77686",
        "clusterUuid": "da1ddc379fc137789b12bcac0ed90148",
        "createDate": "Nov 14, 2017 10:20:57 PM",
        "lastOpDate": "Nov 14, 2017 10:20:57 PM"
      }
    ],
    "createDate": "Nov 14, 2017 10:20:57 PM",
    "lastOpDate": "Nov 14, 2017 10:20:57 PM"
  }
}
名字 类型 描述 起始版本
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 3.0.0
inventory IscsiServerInventory 详情参考inventory 3.0.0
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 3.0.0
description String 错误的概要描述 3.0.0
details String 错误的详细信息 3.0.0
elaboration String 保留字段,默认为null 3.0.0
opaque LinkedHashMap 保留字段,默认为null 3.0.0
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 3.0.0
#inventory
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 3.0.0
name String 资源名称 3.0.0
ip String IP地址 3.0.0
port Integer 端口 3.0.0
chapUserName String CHAP用户名 3.0.0
chapUserPassword String CHAP密码 3.0.0
state String 启用状态 3.0.0
createDate Timestamp 创建时间 3.0.0
lastOpDate Timestamp 最后一次修改时间 3.0.0
iscsiTargets List 详情参考iscsiTargets 3.0.0
iscsiClusterRefs List 详情参考iscsiClusterRefs 3.0.0
#iscsiTargets
名字 类型 描述 起始版本
iscsiServerUuid String iSCSI服务器UUID 3.0.0
uuid String 资源的UUID,唯一标示该资源 3.0.0
iqn String iSCSI IQN 3.0.0
createDate Timestamp 创建时间 3.0.0
lastOpDate Timestamp 最后一次修改时间 3.0.0
iscsiLuns List 详情参考iscsiLuns 3.0.0
#iscsiLuns
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 3.0.0
iscsiTargetUuid String iSCSI目标UUID 3.0.0
wwid String 唯一识别ID 3.0.0
vendor String 设备供应商 3.0.0
model String 设备型号 3.0.0
wwn String 设备WWN 3.0.0
serial String 设备序列号 3.0.0
hctl String SCSI设备HCTL 3.0.0
type String 设备类型 3.0.0
path String 设备路径 3.0.0
size Long 设备大小 3.0.0
createDate Timestamp 创建时间 3.0.0
lastOpDate Timestamp 最后一次修改时间 3.0.0
#iscsiClusterRefs
名字 类型 描述 起始版本
iscsiServerUuid String 3.0.0
clusterUuid String 集群UUID 3.0.0
createDate Timestamp 创建时间 3.0.0
lastOpDate Timestamp 最后一次修改时间 3.0.0

SDK示例

Java SDK
RefreshIscsiServerAction action = new RefreshIscsiServerAction();
action.uuid = "0243c5d7322a36718ad76d865682ba44";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
RefreshIscsiServerAction.Result res = action.call();
Python SDK
RefreshIscsiServerAction action = RefreshIscsiServerAction()
action.uuid = "0243c5d7322a36718ad76d865682ba44"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
RefreshIscsiServerAction.Result res = action.call()

更新iSCSI服务器配置(UpdateIscsiServer)

API请求

URLs
POST zstack/v1/storage-devices/iscsi/servers
Headers
Authorization: OAuth the-session-uuid
Body
{
  "updateIscsiServer": {
    "name": "test-iscsi-server"
  },
  "systemTags": [],
  "userTags": []
}
Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateIscsiServer":{"name":"test-iscsi-server"}}' http://localhost:8080/zstack/v1/storage-devices/iscsi/servers/98d2177199ca301d9fd842eace2dbc67/actions
参数列表
名字 类型 位置 描述 可选值 起始版本
uuid String body(包含在params结构中) 资源的UUID,唯一标示该资源 3.0.0
name (可选) String body(包含在params结构中) 资源名称 3.0.0
chapUserName (可选) String body(包含在params结构中) CHAP用户名 3.0.0
chapUserPassword (可选) String body(包含在params结构中) CHAP密码 3.0.0
state (可选) String body(包含在params结构中) 启用状态
  • Enabled
  • Disabled
3.0.0
resourceUuid (可选) String body(包含在params结构中) 3.0.0
systemTags (可选) List body 3.0.0
userTags (可选) List body 3.0.0

API返回

返回示例
{
  "inventory": {
    "uuid": "0b77c2e947ca3b40b79f6342728ec8fc",
    "name": "iscsi-server-10.0.0.201",
    "ip": "10.0.0.201",
    "port": 3260.0,
    "chapUserName": "username",
    "chapUserPassword": "password",
    "state": "Enabled",
    "createDate": "Nov 14, 2017 10:20:57 PM",
    "lastOpDate": "Nov 14, 2017 10:20:57 PM"
  }
}
名字 类型 描述 起始版本
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 3.0.0
inventory IscsiServerInventory 详情参考inventory 3.0.0
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 3.0.0
description String 错误的概要描述 3.0.0
details String 错误的详细信息 3.0.0
elaboration String 保留字段,默认为null 3.0.0
opaque LinkedHashMap 保留字段,默认为null 3.0.0
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 3.0.0
#inventory
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 3.0.0
name String 资源名称 3.0.0
ip String IP地址 3.0.0
port Integer 端口 3.0.0
chapUserName String CHAP用户名 3.0.0
chapUserPassword String CHAP密码 3.0.0
state String 启用状态 3.0.0
createDate Timestamp 创建时间 3.0.0
lastOpDate Timestamp 最后一次修改时间 3.0.0
iscsiTargets List 详情参考iscsiTargets 3.0.0
iscsiClusterRefs List 详情参考iscsiClusterRefs 3.0.0
#iscsiTargets
名字 类型 描述 起始版本
iscsiServerUuid String iSCSI服务器UUID 3.0.0
uuid String 资源的UUID,唯一标示该资源 3.0.0
iqn String iSCSI IQN 3.0.0
createDate Timestamp 创建时间 3.0.0
lastOpDate Timestamp 最后一次修改时间 3.0.0
iscsiLuns List 详情参考iscsiLuns 3.0.0
#iscsiLuns
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 3.0.0
iscsiTargetUuid String iSCSI目标UUID 3.0.0
wwid String 唯一识别ID 3.0.0
vendor String 设备供应商 3.0.0
model String 设备型号 3.0.0
wwn String 设备WWN 3.0.0
serial String 设备序列号 3.0.0
hctl String SCSI设备HCTL 3.0.0
type String 设备类型 3.0.0
path String 设备路径 3.0.0
size Long 设备大小 3.0.0
createDate Timestamp 创建时间 3.0.0
lastOpDate Timestamp 最后一次修改时间 3.0.0
#iscsiClusterRefs
名字 类型 描述 起始版本
iscsiServerUuid String 3.0.0
clusterUuid String 集群UUID 3.0.0
createDate Timestamp 创建时间 3.0.0
lastOpDate Timestamp 最后一次修改时间 3.0.0

SDK示例

Java SDK
UpdateIscsiServerAction action = new UpdateIscsiServerAction();
action.uuid = "98d2177199ca301d9fd842eace2dbc67";
action.name = "test-iscsi-server";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateIscsiServerAction.Result res = action.call();
Python SDK
UpdateIscsiServerAction action = UpdateIscsiServerAction()
action.uuid = "98d2177199ca301d9fd842eace2dbc67"
action.name = "test-iscsi-server"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateIscsiServerAction.Result res = action.call()

将iSCSI服务器加载到集群(AttachIscsiServerToCluster)

API请求

URLs
POST zstack/v1/clusters/{clusterUuid}/storage-devices/iscsi/servers/{uuid}
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {},
  "systemTags": [],
  "userTags": []
}
Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{}}' http://localhost:8080/zstack/v1/clusters/ee5a78dfa67b34598e9fe734111592a7/storage-devices/iscsi/servers/3ae1ec6d33d53ab7b8cea6e33e517e28
参数列表
名字 类型 位置 描述 可选值 起始版本
uuid String url iSCSI服务器的的UUID 3.0.0
clusterUuid String url 集群UUID 3.0.0
systemTags (可选) List body 3.0.0
userTags (可选) List body 3.0.0

API返回

返回示例
{
  "inventory": {
    "uuid": "a3d69cbb4ccc35f49354f34b9a52833d",
    "name": "iscsi-server-10.0.0.201",
    "ip": "10.0.0.201",
    "port": 3260.0,
    "chapUserName": "username",
    "chapUserPassword": "password",
    "state": "Enabled",
    "iscsiTargets": [
      {
        "iscsiServerUuid": "a3d69cbb4ccc35f49354f34b9a52833d",
        "uuid": "0a0f4da9f2ba3fddac178737e11cef73",
        "iqn": "iqn.2018-01.io.cloud:tsn.00001",
        "state": "Enabled",
        "iscsiLuns": [
          {
            "uuid": "f63e921f951435ee9d18901b8eccf986",
            "iscsiTargetUuid": "0a0f4da9f2ba3fddac178737e11cef73",
            "wwid": "36b083fe000daf018000015505abbe00a",
            "vendor": "DELL",
            "model": "MD32xx",
            "wwn": "0x6b083fe000daf018",
            "serial": "6b083fe000daf018000015505abbe00a",
            "hctl": "6:0:1:1",
            "type": "mpath",
            "path": "ip-0.0.0.201:3260-iscsi-iqn.2018-01.io.cloud:tsn.00001-lun-0",
            "size": 3.000318820352E13,
            "multipathDeviceUuid": "36b083fe000daf018000015505abbe00a"
          }
        ],
        "createDate": "Nov 14, 2017 10:20:57 PM",
        "lastOpDate": "Nov 14, 2017 10:20:57 PM"
      }
    ],
    "iscsiClusterRefs": [
      {
        "id": 1.0,
        "iscsiServerUuid": "a3d69cbb4ccc35f49354f34b9a52833d",
        "clusterUuid": "962af991872e3ac98a2c4a7385f92541",
        "createDate": "Nov 14, 2017 10:20:57 PM",
        "lastOpDate": "Nov 14, 2017 10:20:57 PM"
      }
    ],
    "createDate": "Nov 14, 2017 10:20:57 PM",
    "lastOpDate": "Nov 14, 2017 10:20:57 PM"
  }
}
名字 类型 描述 起始版本
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 3.0.0
inventory IscsiServerInventory 详情参考inventory 3.0.0
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 3.0.0
description String 错误的概要描述 3.0.0
details String 错误的详细信息 3.0.0
elaboration String 保留字段,默认为null 3.0.0
opaque LinkedHashMap 保留字段,默认为null 3.0.0
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 3.0.0
#inventory
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 3.0.0
name String 资源名称 3.0.0
ip String IP地址 3.0.0
port Integer 端口 3.0.0
chapUserName String CHAP用户名 3.0.0
chapUserPassword String CHAP密码 3.0.0
state String 启用状态 3.0.0
createDate Timestamp 创建时间 3.0.0
lastOpDate Timestamp 最后一次修改时间 3.0.0
iscsiTargets List 详情参考iscsiTargets 3.0.0
iscsiClusterRefs List 详情参考iscsiClusterRefs 3.0.0
#iscsiTargets
名字 类型 描述 起始版本
iscsiServerUuid String iSCSI服务器UUID 3.0.0
uuid String 资源的UUID,唯一标示该资源 3.0.0
iqn String iSCSI IQN 3.0.0
createDate Timestamp 创建时间 3.0.0
lastOpDate Timestamp 最后一次修改时间 3.0.0
iscsiLuns List 详情参考iscsiLuns 3.0.0
#iscsiLuns
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 3.0.0
iscsiTargetUuid String iSCSI目标UUID 3.0.0
wwid String 唯一识别ID 3.0.0
vendor String 设备供应商 3.0.0
model String 设备型号 3.0.0
wwn String 设备WWN 3.0.0
serial String 设备序列号 3.0.0
hctl String SCSI设备HCTL 3.0.0
type String 设备类型 3.0.0
path String 设备路径 3.0.0
size Long 设备大小 3.0.0
createDate Timestamp 创建时间 3.0.0
lastOpDate Timestamp 最后一次修改时间 3.0.0
#iscsiClusterRefs
名字 类型 描述 起始版本
iscsiServerUuid String 3.0.0
clusterUuid String 集群UUID 3.0.0
createDate Timestamp 创建时间 3.0.0
lastOpDate Timestamp 最后一次修改时间 3.0.0

SDK示例

Java SDK
AttachIscsiServerToClusterAction action = new AttachIscsiServerToClusterAction();
action.uuid = "3ae1ec6d33d53ab7b8cea6e33e517e28";
action.clusterUuid = "ee5a78dfa67b34598e9fe734111592a7";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AttachIscsiServerToClusterAction.Result res = action.call();
Python SDK
AttachIscsiServerToClusterAction action = AttachIscsiServerToClusterAction()
action.uuid = "3ae1ec6d33d53ab7b8cea6e33e517e28"
action.clusterUuid = "ee5a78dfa67b34598e9fe734111592a7"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AttachIscsiServerToClusterAction.Result res = action.call()

将iSCSI服务器从集群卸载(DetachIscsiServerFromCluster)

API请求

URLs
DELETE zstack/v1/clusters/{clusterUuid}/storage-devices/iscsi/servers/{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/clusters/81ecbd4ae7c9346aa3225592441c36df/storage-devices/iscsi/servers/132d1caceecd3847b30bd901485ccc44
参数列表
名字 类型 位置 描述 可选值 起始版本
uuid String url iSCSI服务器的UUID 3.0.0
clusterUuid String url 集群UUID 3.0.0
systemTags (可选) List body 3.0.0
userTags (可选) List body 3.0.0

API返回

返回示例
{
  "inventory": {
    "uuid": "2c42d5e271e93a91a4467bf936a21018",
    "ip": "10.0.0.201",
    "port": 3260.0,
    "chapUserName": "username",
    "chapUserPassword": "password",
    "state": "Enabled",
    "iscsiTargets": [
      {
        "iscsiServerUuid": "2c42d5e271e93a91a4467bf936a21018",
        "uuid": "84fb04ce8ac03803b99cab5cccd831d1",
        "iqn": "iqn.2018-01.io.cloud:tsn.00001",
        "state": "Enabled",
        "iscsiLuns": [
          {
            "uuid": "44d2c6a338123031a55ce32f102432af",
            "iscsiTargetUuid": "84fb04ce8ac03803b99cab5cccd831d1",
            "wwid": "36b083fe000daf018000015505abbe00a",
            "vendor": "DELL",
            "model": "MD32xx",
            "wwn": "0x6b083fe000daf018",
            "serial": "6b083fe000daf018000015505abbe00a",
            "hctl": "6:0:1:1",
            "type": "mpath",
            "path": "ip-0.0.0.201:3260-iscsi-iqn.2018-01.io.cloud:tsn.00001-lun-0",
            "size": 3.000318820352E13,
            "multipathDeviceUuid": "36b083fe000daf018000015505abbe00a"
          }
        ],
        "createDate": "Nov 14, 2017 10:20:57 PM",
        "lastOpDate": "Nov 14, 2017 10:20:57 PM"
      }
    ],
    "iscsiClusterRefs": [
      {
        "id": 1.0,
        "iscsiServerUuid": "2c42d5e271e93a91a4467bf936a21018",
        "clusterUuid": "ced139d5eded3049bbfe8364804fa8c0",
        "createDate": "Nov 14, 2017 10:20:57 PM",
        "lastOpDate": "Nov 14, 2017 10:20:57 PM"
      }
    ],
    "createDate": "Nov 14, 2017 10:20:57 PM",
    "lastOpDate": "Nov 14, 2017 10:20:57 PM"
  }
}
名字 类型 描述 起始版本
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 3.0.0
inventory IscsiServerInventory 详情参考inventory 3.0.0
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 3.0.0
description String 错误的概要描述 3.0.0
details String 错误的详细信息 3.0.0
elaboration String 保留字段,默认为null 3.0.0
opaque LinkedHashMap 保留字段,默认为null 3.0.0
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 3.0.0
#inventory
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 3.0.0
name String 资源名称 3.0.0
ip String IP地址 3.0.0
port Integer 端口 3.0.0
chapUserName String CHAP用户名 3.0.0
chapUserPassword String CHAP密码 3.0.0
state String 启用状态 3.0.0
createDate Timestamp 创建时间 3.0.0
lastOpDate Timestamp 最后一次修改时间 3.0.0
iscsiTargets List 详情参考iscsiTargets 3.0.0
iscsiClusterRefs List 详情参考iscsiClusterRefs 3.0.0
#iscsiTargets
名字 类型 描述 起始版本
iscsiServerUuid String iSCSI服务器UUID 3.0.0
uuid String 资源的UUID,唯一标示该资源 3.0.0
iqn String iSCSI IQN 3.0.0
createDate Timestamp 创建时间 3.0.0
lastOpDate Timestamp 最后一次修改时间 3.0.0
iscsiLuns List 详情参考iscsiLuns 3.0.0
#iscsiLuns
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 3.0.0
iscsiTargetUuid String iSCSI目标UUID 3.0.0
wwid String 唯一识别ID 3.0.0
vendor String 设备供应商 3.0.0
model String 设备型号 3.0.0
wwn String 设备WWN 3.0.0
serial String 设备序列号 3.0.0
hctl String SCSI设备HCTL 3.0.0
type String 设备类型 3.0.0
path String 设备路径 3.0.0
size Long 设备大小 3.0.0
createDate Timestamp 创建时间 3.0.0
lastOpDate Timestamp 最后一次修改时间 3.0.0
#iscsiClusterRefs
名字 类型 描述 起始版本
iscsiServerUuid String 3.0.0
clusterUuid String 集群UUID 3.0.0
createDate Timestamp 创建时间 3.0.0
lastOpDate Timestamp 最后一次修改时间 3.0.0

SDK示例

Java SDK
DetachIscsiServerFromClusterAction action = new DetachIscsiServerFromClusterAction();
action.uuid = "132d1caceecd3847b30bd901485ccc44";
action.clusterUuid = "81ecbd4ae7c9346aa3225592441c36df";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DetachIscsiServerFromClusterAction.Result res = action.call();
Python SDK
DetachIscsiServerFromClusterAction action = DetachIscsiServerFromClusterAction()
action.uuid = "132d1caceecd3847b30bd901485ccc44"
action.clusterUuid = "81ecbd4ae7c9346aa3225592441c36df"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DetachIscsiServerFromClusterAction.Result res = action.call()

查询iSCSI磁盘(QueryIscsiLun)

API请求

URLs
GET zstack/v1/storage-devices/iscsi/luns
GET zstack/v1/storage-devices/iscsi/luns/{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/storage-devices/iscsi/luns
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/storage-devices/iscsi/luns/da96929549c63b66b8afc63be70a373f

可查询字段

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

API返回

返回示例
{
  "inventories": [
    {
      "uuid": "d833304319da3b32bc92f21c763a8e5b",
      "wwid": "36b083fe000daf018000015505abbe00a",
      "vendor": "DELL",
      "model": "MD32xx",
      "wwn": "0x6b083fe000daf018",
      "serial": "6b083fe000daf018000015505abbe00a",
      "hctl": "6:0:1:1",
      "type": "mpath",
      "path": "ip-0.0.0.201:3260-iscsi-iqn.2018-01.io.cloud:tsn.00001-lun-0",
      "size": 3.000318820352E13,
      "multipathDeviceUuid": "36b083fe000daf018000015505abbe00a"
    },
    {
      "uuid": "a21ee1e2e3f63a61ac983c53c29552d2",
      "wwid": "36b083fe000daf018000015505abbe00a",
      "vendor": "DELL",
      "model": "MD32xx",
      "wwn": "0x6b083fe000daf018",
      "serial": "6b083fe000daf018000015505abbe00a",
      "hctl": "6:0:3:1",
      "type": "mpath",
      "path": "ip-0.0.0.201:3260-iscsi-iqn.2018-01.io.cloud:tsn.00002-lun-0",
      "size": 3.000318820352E13,
      "multipathDeviceUuid": "36b083fe000daf018000015505abbe00a"
    }
  ]
}
名字 类型 描述 起始版本
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 3.0.0
inventories List 详情参考inventories 3.0.0
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 3.0.0
description String 错误的概要描述 3.0.0
details String 错误的详细信息 3.0.0
elaboration String 保留字段,默认为null 3.0.0
opaque LinkedHashMap 保留字段,默认为null 3.0.0
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 3.0.0
#inventories
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 3.0.0
iscsiTargetUuid String iSCSI目标UUID 3.0.0
wwid String 唯一识别ID 3.0.0
vendor String 设备供应商 3.0.0
model String 设备型号 3.0.0
wwn String 设备WWN 3.0.0
serial String 设备序列号 3.0.0
hctl String SCSI设备HCTL 3.0.0
type String 设备类型 3.0.0
path String 设备路径 3.0.0
size Long 设备大小 3.0.0
createDate Timestamp 创建时间 3.0.0
lastOpDate Timestamp 最后一次修改时间 3.0.0

SDK示例

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

FC存储相关接口

查询FC SAN存储(QueryFiberChannelStorage)

API请求

URLs
GET zstack/v1/storage-devices/fiber-channel/controllers
GET zstack/v1/storage-devices/fiber-channel
GET zstack/v1/storage-devices/fiber-channel/controllers/{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/storage-devices/fiber-channel/controllers?
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/storage-devices/fiber-channel?
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/storage-devices/fiber-channel/controllers/6ca3d260093e3c06840309e9e756b1bf

可查询字段

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

API返回

返回示例
{
  "inventories": [
    {
      "uuid": "afedd6ab89d338fbaab258f981ca2295",
      "state": "Enabled",
      "fiberChannelLuns": [
        {
          "fiberChannelStorageUuid": "afedd6ab89d338fbaab258f981ca2295",
          "name": "fc-lun-36b083fe000daf018000022905ba35d8f",
          "uuid": "2e69f8443fbc3ec3a25a92ab8632f80f",
          "wwid": "36b083fe000daf018000022905ba35d8f",
          "vendor": "DELL",
          "model": "MD32xx",
          "wwn": "0x6f01faf000d5c3e7",
          "serial": "6b083fe000daf018000015505abbe00a",
          "type": "mpath",
          "path": "pci-0000:05:00.0-fc-0x2012b083fedaf018-lun-11",
          "size": 5.49755813888E12,
          "scsiLunHostRefs": [
            {
              "id": 3.0,
              "scsiLunUuid": "5a89fbd0d7793673acfa2e69acc56ce4",
              "hostUuid": "bc3f69d449aa3410bd7267a1050de980",
              "createDate": "Nov 14, 2017 10:20:57 PM",
              "lastOpDate": "Nov 14, 2017 10:20:57 PM"
            }
          ],
          "scsiLunVmInstanceRefs": []
        },
        {
          "fiberChannelStorageUuid": "afedd6ab89d338fbaab258f981ca2295",
          "name": "fc-lun-36f01faf000d5c3e7000023ef5ba362f2",
          "uuid": "52039a86c9173ff7a86ce214fc3d47cf",
          "wwid": "36f01faf000d5c3e7000023ef5ba362f2",
          "vendor": "DELL",
          "model": "MD32xx",
          "wwn": "0x6b083fe000daf018",
          "serial": "6b083fe000daf018000015505abbe00a",
          "type": "mpath",
          "path": "pci-0000:05:00.0-fc-0x2012b083fedaf018-lun-12",
          "size": 5.49755813888E12,
          "scsiLunHostRefs": [
            {
              "id": 3.0,
              "scsiLunUuid": "5a89fbd0d7793673acfa2e69acc56ce4",
              "hostUuid": "bc3f69d449aa3410bd7267a1050de980",
              "createDate": "Nov 14, 2017 10:20:57 PM",
              "lastOpDate": "Nov 14, 2017 10:20:57 PM"
            }
          ],
          "scsiLunVmInstanceRefs": []
        }
      ],
      "createDate": "Nov 14, 2017 10:20:57 PM",
      "lastOpDate": "Nov 14, 2017 10:20:57 PM"
    },
    {
      "uuid": "4e902db710403f68a7703e45d00e551d",
      "state": "Enabled",
      "createDate": "Nov 14, 2017 10:20:57 PM",
      "lastOpDate": "Nov 14, 2017 10:20:57 PM"
    }
  ]
}
名字 类型 描述 起始版本
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 3.1.0
inventories List 详情参考inventories 3.1.0
#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,唯一标示该资源 3.1.0
name String 资源名称 3.1.0
wwnn String FC SAN全局唯一表示 3.1.0
state String 启用状态 3.1.0
createDate Timestamp 创建时间 3.1.0
lastOpDate Timestamp 最后一次修改时间 3.1.0
fiberChannelLuns List 详情参考fiberChannelLuns 3.1.0
#fiberChannelLuns
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 3.1.0
fiberChannelStorageUuid String FC SAN存储UUID 3.1.0
wwid String 磁盘全局唯一表示 3.1.0
vendor String 供应商 3.1.0
model String 型号 3.1.0
wwn String 磁盘WWN 3.1.0
serial String 磁盘序列号 3.1.0
type String 磁盘类型 3.1.0
path String 磁盘路径 3.1.0
size Long 磁盘大小 3.1.0
createDate Timestamp 创建时间 3.1.0
lastOpDate Timestamp 最后一次修改时间 3.1.0
name String 资源名称 3.1.0
state String 启用状态 3.1.0
scsiLunHostRefs List 详情参考scsiLunHostRefs 3.1.0
scsiLunVmInstanceRefs List 详情参考scsiLunVmInstanceRefs 3.1.0
#scsiLunHostRefs
名字 类型 描述 起始版本
scsiLunUuid String SCSI LUN UUID 3.1.0
hostUuid String 主机UUID 3.1.0
createDate Timestamp 创建时间 3.1.0
lastOpDate Timestamp 最后一次修改时间 3.1.0
#scsiLunVmInstanceRefs
名字 类型 描述 起始版本
scsiLunUuid String SCSI LUN UUID 3.1.0
vmInstanceUuid String 虚拟机UUID 3.1.0
createDate Timestamp 创建时间 3.1.0
lastOpDate Timestamp 最后一次修改时间 3.1.0

SDK示例

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

刷新FC SAN存储(RefreshFiberChannelStorage)

API请求

URLs
POST zstack/v1/storage-devices/fiber-channel/controllers
POST zstack/v1/storage-devices/fiber-channel/controllers/{uuid}
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "uuid": "52049ca66e8135f5aac2835aecab62a0"
  },
  "systemTags": [],
  "userTags": []
}
Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"uuid":"52049ca66e8135f5aac2835aecab62a0"}}' http://localhost:8080/zstack/v1/storage-devices/fiber-channel/controllers
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"uuid":"52049ca66e8135f5aac2835aecab62a0"}}' http://localhost:8080/zstack/v1/storage-devices/fiber-channel/controllers/52049ca66e8135f5aac2835aecab62a0
参数列表
名字 类型 位置 描述 可选值 起始版本
uuid (可选) String body(包含在params结构中) FC SAN存储的UUID,唯一标示该资源 3.1.0
zoneUuid String body(包含在params结构中) 数据中心UUID 3.1.0
systemTags (可选) List body 3.1.0
userTags (可选) List body 3.1.0

API返回

返回示例
{
  "inventories": [
    {
      "uuid": "971fa2e9e689304183d4eef676ad0241",
      "state": "Enabled",
      "fiberChannelLuns": [
        {
          "fiberChannelStorageUuid": "971fa2e9e689304183d4eef676ad0241",
          "name": "fc-lun-36b083fe000daf018000022905ba35d8f",
          "uuid": "2fb634b5c6ae3e1390360e982cdaf9d2",
          "wwid": "36b083fe000daf018000022905ba35d8f",
          "vendor": "DELL",
          "model": "MD32xx",
          "wwn": "0x6f01faf000d5c3e7",
          "serial": "6b083fe000daf018000015505abbe00a",
          "type": "mpath",
          "path": "pci-0000:05:00.0-fc-0x2012b083fedaf018-lun-11",
          "size": 5.49755813888E12,
          "scsiLunHostRefs": [
            {
              "id": 3.0,
              "scsiLunUuid": "fd0a53d0234e303c9ba7c316f5484a59",
              "hostUuid": "ef288e9807853188b76d3d445a35b345",
              "createDate": "Nov 14, 2017 10:20:57 PM",
              "lastOpDate": "Nov 14, 2017 10:20:57 PM"
            }
          ],
          "scsiLunVmInstanceRefs": []
        },
        {
          "fiberChannelStorageUuid": "971fa2e9e689304183d4eef676ad0241",
          "name": "fc-lun-36f01faf000d5c3e7000023ef5ba362f2",
          "uuid": "fb37b3bb268c38c3803b93ee60f25ef6",
          "wwid": "36f01faf000d5c3e7000023ef5ba362f2",
          "vendor": "DELL",
          "model": "MD32xx",
          "wwn": "0x6b083fe000daf018",
          "serial": "6b083fe000daf018000015505abbe00a",
          "type": "mpath",
          "path": "pci-0000:05:00.0-fc-0x2012b083fedaf018-lun-12",
          "size": 5.49755813888E12,
          "scsiLunHostRefs": [
            {
              "id": 3.0,
              "scsiLunUuid": "fd0a53d0234e303c9ba7c316f5484a59",
              "hostUuid": "ef288e9807853188b76d3d445a35b345",
              "createDate": "Nov 14, 2017 10:20:57 PM",
              "lastOpDate": "Nov 14, 2017 10:20:57 PM"
            }
          ],
          "scsiLunVmInstanceRefs": []
        }
      ],
      "createDate": "Nov 14, 2017 10:20:57 PM",
      "lastOpDate": "Nov 14, 2017 10:20:57 PM"
    },
    {
      "uuid": "ddc6eb334da838b08224ed6c43e67d0e",
      "state": "Enabled",
      "createDate": "Nov 14, 2017 10:20:57 PM",
      "lastOpDate": "Nov 14, 2017 10:20:57 PM"
    }
  ]
}
名字 类型 描述 起始版本
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 3.1.0
inventories List 详情参考inventories 3.1.0
#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,唯一标示该资源 3.1.0
name String 资源名称 3.1.0
wwnn String FC SAN全局唯一表示 3.1.0
state String 启用状态 3.1.0
createDate Timestamp 创建时间 3.1.0
lastOpDate Timestamp 最后一次修改时间 3.1.0
fiberChannelLuns List 详情参考fiberChannelLuns 3.1.0
#fiberChannelLuns
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 3.1.0
fiberChannelStorageUuid String FC SAN存储UUID 3.1.0
wwid String 磁盘全局唯一表示 3.1.0
vendor String 供应商 3.1.0
model String 型号 3.1.0
wwn String 磁盘WWN 3.1.0
serial String 磁盘序列号 3.1.0
type String 磁盘类型 3.1.0
path String 磁盘路径 3.1.0
size Long 磁盘大小 3.1.0
createDate Timestamp 创建时间 3.1.0
lastOpDate Timestamp 最后一次修改时间 3.1.0
name String 资源名称 3.1.0
state String 启用状态 3.1.0
scsiLunHostRefs List 详情参考scsiLunHostRefs 3.1.0
scsiLunVmInstanceRefs List 详情参考scsiLunVmInstanceRefs 3.1.0
#scsiLunHostRefs
名字 类型 描述 起始版本
scsiLunUuid String SCSI Lun UUID 3.1.0
hostUuid String 主机UUID 3.1.0
createDate Timestamp 创建时间 3.1.0
lastOpDate Timestamp 最后一次修改时间 3.1.0
#scsiLunVmInstanceRefs
名字 类型 描述 起始版本
scsiLunUuid String SCSI Lun UUID 3.1.0
vmInstanceUuid String 虚拟机UUID 3.1.0
createDate Timestamp 创建时间 3.1.0
lastOpDate Timestamp 最后一次修改时间 3.1.0

SDK示例

Java SDK
RefreshFiberChannelStorageAction action = new RefreshFiberChannelStorageAction();
action.uuid = "52049ca66e8135f5aac2835aecab62a0";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
RefreshFiberChannelStorageAction.Result res = action.call();
Python SDK
RefreshFiberChannelStorageAction action = RefreshFiberChannelStorageAction()
action.uuid = "52049ca66e8135f5aac2835aecab62a0"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
RefreshFiberChannelStorageAction.Result res = action.call()

更新SCSI LUN配置(UpdateScsiLun)

API请求

URLs
PUT zstack/v1/storage-devices/scsi-lun/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "updateScsiLun": {
    "name": "test-scsi-lun"
  },
  "systemTags": [],
  "userTags": []
}
Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateScsiLun":{"name":"test-scsi-lun"}}' http://localhost:8080/zstack/v1/storage-devices/scsi-lun/e2e9d7f44ee23960bc6e4e31b0a010d9/actions
参数列表
名字 类型 位置 描述 可选值 起始版本
uuid String url 资源的UUID,唯一标示该资源 3.1.0
name (可选) String body(包含在updateScsiLun结构中) 资源名称 3.1.0
state (可选) String body(包含在updateScsiLun结构中) 启用状态
  • Enabled
  • Disabled
3.1.0
systemTags (可选) List body 3.1.0
userTags (可选) List body 3.1.0

API返回

返回示例
{
  "inventory": {
    "name": "test-scsi-lun",
    "uuid": "57cefcdc1746340ba1649c446059aea0",
    "wwid": "36b083fe000daf018000022905ba35d8f",
    "vendor": "DELL",
    "model": "MD32xx",
    "wwn": "0x6f01faf000d5c3e7",
    "serial": "6b083fe000daf018000015505abbe00a",
    "type": "mpath",
    "path": "pci-0000:05:00.0-fc-0x2012b083fedaf018-lun-11",
    "size": 5.49755813888E12,
    "scsiLunHostRefs": [
      {
        "id": 1.0,
        "scsiLunUuid": "57cefcdc1746340ba1649c446059aea0",
        "hostUuid": "6e76dfbcc3b338c482ff51de1f0d76da",
        "createDate": "Nov 14, 2017 10:20:57 PM"
      }
    ],
    "scsiLunVmInstanceRefs": [],
    "createDate": "Nov 14, 2017 10:20:57 PM",
    "lastOpDate": "Nov 14, 2017 10:20:57 PM"
  }
}
名字 类型 描述 起始版本
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 3.1.0
inventory ScsiLunInventory 详情参考inventory 3.1.0
#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
名字 类型 描述 起始版本
name String 资源名称 3.1.0
uuid String 资源的UUID,唯一标示该资源 3.1.0
wwid String 磁盘全局唯一表示 3.1.0
vendor String 磁盘供应商 3.1.0
model String 磁盘型号 3.1.0
wwn String 磁盘WWN 3.1.0
serial String 磁盘序列号 3.1.0
type String 磁盘类型 3.1.0
path String 磁盘路径 3.1.0
state String 磁盘启用状态 3.1.0
size Long 磁盘大小 3.1.0
createDate Timestamp 创建时间 3.1.0
lastOpDate Timestamp 最后一次修改时间 3.1.0
scsiLunHostRefs List 详情参考scsiLunHostRefs 3.1.0
scsiLunVmInstanceRefs List 详情参考scsiLunVmInstanceRefs 3.1.0
#scsiLunHostRefs
名字 类型 描述 起始版本
scsiLunUuid String SCSI LUN UUID 3.1.0
hostUuid String 主机UUID 3.1.0
createDate Timestamp 创建时间 3.1.0
lastOpDate Timestamp 最后一次修改时间 3.1.0
#scsiLunVmInstanceRefs
名字 类型 描述 起始版本
scsiLunUuid String SCSI LUN UUID 3.1.0
vmInstanceUuid String 虚拟机UUID 3.1.0
createDate Timestamp 创建时间 3.1.0
lastOpDate Timestamp 最后一次修改时间 3.1.0

SDK示例

Java SDK
UpdateScsiLunAction action = new UpdateScsiLunAction();
action.uuid = "e2e9d7f44ee23960bc6e4e31b0a010d9";
action.name = "test-scsi-lun";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateScsiLunAction.Result res = action.call();
Python SDK
UpdateScsiLunAction action = UpdateScsiLunAction()
action.uuid = "e2e9d7f44ee23960bc6e4e31b0a010d9"
action.name = "test-scsi-lun"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateScsiLunAction.Result res = action.call()

将SCSI LUN加载到虚拟机(AttachScsiLunToVmInstance)

API请求

URLs
POST zstack/v1/vm-instances/{vmInstanceUuid}/scsi-lun/{uuid}
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "disableMultiPathAttach": false
  },
  "systemTags": [],
  "userTags": []
}
Note:

上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。

Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"disableMultiPathAttach":false}}' http://localhost:8080/zstack/v1/vm-instances/e5bc51b4fdd13d35b4abe7be408435d4/scsi-lun/e4ea0f73829b3206a497c88b896613d6
参数列表
名字 类型 位置 描述 可选值 起始版本
uuid String url SCSI LUN的UUID,唯一标示该资源 3.1.0
vmInstanceUuid String url 虚拟机UUID 3.1.0
disableMultiPathAttach (可选) String url 关闭自动加载多路径设备 3.1.0
systemTags (可选) List body 3.1.0
userTags (可选) List body 3.1.0

API返回

返回示例
{
  "inventory": {
    "name": "fc-lun-36b083fe000daf018000022905ba35d8f",
    "uuid": "d20114f179003943904fee1127d16eba",
    "wwid": "36b083fe000daf018000022905ba35d8f",
    "vendor": "DELL",
    "model": "MD32xx",
    "wwn": "0x6f01faf000d5c3e7",
    "serial": "6b083fe000daf018000015505abbe00a",
    "type": "mpath",
    "path": "pci-0000:05:00.0-fc-0x2012b083fedaf018-lun-11",
    "size": 5.49755813888E12,
    "scsiLunHostRefs": [
      {
        "id": 1.0,
        "scsiLunUuid": "d20114f179003943904fee1127d16eba",
        "hostUuid": "e62d261d3f293e0182f85779e105eb13",
        "createDate": "Nov 14, 2017 10:20:57 PM"
      }
    ],
    "scsiLunVmInstanceRefs": [
      {
        "id": 1.0,
        "scsiLunUuid": "d20114f179003943904fee1127d16eba",
        "vmInstanceUuid": "84af387a5ef034818cc8488eaddbf5f3",
        "createDate": "Nov 14, 2017 10:20:57 PM",
        "attachMultipath": false
      }
    ],
    "createDate": "Nov 14, 2017 10:20:57 PM",
    "lastOpDate": "Nov 14, 2017 10:20:57 PM"
  }
}
名字 类型 描述 起始版本
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 3.1.0
inventory ScsiLunInventory 详情参考inventory 3.1.0
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 3.1.0
description String 错误的概要描述 3.1.0
details String 错误的详细信息 3.1.0
elaboration String 保留字段,默认为null 3.1.0
opaque LinkedHashMap 保留字段,默认为null 3.1.0
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 3.1.0
#inventory
名字 类型 描述 起始版本
name String 资源名称 3.1.0
uuid String 资源的UUID,唯一标示该资源 3.1.0
wwid String 磁盘全局唯一表示 3.1.0
vendor String 磁盘供应商 3.1.0
model String 磁盘型号 3.1.0
wwn String 磁盘WWN 3.1.0
serial String 磁盘序列号 3.1.0
type String 磁盘类型 3.1.0
path String 磁盘路径 3.1.0
state String 磁盘启用状态 3.1.0
size Long 磁盘大小 3.1.0
createDate Timestamp 创建时间 3.1.0
lastOpDate Timestamp 最后一次修改时间 3.1.0
scsiLunHostRefs List 详情参考scsiLunHostRefs 3.1.0
scsiLunVmInstanceRefs List 详情参考scsiLunVmInstanceRefs 3.1.0
#scsiLunHostRefs
名字 类型 描述 起始版本
scsiLunUuid String SCSI LUN UUID 3.1.0
hostUuid String 主机UUID 3.1.0
createDate Timestamp 创建时间 3.1.0
lastOpDate Timestamp 最后一次修改时间 3.1.0
#scsiLunVmInstanceRefs
名字 类型 描述 起始版本
scsiLunUuid String SCSI LUN UUID 3.1.0
vmInstanceUuid String 虚拟机UUID 3.1.0
createDate Timestamp 创建时间 3.1.0
lastOpDate Timestamp 最后一次修改时间 3.1.0

SDK示例

Java SDK
AttachScsiLunToVmInstanceAction action = new AttachScsiLunToVmInstanceAction();
action.uuid = "e4ea0f73829b3206a497c88b896613d6";
action.vmInstanceUuid = "e5bc51b4fdd13d35b4abe7be408435d4";
action.disableMultiPathAttach = false;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AttachScsiLunToVmInstanceAction.Result res = action.call();
Python SDK
AttachScsiLunToVmInstanceAction action = AttachScsiLunToVmInstanceAction()
action.uuid = "e4ea0f73829b3206a497c88b896613d6"
action.vmInstanceUuid = "e5bc51b4fdd13d35b4abe7be408435d4"
action.disableMultiPathAttach = false
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AttachScsiLunToVmInstanceAction.Result res = action.call()

将SCSI LUN从虚拟机卸载(DetachScsiLunFromVmInstance)

API请求

URLs
DELETE zstack/v1/vm-instances/{vmInstanceUuid}/scsi-lun/{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/vm-instances/68b34252ae3a386e92b74ce3a2bd7e4a/scsi-lun/4af9531a118a3b7aba404d794a4cfa51
参数列表
名字 类型 位置 描述 可选值 起始版本
uuid String url 资源的UUID,唯一标示该资源 3.1.0
vmInstanceUuid String url 虚拟机UUID 3.1.0
systemTags (可选) List body 3.1.0
userTags (可选) List body 3.1.0

API返回

返回示例

{
  "inventory": {
    "name": "fc-lun-36b083fe000daf018000022905ba35d8f",
    "uuid": "a51554a318e333f1b96a7abe91674ede",
    "wwid": "36b083fe000daf018000022905ba35d8f",
    "vendor": "DELL",
    "model": "MD32xx",
    "wwn": "0x6f01faf000d5c3e7",
    "serial": "6b083fe000daf018000015505abbe00a",
    "type": "mpath",
    "path": "pci-0000:05:00.0-fc-0x2012b083fedaf018-lun-11",
    "size": 5.49755813888E12,
    "scsiLunHostRefs": [
      {
        "id": 1.0,
        "scsiLunUuid": "a51554a318e333f1b96a7abe91674ede",
        "hostUuid": "5c5a4a7c480e3b5791e0915785968eb1",
        "createDate": "Nov 14, 2017 10:20:57 PM"
      }
    ],
    "scsiLunVmInstanceRefs": [],
    "createDate": "Nov 14, 2017 10:20:57 PM",
    "lastOpDate": "Nov 14, 2017 10:20:57 PM"
  }
}
名字 类型 描述 起始版本
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 3.1.0
inventory ScsiLunInventory 详情参考inventory 3.1.0
#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
名字 类型 描述 起始版本
name String 资源名称 3.1.0
uuid String 资源的UUID,唯一标示该资源 3.1.0
wwid String 磁盘全局唯一表示 3.1.0
vendor String 磁盘供应商 3.1.0
model String 磁盘型号 3.1.0
wwn String 磁盘WWN 3.1.0
serial String 磁盘序列号 3.1.0
type String 磁盘类型 3.1.0
path String 磁盘路径 3.1.0
state String 磁盘启用状态 3.1.0
size Long 磁盘大小 3.1.0
createDate Timestamp 创建时间 3.1.0
lastOpDate Timestamp 最后一次修改时间 3.1.0
scsiLunHostRefs List 详情参考scsiLunHostRefs 3.1.0
scsiLunVmInstanceRefs List 详情参考scsiLunVmInstanceRefs 3.1.0
#scsiLunHostRefs
名字 类型 描述 起始版本
scsiLunUuid String SCSI LUN UUID 3.1.0
hostUuid String 主机UUID 3.1.0
createDate Timestamp 创建时间 3.1.0
lastOpDate Timestamp 最后一次修改时间 3.1.0
#scsiLunVmInstanceRefs
名字 类型 描述 起始版本
scsiLunUuid String SCSI LUN UUID 3.1.0
vmInstanceUuid String 虚拟机UUID 3.1.0
createDate Timestamp 创建时间 3.1.0
lastOpDate Timestamp 最后一次修改时间 3.1.0

SDK示例

Java SDK
DetachScsiLunFromVmInstanceAction action = new DetachScsiLunFromVmInstanceAction();
action.uuid = "4af9531a118a3b7aba404d794a4cfa51";
action.vmInstanceUuid = "68b34252ae3a386e92b74ce3a2bd7e4a";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DetachScsiLunFromVmInstanceAction.Result res = action.call();
Python SDK
DetachScsiLunFromVmInstanceAction action = DetachScsiLunFromVmInstanceAction()
action.uuid = "4af9531a118a3b7aba404d794a4cfa51"
action.vmInstanceUuid = "68b34252ae3a386e92b74ce3a2bd7e4a"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DetachScsiLunFromVmInstanceAction.Result res = action.call()

NVMe存储相关接口

查询NVMe磁盘(QueryNvmeLun)

API请求

URLs
GET zstack/v1/storage-devices/nvme/luns
GET zstack/v1/storage-devices/nvme/luns/{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/storage-devices/nvme/luns
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/storage-devices/nvme/luns/066996e131e03824a7ef6a22defed432

可查询字段

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

API返回

返回示例
{
  "inventories": [
    {
      "nvmeTargetUuid": "f04819a9445c3d068c075e753d48fc3c",
      "nvmeLunHostRefs": [],
      "name": "nvme-lun-36b083fe000daf018000022905ba35d8f",
      "uuid": "138c10cda11c3b8e9c7d988350d5cf64",
      "wwid": "uuid.48daeab7-7f15-405e-8481-7152cb9b0aca",
      "wwn": "uuid.48daeab7-7f15-405e-8481-7152cb9b0aca",
      "serial": "3d87eca1686c1782",
      "type": "disk",
      "path": "nvme-uuid.48daeab7-7f15-405e-8481-7152cb9b0aca ",
      "size": 5497558138880
    }
  ]
}
名字 类型 描述 起始版本
success boolean 4.6.21
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 4.6.21
inventories List 详情参考inventories 4.6.21
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 4.6.21
description String 错误的概要描述 4.6.21
details String 错误的详细信息 4.6.21
elaboration String 保留字段,默认为null 4.6.21
opaque LinkedHashMap 保留字段,默认为null 4.6.21
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 4.6.21
#inventories
名字 类型 描述 起始版本
nvmeTargetUuid String 所属NVMe设备UUID 4.6.21
name String 资源名称 4.6.21
uuid String 资源的UUID,唯一标示该资源 4.6.21
wwid String 全局唯一标识 4.6.21
vendor String 供应商 4.6.21
model String 型号 4.6.21
wwn String 4.6.21
serial String 序列号 4.6.21
type String 类型 4.6.21
hctl String 4.6.21
path String 路径 4.6.21
state String 状态 4.6.21
size Long 大小 4.6.21
multipathDeviceUuid String 多路径设备UUID 4.6.21
source String 磁盘来源,NVMe 4.6.21
createDate Timestamp 创建时间 4.6.21
lastOpDate Timestamp 最后一次修改时间 4.6.21
nvmeLunHostRefs List 详情参考nvmeLunHostRefs 4.6.21
#nvmeLunHostRefs
名字 类型 描述 起始版本
nvmeLunUuid List NVme磁盘UUID 4.6.21
hostUuid String 主机UUID 4.6.21
path String 磁盘路径 4.6.21
hctl String 磁盘HCTL 4.6.21
createDate Timestamp 创建时间 4.6.21
lastOpDate Timestamp 最后一次修改时间 4.6.21

SDK示例

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

查询NVMe设备(QueryNvmeTarget)

API请求

URLs
GET zstack/v1/storage-devices/nvme/controllers
GET zstack/v1/storage-devices/nvme
GET zstack/v1/storage-devices/nvme/controllers/{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/storage-devices/nvme/controllers
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/storage-devices/nvme
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/storage-devices/nvme/controllers/de0f2549ed0130948f14b00916fbf9a0

可查询字段

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

API返回

返回示例
{
  "inventories": [
    {
      "uuid": "40ab069909633d4293c62f44efb26db8",
      "state": "Enabled",
      "nvmeLuns": [
        {
          "nvmeTargetUuid": "40ab069909633d4293c62f44efb26db8",
          "nvmeLunHostRefs": [
            {
              "id": 1,
              "nvmeLunUuid": "5690b46050623763a0335e753c347fa1",
              "hostUuid": "d6f8a7ff0069304080b345c077c3aeb9",
              "createDate": "Nov 14, 2017 10:20:57 PM",
              "lastOpDate": "Nov 14, 2017 10:20:57 PM"
            }
          ],
          "name": "nvme-lun-36b083fe000daf018000022905ba35d8f",
          "uuid": "5690b46050623763a0335e753c347fa1",
          "wwid": "uuid.48daeab7-7f15-405e-8481-7152cb9b0aca",
          "wwn": "uuid.48daeab7-7f15-405e-8481-7152cb9b0aca",
          "serial": "3d87eca1686c1782",
          "type": "disk",
          "path": "nvme-uuid.48daeab7-7f15-405e-8481-7152cb9b0aca ",
          "size": 5497558138880
        }
      ],
      "createDate": "Nov 14, 2017 10:20:57 PM",
      "lastOpDate": "Nov 14, 2017 10:20:57 PM"
    }
  ]
}
名字 类型 描述 起始版本
success boolean 4.6.21
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 4.6.21
inventories List 详情参考inventories 4.6.21
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 4.6.21
description String 错误的概要描述 4.6.21
details String 错误的详细信息 4.6.21
elaboration String 保留字段,默认为null 4.6.21
opaque LinkedHashMap 保留字段,默认为null 4.6.21
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 4.6.21
#inventories
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 4.6.21
name String 资源名称 4.6.21
nqn String NVMe限定名称 4.6.21
state String 状态 4.6.21
createDate Timestamp 创建时间 4.6.21
lastOpDate Timestamp 最后一次修改时间 4.6.21
nvmeLuns List 详情参考nvmeLuns 4.6.21
#nvmeLuns
名字 类型 描述 起始版本
nvmeTargetUuid String 所属NVMe设备UUID 4.6.21
name String 资源名称 4.6.21
uuid String 资源的UUID,唯一标示该资源 4.6.21
wwid String 全局唯一标识 4.6.21
vendor String 供应商 4.6.21
model String 型号 4.6.21
wwn String 4.6.21
serial String 序列号 4.6.21
type String 类型 4.6.21
hctl String 4.6.21
path String 路径 4.6.21
state String 状态 4.6.21
size Long 大小 4.6.21
multipathDeviceUuid String 多路径设备UUID 4.6.21
source String 磁盘来源,NVMe 4.6.21
createDate Timestamp 创建时间 4.6.21
lastOpDate Timestamp 最后一次修改时间 4.6.21
nvmeLunHostRefs List 详情参考nvmeLunHostRefs 4.6.21
#nvmeLunHostRefs
名字 类型 描述 起始版本
nvmeLunUuid List NVme磁盘UUID 4.6.21
hostUuid String 主机UUID 4.6.21
path String 磁盘路径 4.6.21
hctl String 磁盘HCTL 4.6.21
createDate Timestamp 创建时间 4.6.21
lastOpDate Timestamp 最后一次修改时间 4.6.21

SDK示例

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

刷新NVMe设备(RefreshNvmeTarget)

API请求

URLs
POST zstack/v1/storage-devices/nvme/controllers
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "zoneUuid": "7a7b52cf91933070af3c8273f30ef458"
  },
  "systemTags": [],
  "userTags": []
}
Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"zoneUuid":"7a7b52cf91933070af3c8273f30ef458"}}' \
http://localhost:8080/zstack/v1/storage-devices/nvme/controllers
参数列表
名字 类型 位置 描述 可选值 起始版本
zoneUuid String body(包含在params结构中) 数据中心UUID 4.6.21
nvmeLunUuids (可选) List body(包含在params结构中) NVMe磁盘UUID 4.6.21
systemTags (可选) List body 系统标签 4.6.21
userTags (可选) List body 用户标签 4.6.21

API返回

返回示例
{
  "inventories": [
    {
      "uuid": "88ed12f1c3d7329c9b3fd00a87ce999e",
      "state": "Enabled",
      "nvmeLuns": [
        {
          "nvmeTargetUuid": "88ed12f1c3d7329c9b3fd00a87ce999e",
          "nvmeLunHostRefs": [
            {
              "id": 1,
              "nvmeLunUuid": "3adbd21bfa483cb2bc48b91c1438c788",
              "hostUuid": "8c26dfd50d963292b8a51ddc0f9957f5",
              "createDate": "Nov 14, 2017 10:20:57 PM",
              "lastOpDate": "Nov 14, 2017 10:20:57 PM"
            }
          ],
          "name": "nvme-lun-36b083fe000daf018000022905ba35d8f",
          "uuid": "3adbd21bfa483cb2bc48b91c1438c788",
          "wwid": "uuid.48daeab7-7f15-405e-8481-7152cb9b0aca",
          "wwn": "uuid.48daeab7-7f15-405e-8481-7152cb9b0aca",
          "serial": "3d87eca1686c1782",
          "type": "disk",
          "path": "nvme-uuid.48daeab7-7f15-405e-8481-7152cb9b0aca ",
          "size": 5497558138880
        }
      ],
      "createDate": "Nov 14, 2017 10:20:57 PM",
      "lastOpDate": "Nov 14, 2017 10:20:57 PM"
    }
  ]
}
名字 类型 描述 起始版本
success boolean 4.6.21
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 4.6.21
inventories List 详情参考inventories 4.6.21
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 4.6.21
description String 错误的概要描述 4.6.21
details String 错误的详细信息 4.6.21
elaboration String 保留字段,默认为null 4.6.21
opaque LinkedHashMap 保留字段,默认为null 4.6.21
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 4.6.21
#inventories
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 4.6.21
name String 资源名称 4.6.21
nqn String NVMe限定名称 4.6.21
state String 状态 4.6.21
createDate Timestamp 创建时间 4.6.21
lastOpDate Timestamp 最后一次修改时间 4.6.21
nvmeLuns List 详情参考nvmeLuns. 4.6.21
#nvmeLuns
名字 类型 描述 起始版本
nvmeTargetUuid String 所属NVMe设备UUID 4.6.21
name String 资源名称 4.6.21
uuid String 资源的UUID,唯一标示该资源 4.6.21
wwid String 全局唯一标识 4.6.21
vendor String 供应商 4.6.21
model String 型号 4.6.21
wwn String 4.6.21
serial String 序列号 4.6.21
type String 类型 4.6.21
hctl String 4.6.21
path String 路径 4.6.21
state String 状态 4.6.21
size Long 大小 4.6.21
multipathDeviceUuid String 多路径设备UUID 4.6.21
source String 磁盘来源,NVMe 4.6.21
createDate Timestamp 创建时间 4.6.21
lastOpDate Timestamp 最后一次修改时间 4.6.21
nvmeLunHostRefs List 详情参考nvmeLunHostRefs. 4.6.21
#nvmeLunHostRefs
名字 类型 描述 起始版本
nvmeLunUuid List NVme磁盘UUID 4.6.21
hostUuid String 主机UUID 4.6.21
path String 磁盘路径 4.6.21
hctl String 磁盘HCTL 4.6.21
createDate Timestamp 创建时间 4.6.21
lastOpDate Timestamp 最后一次修改时间 4.6.21

SDK示例

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

添加NVMe服务器(AddNvmeServer)

API请求

URLs
POST zstack/v1/storage-devices/nvme/servers
Headers
Authorization: OAuth the-session-uuid
Body
{
  "params": {
    "ip": "10.0.0.201",
    "port": 4420
  },
  "systemTags": [],
  "userTags": []
}
Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"ip":"10.0.0.201","port":4420}}' \
http://localhost:8080/zstack/v1/storage-devices/nvme/servers
参数列表
名字 类型 位置 描述 可选值 起始版本
name (可选) String body(包含在params结构中) 名称 4.7.21
ip String body(包含在params结构中) IP地址 4.7.21
port (可选) Integer body(包含在params结构中) 端口 4.7.21
transport String body(包含在params结构中) 目标传输类型 4.7.21
resourceUuid (可选) String body(包含在params结构中) 资源UUID 4.7.21
tagUuids (可选) List body(包含在params结构中) 标签UUID列表 4.7.21
systemTags (可选) List body 系统标签 4.7.21
userTags (可选) List body 用户标签 4.7.21

API返回

返回示例
{
  "inventory": {
    "uuid": "13b261814cc036629e76e2e218d3c764",
    "name": "nvme-server-10.0.0.201",
    "ip": "10.0.0.201",
    "port": 3260,
    "state": "Enabled",
    "createDate": "Nov 14, 2017 2:20:57 PM",
    "lastOpDate": "Nov 14, 2017 2:20:57 PM"
  }
}
名字 类型 描述 起始版本
success boolean 4.7.21
inventory NvmeServerInventory 详情参考inventory 4.7.21
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 4.7.21
#inventory
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 4.7.21
name String 资源名称 4.7.21
ip String 4.7.21
port Integer 4.7.21
state String 4.7.21
transport String 4.7.21
createDate Timestamp 创建时间 4.7.21
lastOpDate Timestamp 最后一次修改时间 4.7.21
nvmeTargets List 详情参考nvmeTargets 4.7.21
nvmeClusterRefs List 详情参考nvmeClusterRefs 4.7.21
#nvmeTargets
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 4.6.21
name String 资源名称 4.6.21
nqn String NVMe 限定名称 4.6.21
nvmeServerUuid String nvme服务器UUID 4.7.21
state String 状态 4.6.21
createDate Timestamp 创建时间 4.6.21
lastOpDate Timestamp 最后一次修改时间 4.6.21
nvmeLuns List 详情参考nvmeLuns 4.6.21
#nvmeLuns
名字 类型 描述 起始版本
nvmeTargetUuid String 所属NVMe设备UUID 4.6.21
name String 资源名称 4.6.21
uuid String 资源的UUID,唯一标示该资源 4.6.21
wwid String 全局唯一标识 4.6.21
vendor String 供应商 4.6.21
model String 型号 4.6.21
wwn String 4.6.21
serial String 序列号 4.6.21
type String 类型 4.6.21
hctl String 4.6.21
path String 路径 4.6.21
state String 状态 4.6.21
size Long 大小 4.6.21
multipathDeviceUuid String 多路径设备UUID 4.6.21
source String 磁盘来源,NVMe 4.6.21
createDate Timestamp 创建时间 4.6.21
lastOpDate Timestamp 最后一次修改时间 4.6.21
nvmeLunHostRefs List 详情参考nvmeLunHostRefs 4.6.21
#nvmeLunHostRefs
名字 类型 描述 起始版本
nvmeLunUuid String NVMe磁盘UUID 4.6.21
hostUuid String 主机UUID 4.6.21
path String 磁盘路径 4.6.21
hctl String 磁盘HCTL 4.6.21
createDate Timestamp 创建时间 4.6.21
lastOpDate Timestamp 最后一次修改时间 4.6.21
#nvmeClusterRefs
名字 类型 描述 起始版本
nvmeServerUuid String 4.7.21
clusterUuid String 集群UUID 4.7.21
createDate Timestamp 创建时间 4.7.21
lastOpDate Timestamp 最后一次修改时间 4.7.21
#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
AddNvmeServerAction action = new AddNvmeServerAction();
action.ip = "10.0.0.201";
action.port = 4420;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddNvmeServerAction.Result res = action.call();
Python SDK
AddNvmeServerAction action = AddNvmeServerAction()
action.ip = "10.0.0.201"
action.port = 4420
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AddNvmeServerAction.Result res = action.call()

NVMe服务器加载到集群(AttachNvmeServerToCluster)

API请求

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

API返回

返回示例
{
  "inventory": {
    "uuid": "cdde290bd48134bf877336209102016e",
    "name": "nvme-server-10.0.0.201",
    "ip": "10.0.0.201",
    "port": 4420,
    "state": "Enabled",
    "nvmeTargets": [
      {
        "uuid": "2bbb184e884d356badc749a5c0710e39",
        "nqn": "nqn.2014-08.org.nvmexpress.example1",
        "state": "Enabled",
        "nvmeLuns": [
          {
            "nvmeTargetUuid": "2bbb184e884d356badc749a5c0710e39",
            "nvmeLunHostRefs": [],
            "uuid": "bc5cb990bd6032c4846069cb01b32e4b",
            "wwid": "36b083fe000daf018000015505abbe00a",
            "vendor": "DELL",
            "model": "MD32xx",
            "wwn": "0x6b083fe000daf018",
            "serial": "6b083fe000daf018000015505abbe00a",
            "type": "disk",
            "hctl": "6:0:1:1",
            "path": "uuid.a5ab00e7-3bfe-4d3d-bc57-bb4032e04951",
            "size": 30003188203520
          }
        ],
        "createDate": "Nov 14, 2017 2:20:57 PM",
        "lastOpDate": "Nov 14, 2017 2:20:57 PM"
      }
    ],
    "nvmeClusterRefs": [
      {
        "id": 1,
        "nvmeServerUuid": "cdde290bd48134bf877336209102016e",
        "clusterUuid": "c471747cf3a33fbc8d2202879b407611",
        "createDate": "Nov 14, 2017 2:20:57 PM",
        "lastOpDate": "Nov 14, 2017 2:20:57 PM"
      }
    ],
    "createDate": "Nov 14, 2017 2:20:57 PM",
    "lastOpDate": "Nov 14, 2017 2:20:57 PM"
  }
}
名字 类型 描述 起始版本
success boolean 4.7.21
inventory NvmeServerInventory 详情参考inventory 4.7.21
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 4.7.21
#inventory
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 4.7.21
name String 资源名称 4.7.21
ip String 4.7.21
port Integer 4.7.21
state String 4.7.21
transport String 4.7.21
createDate Timestamp 创建时间 4.7.21
lastOpDate Timestamp 最后一次修改时间 4.7.21
nvmeTargets List 详情参考nvmeTargets 4.7.21
nvmeClusterRefs List 详情参考nvmeClusterRefs 4.7.21
#nvmeTargets
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 4.6.21
name String 资源名称 4.6.21
nqn String NVMe 限定名称 4.6.21
nvmeServerUuid String nvme服务器UUID 4.7.21
state String 状态 4.6.21
createDate Timestamp 创建时间 4.6.21
lastOpDate Timestamp 最后一次修改时间 4.6.21
nvmeLuns List 详情参考nvmeLuns 4.6.21
#nvmeLuns
名字 类型 描述 起始版本
nvmeTargetUuid String 所属NVMe设备UUID 4.6.21
name String 资源名称 4.6.21
uuid String 资源的UUID,唯一标示该资源 4.6.21
wwid String 全局唯一标识 4.6.21
vendor String 供应商 4.6.21
model String 型号 4.6.21
wwn String 4.6.21
serial String 序列号 4.6.21
type String 类型 4.6.21
hctl String 4.6.21
path String 路径 4.6.21
state String 状态 4.6.21
size Long 大小 4.6.21
multipathDeviceUuid String 多路径设备UUID 4.6.21
source String 磁盘来源,NVMe 4.6.21
createDate Timestamp 创建时间 4.6.21
lastOpDate Timestamp 最后一次修改时间 4.6.21
nvmeLunHostRefs List 详情参考nvmeLunHostRefs 4.6.21
#nvmeLunHostRefs
名字 类型 描述 起始版本
nvmeLunUuid String NVMe磁盘UUID 4.6.21
hostUuid String 主机UUID 4.6.21
path String 磁盘路径 4.6.21
hctl String 磁盘HCTL 4.6.21
createDate Timestamp 创建时间 4.6.21
lastOpDate Timestamp 最后一次修改时间 4.6.21
#nvmeClusterRefs
名字 类型 描述 起始版本
nvmeServerUuid String 4.7.21
clusterUuid String 集群UUID 4.7.21
createDate Timestamp 创建时间 4.7.21
lastOpDate Timestamp 最后一次修改时间 4.7.21
#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
AttachNvmeServerToClusterAction action = new AttachNvmeServerToClusterAction();
action.uuid = "28aca7875015311d814e12bb7d03dbab";
action.clusterUuid = "1f8daabbcca53e30bde1f6511f266b53";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AttachNvmeServerToClusterAction.Result res = action.call();
Python SDK
AttachNvmeServerToClusterAction action = AttachNvmeServerToClusterAction()
action.uuid = "28aca7875015311d814e12bb7d03dbab"
action.clusterUuid = "1f8daabbcca53e30bde1f6511f266b53"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AttachNvmeServerToClusterAction.Result res = action.call()

删除NVMe服务器(DeleteNvmeServer)

API请求

URLs
DELETE zstack/v1/storage-devices/nvme/servers/{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/storage-devices/nvme/servers/e8dd5c1f58893f7d946ec4e3999aed0c
参数列表
名字 类型 位置 描述 可选值 起始版本
uuid String url 资源的UUID,唯一标示该资源 4.7.21
deleteMode (可选) String body 删除模式(Permissive / Enforcing,Permissive) 4.7.21
systemTags (可选) List body 系统标签 4.7.21
userTags (可选) List body 用户标签 4.7.21

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
DeleteNvmeServerAction action = new DeleteNvmeServerAction();
action.uuid = "e8dd5c1f58893f7d946ec4e3999aed0c";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteNvmeServerAction.Result res = action.call();
Python SDK
DeleteNvmeServerAction action = DeleteNvmeServerAction()
action.uuid = "e8dd5c1f58893f7d946ec4e3999aed0c"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeleteNvmeServerAction.Result res = action.call()

从集群卸载NVMe服务器(DetachNvmeServerFromCluster)

API请求

URLs
DELETE zstack/v1/clusters/{clusterUuid}/storage-devices/nvme/servers/{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/clusters/5c5365dc4af83cae8976e50f1b44b5b0/storage-devices/nvme/servers/c44c41bd90a2380a936d0267565c60ff
参数列表
名字 类型 位置 描述 可选值 起始版本
uuid String url 资源的UUID,唯一标示该资源 4.7.21
clusterUuid String url 集群UUID 4.7.21
systemTags (可选) List body 系统标签 4.7.21
userTags (可选) List body 用户标签 4.7.21

API返回

返回示例
{
  "inventory": {
    "uuid": "ee50b8cccd27308588a83408c91eebe5",
    "name": "nvme-server-10.0.0.201",
    "ip": "10.0.0.201",
    "port": 4420,
    "state": "Enabled",
    "nvmeTargets": [
      {
        "uuid": "6460b827029f3c0c81e90769f7d560ce",
        "nqn": "nqn.2014-08.org.nvmexpress.example1",
        "state": "Enabled",
        "nvmeLuns": [
          {
            "nvmeTargetUuid": "6460b827029f3c0c81e90769f7d560ce",
            "nvmeLunHostRefs": [],
            "uuid": "960298ac721f380db77e602349a42f71",
            "wwid": "36b083fe000daf018000015505abbe00a",
            "vendor": "DELL",
            "model": "MD32xx",
            "wwn": "0x6b083fe000daf018",
            "serial": "6b083fe000daf018000015505abbe00a",
            "type": "disk",
            "hctl": "6:0:1:1",
            "path": "uuid.a5ab00e7-3bfe-4d3d-bc57-bb4032e04951",
            "size": 30003188203520
          }
        ],
        "createDate": "Nov 14, 2017 2:20:57 PM",
        "lastOpDate": "Nov 14, 2017 2:20:57 PM"
      }
    ],
    "nvmeClusterRefs": [
      {
        "id": 1,
        "nvmeServerUuid": "ee50b8cccd27308588a83408c91eebe5",
        "clusterUuid": "999ecf4771eb3f2b80ca97d88145e4e4",
        "createDate": "Nov 14, 2017 2:20:57 PM",
        "lastOpDate": "Nov 14, 2017 2:20:57 PM"
      }
    ],
    "createDate": "Nov 14, 2017 2:20:57 PM",
    "lastOpDate": "Nov 14, 2017 2:20:57 PM"
  }
}
名字 类型 描述 起始版本
success boolean 4.7.21
inventory NvmeServerInventory 详情参考inventory 4.7.21
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 4.7.21
#inventory
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 4.7.21
name String 资源名称 4.7.21
ip String 4.7.21
port Integer 4.7.21
state String 4.7.21
transport String 4.7.21
createDate Timestamp 创建时间 4.7.21
lastOpDate Timestamp 最后一次修改时间 4.7.21
nvmeTargets List 详情参考nvmeTargets 4.7.21
nvmeClusterRefs List 详情参考nvmeClusterRefs 4.7.21
#nvmeTargets
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 4.6.21
name String 资源名称 4.6.21
nqn String NVMe 限定名称 4.6.21
nvmeServerUuid String nvme服务器UUID 4.7.21
state String 状态 4.6.21
createDate Timestamp 创建时间 4.6.21
lastOpDate Timestamp 最后一次修改时间 4.6.21
nvmeLuns List 详情参考nvmeLuns 4.6.21
#nvmeLuns
名字 类型 描述 起始版本
nvmeTargetUuid String 所属NVMe设备UUID 4.6.21
name String 资源名称 4.6.21
uuid String 资源的UUID,唯一标示该资源 4.6.21
wwid String 全局唯一标识 4.6.21
vendor String 供应商 4.6.21
model String 型号 4.6.21
wwn String 4.6.21
serial String 序列号 4.6.21
type String 类型 4.6.21
hctl String 4.6.21
path String 路径 4.6.21
state String 状态 4.6.21
size Long 大小 4.6.21
multipathDeviceUuid String 多路径设备UUID 4.6.21
source String 磁盘来源,NVMe 4.6.21
createDate Timestamp 创建时间 4.6.21
lastOpDate Timestamp 最后一次修改时间 4.6.21
nvmeLunHostRefs List 详情参考nvmeLunHostRefs 4.6.21
#nvmeLunHostRefs
名字 类型 描述 起始版本
nvmeLunUuid String NVMe磁盘UUID 4.6.21
hostUuid String 主机UUID 4.6.21
path String 磁盘路径 4.6.21
hctl String 磁盘HCTL 4.6.21
createDate Timestamp 创建时间 4.6.21
lastOpDate Timestamp 最后一次修改时间 4.6.21
#nvmeClusterRefs
名字 类型 描述 起始版本
nvmeServerUuid String 4.7.21
clusterUuid String 集群UUID 4.7.21
createDate Timestamp 创建时间 4.7.21
lastOpDate Timestamp 最后一次修改时间 4.7.21
#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
DetachNvmeServerFromClusterAction action = new DetachNvmeServerFromClusterAction();
action.uuid = "c44c41bd90a2380a936d0267565c60ff";
action.clusterUuid = "5c5365dc4af83cae8976e50f1b44b5b0";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DetachNvmeServerFromClusterAction.Result res = action.call();
Python SDK
DetachNvmeServerFromClusterAction action = DetachNvmeServerFromClusterAction()
action.uuid = "c44c41bd90a2380a936d0267565c60ff"
action.clusterUuid = "5c5365dc4af83cae8976e50f1b44b5b0"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DetachNvmeServerFromClusterAction.Result res = action.call()

查询NVMe服务器(QueryNvmeServer)

API请求

URLs
GET zstack/v1/storage-devices/nvme/servers
GET zstack/v1/storage-devices/nvme/servers/{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/storage-devices/nvme/servers
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/storage-devices/nvme/servers/dc4a7cc72a763b19b05aaba063a4cc29

可查询字段

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

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
QueryNvmeServerAction action = new QueryNvmeServerAction();
action.conditions = asList();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryNvmeServerAction.Result res = action.call();
Python SDK
QueryNvmeServerAction action = QueryNvmeServerAction()
action.conditions = []
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryNvmeServerAction.Result res = action.call()
开发手册 | ZStack ZSphere · ZVF | ZStack 资源中心