获取虚拟机可以加载的SCSI LUN

GET/zstack/v1/vm-instances/{vmInstanceUuid}/candidate-storage-devices

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/vm-instances/ccd1f4cb76e83c3b997fc4ed16ed529f/candidate-storage-devices

参数列表

名字类型位置描述可选值起始版本
vmInstanceUuidStringurl虚拟机UUID 3.1.0
systemTags (可选)Listquery  3.1.0
userTags (可选)Listquery  3.1.0

API返回

返回示例

{
  "inventories": [
    {
      "scsiLunHostRefs": [
        {
          "id": 1,
          "scsiLunUuid": "d4714249ba273a5c9d1c1cb3a1a16f24",
          "hostUuid": "c922c37f885e35aeb1ae87db3446fc7e",
          "createDate": "Nov 14, 2017 2:20:57 PM"
        }
      ],
      "scsiLunVmInstanceRefs": [],
      "name": "fc-lun-36b083fe000daf018000022905ba35d8f",
      "uuid": "d4714249ba273a5c9d1c1cb3a1a16f24",
      "wwid": "36b083fe000daf018000022905ba35d8f",
      "vendor": "DELL",
      "model": "MD32xx",
      "wwn": "0x6f01faf000d5c3e7",
      "serial": "6b083fe000daf018000015505abbe00a",
      "type": "mpath",
      "path": "pci-0000:05:00.0-fc-0x2012b083fedaf018-lun-11",
      "size": 5497558138880,
      "createDate": "Nov 14, 2017 2:20:57 PM",
      "lastOpDate": "Nov 14, 2017 2:20:57 PM"
    }
  ]
}
名字类型描述起始版本
successboolean 3.1.0
errorErrorCode错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error3.1.0
inventoriesList详情参考inventories3.1.0

error

名字类型描述起始版本
codeString错误码号,错误的全局唯一标识,例如SYS.1000, HOST.10010.6
descriptionString错误的概要描述0.6
detailsString错误的详细信息0.6
elaborationString保留字段,默认为null0.6
opaqueLinkedHashMap保留字段,默认为null0.6
causeErrorCode根错误,引发当前错误的源错误,若无原错误,该字段为null0.6

inventories

名字类型描述起始版本
nameString资源名称3.1.0
uuidString资源的UUID,唯一标示该资源3.1.0
wwidString磁盘全局唯一表示3.1.0
vendorString磁盘供应商3.1.0
modelString磁盘型号3.1.0
wwnString磁盘WWN3.1.0
serialString磁盘序列号3.1.0
typeString磁盘类型3.1.0
pathString磁盘路径3.1.0
stateString磁盘启用状态3.1.0
sizeLong磁盘大小3.1.0
createDateTimestamp创建时间3.1.0
lastOpDateTimestamp最后一次修改时间3.1.0
scsiLunHostRefsList详情参考scsiLunHostRefs3.1.0
scsiLunVmInstanceRefsList详情参考scsiLunVmInstanceRefs3.1.0

scsiLunHostRefs

名字类型描述起始版本
scsiLunUuidStringSCSI Lun UUID3.1.0
hostUuidString主机UUID3.1.0
createDateTimestamp创建时间3.1.0
lastOpDateTimestamp最后一次修改时间3.1.0

scsiLunVmInstanceRefs

名字类型描述起始版本
scsiLunUuidStringSCSI Lun UUID3.1.0
vmInstanceUuidString虚拟机UUID3.1.0
createDateTimestamp创建时间3.1.0
lastOpDateTimestamp最后一次修改时间3.1.0

SDK示例

Java SDK

GetScsiLunCandidatesForAttachingVmAction action = new GetScsiLunCandidatesForAttachingVmAction();
action.vmInstanceUuid = "ccd1f4cb76e83c3b997fc4ed16ed529f";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetScsiLunCandidatesForAttachingVmAction.Result res = action.call();

Python SDK

GetScsiLunCandidatesForAttachingVmAction action = GetScsiLunCandidatesForAttachingVmAction()
action.vmInstanceUuid = "ccd1f4cb76e83c3b997fc4ed16ed529f"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetScsiLunCandidatesForAttachingVmAction.Result res = action.call()