Query SCSI Lun

API Request

Query Iscsi block devices and FC block devices.

URLs

GET zstack/v1/storage-devices/scsi-lun/luns
GET zstack/v1/storage-devices/scsi-lun/luns/{uuid}

Headers

Authorization: OAuth the-session-uuid

Curl Example

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/storage-devices/scsi-lun/luns
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/storage-devices/scsi-lun/luns/c4006c2a536f3617944e2b00aff74af6

Queryable Fields

Run the CLI command-line tool, enter QueryScsiLun and press Tab to see all queryable fields and resource names that can be queried across tables.

API Response

Response Example

{
  "inventories": [
    {
      "name": "fc-lun-36b083fe000daf018000022905ba35d8f",
      "uuid": "6f2428969262315488684c85e14eded2",
      "wwid": "36b083fe000daf018000022905ba35d8f",
      "vendor": "DELL",
      "model": "MD32xx",
      "wwn": "0x6f01faf000d5c3e7",
      "serial": "6b083fe000daf018000015505abbe00a",
      "type": "mpath",
      "path": "pci-0000:05:00.0-fc-0x2012b083fedaf018-lun-11",
      "size": 5497558138880.0,
      "scsiLunHostRefs": [
        {
          "id": 1.0,
          "scsiLunUuid": "6f2428969262315488684c85e14eded2",
          "hostUuid": "0b756ca2d3843412860b7ec1b9315dd4",
          "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"
    },
    {
      "name": "iscsi-lun-scsi-14f504e46494c45524d5342436a6c2d4a4443672d30593032",
      "uuid": "7bfde6b8e5503606849a4f3781bc02d7",
      "wwid": "scsi-14f504e46494c45524d5342436a6c2d4a4443672d30593032",
      "vendor": "OPNFILER",
      "model": "VIRTUAL-DISK",
      "serial": "4f504e46494c45524d5342436a6c2d4a4443672d30593032",
      "type": "disk",
      "path": "ip-10.0.104.213:3260-iscsi-iqn.2018-09.io.cloud:tsn.0000003-lun-0",
      "size": 5497558138880.0,
      "scsiLunHostRefs": [],
      "scsiLunVmInstanceRefs": [],
      "createDate": "Nov 14, 2017 10:20:57 PM",
      "lastOpDate": "Nov 14, 2017 10:20:57 PM"
    }
  ]
}
NameTypeDescriptionStarting Version
errorErrorCodeError code. If not null, the operation failed. When the operation is successful, this field is null. For details, see error3.2.0
inventoriesListFor details, see inventories3.2.0

error

NameTypeDescriptionStarting Version
codeStringError code number, a globally unique identifier for the error, e.g. SYS.1000, HOST.10013.2.0
descriptionStringBrief description of the error3.2.0
detailsStringDetailed error information3.2.0
elaborationStringReserved field, defaults to null3.2.0
opaqueLinkedHashMapReserved field, defaults to null3.2.0
causeErrorCodeRoot cause: the error that triggered the current error. If there is no original error, this field is null3.2.0

inventories

NameTypeDescriptionStarting Version
nameStringResource Name3.2.0
uuidStringResource UUID, uniquely identifies the resource3.2.0
wwidStringDisk Globally Unique Identifier3.2.0
vendorStringDisk Vendor3.2.0
modelStringDisk Model3.2.0
wwnStringDisk WWN3.2.0
serialStringDisk Serial Number3.2.0
typeStringDisk Type3.2.0
pathStringDisk Path3.2.0
stateStringDisk Enabled State3.2.0
sizeLongDisk Size3.2.0
createDateTimestampCreation Time3.2.0
lastOpDateTimestampLast Modification Time3.2.0
scsiLunHostRefsListFor details, see scsiLunHostRefs3.2.0
scsiLunVmInstanceRefsListFor details, see scsiLunVmInstanceRefs3.2.0

scsiLunHostRefs

NameTypeDescriptionStarting Version
scsiLunUuidStringSCSI Lun UUID3.2.0
hostUuidStringHost UUID3.2.0
createDateTimestampCreation Time3.2.0
lastOpDateTimestampLast Modification Time3.2.0

scsiLunVmInstanceRefs

NameTypeDescriptionStarting Version
scsiLunUuidStringSCSI Lun UUID3.2.0
vmInstanceUuidStringVirtual Machine UUID3.2.0
createDateTimestampCreation Time3.2.0
lastOpDateTimestampLast Modification Time3.2.0

SDK Examples

Java SDK

QueryScsiLunAction action = new QueryScsiLunAction();
action.conditions = asList();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryScsiLunAction.Result res = action.call();

Python SDK

QueryScsiLunAction action = QueryScsiLunAction()
action.conditions = []
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryScsiLunAction.Result res = action.call()