主机硬件设备相关接口

获取主机的磁盘设备信息(GetHostBlockDevices)

API请求

URLs
GET zstack/v1/hosts/{uuid}/get-block-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/hosts/3a23c245d7f93f1a97da52a833a34e8c/get-block-devices
参数列表
名字 类型 位置 描述 可选值 起始版本
uuid String url 资源的UUID,唯一标示该资源 zsv 4.10.0
systemTags (可选) List query 系统标签 zsv 4.10.0
userTags (可选) List query 用户标签 zsv 4.10.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
GetHostBlockDevicesAction action = new GetHostBlockDevicesAction();
action.uuid = "3a23c245d7f93f1a97da52a833a34e8c";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetHostBlockDevicesAction.Result res = action.call();
Python SDK
GetHostBlockDevicesAction action = GetHostBlockDevicesAction()
action.uuid = "3a23c245d7f93f1a97da52a833a34e8c"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetHostBlockDevicesAction.Result res = action.call()

获取主机传感器信息(GetHostSensors)

API请求

URLs
GET zstack/v1/hosts/{uuid}/get-sensors
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/hosts/9c72eabee3fb3acf99c32bd46d3efee5/get-sensors
参数列表
名字 类型 位置 描述 可选值 起始版本
uuid String url 资源的UUID,唯一标示该资源 zsv 4.10.0
systemTags (可选) List query 系统标签 zsv 4.10.0
userTags (可选) List query 用户标签 zsv 4.10.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
GetHostSensorsAction action = new GetHostSensorsAction();
action.uuid = "9c72eabee3fb3acf99c32bd46d3efee5";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetHostSensorsAction.Result res = action.call();
Python SDK
GetHostSensorsAction action = GetHostSensorsAction()
action.uuid = "9c72eabee3fb3acf99c32bd46d3efee5"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetHostSensorsAction.Result res = action.call()

更新主机NQN(UpdateHostNqn)

API请求

URLs
PUT zstack/v1/hosts/nqn/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "updateHostNqn": {
    "nqn": "nqn.2014-08.org.nvmexpress:uuid:748d0363-8366-44db-803b-146effb96988"
  },
  "systemTags": [],
  "userTags": []
}
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateHostNqn":{"nqn":"nqn.2014-08.org.nvmexpress:uuid:748d0363-8366-44db-803b-146effb96988"}}' \
http://localhost:8080/zstack/v1/hosts/nqn/f8a3ebbe7419382cad360f53acc62d2a/actions
参数列表
名字 类型 位置 描述 可选值 起始版本
uuid String url 资源的UUID,唯一标示该资源 4.10.6
nqn String body(包含在updateHostNqn结构中) NVMe 限定名称 4.10.6
systemTags (可选) List body 系统标签 4.10.6
userTags (可选) List body 用户标签 4.10.6

API返回

返回示例
{
  "inventory": {
    "zoneUuid": "d15a108ad4c332bcafccf0cb02e73a7a",
    "name": "example",
    "uuid": "54b838b4e5b9316a8fc89b77b18fa528",
    "clusterUuid": "8ebdb61e739335218a992632b3bc2dde",
    "description": "example",
    "managementIp": "192.168.0.1",
    "hypervisorType": "KVM",
    "state": "Enabled",
    "status": "Connected",
    "totalCpuCapacity": 4,
    "availableCpuCapacity": 2,
    "totalMemoryCapacity": 4,
    "availableMemoryCapacity": 4,
    "nqn": "nqn.2014-08.org.nvmexpress:uuid:748d0363-8366-44db-803b-146effb96988"
  }
}
名字 类型 描述 起始版本
success boolean 4.10.6
inventory HostInventory 详情参考inventory 4.10.6
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 4.10.6
#inventory
名字 类型 描述 起始版本
zoneUuid String 数据中心UUID 0.6
name String 资源名称 0.6
uuid String 资源的UUID,唯一标示该资源 0.6
clusterUuid String 集群UUID 0.6
description String 资源的详细描述 0.6
managementIp String 0.6
hypervisorType String 0.6
state String 0.6
status String 0.6
totalCpuCapacity Long 0.6
availableCpuCapacity Long 0.6
cpuSockets Integer 物理CPU插槽数量 0.6
totalMemoryCapacity Long 0.6
availableMemoryCapacity Long 0.6
cpuNum Integer 逻辑CPU数量 0.6
ipmiAddress String IPMI地址 0.6
ipmiUsername String IPMI用户名 0.6
ipmiPort Integer IPMI端口 0.6
ipmiPowerStatus String IPMI电源状态 0.6
architecture String 0.6
nqn String NVMe 限定名称 4.10.6
hostname String 主机名 4.10.20
createDate Timestamp 创建时间 0.6
lastOpDate Timestamp 最后一次修改时间 0.6
cpuStatus HwMonitorStatus 详情参考cpuStatus 4.10.0
memoryStatus HwMonitorStatus 详情参考memoryStatus 4.10.0
diskStatus HwMonitorStatus 详情参考diskStatus 4.10.0
nicStatus HwMonitorStatus 详情参考nicStatus 4.10.0
gpuStatus HwMonitorStatus 详情参考gpuStatus 4.10.0
powerSupplyStatus HwMonitorStatus 详情参考powerSupplyStatus 4.10.0
fanStatus HwMonitorStatus 详情参考fanStatus 4.10.0
raidStatus HwMonitorStatus 详情参考raidStatus 4.10.0
temperatureStatus HwMonitorStatus 详情参考temperatureStatus 4.10.0
#cpuStatus
名字 类型 描述 起始版本
Normal HwMonitorStatus 正常 4.10.0
Error HwMonitorStatus 异常 4.10.0
Unknown HwMonitorStatus 未知 4.10.0
#memoryStatus
名字 类型 描述 起始版本
Normal HwMonitorStatus 正常 4.10.0
Error HwMonitorStatus 异常 4.10.0
Unknown HwMonitorStatus 未知 4.10.0
#diskStatus
名字 类型 描述 起始版本
Normal HwMonitorStatus 正常 4.10.0
Error HwMonitorStatus 异常 4.10.0
Unknown HwMonitorStatus 未知 4.10.0
#nicStatus
名字 类型 描述 起始版本
Normal HwMonitorStatus 正常 4.10.0
Error HwMonitorStatus 异常 4.10.0
Unknown HwMonitorStatus 未知 4.10.0
#gpuStatus
名字 类型 描述 起始版本
Normal HwMonitorStatus 正常 4.10.0
Error HwMonitorStatus 异常 4.10.0
Unknown HwMonitorStatus 未知 4.10.0
#powerSupplyStatus
名字 类型 描述 起始版本
Normal HwMonitorStatus 正常 4.10.0
Error HwMonitorStatus 异常 4.10.0
Unknown HwMonitorStatus 未知 4.10.0
#fanStatus
名字 类型 描述 起始版本
Normal HwMonitorStatus 正常 4.10.0
Error HwMonitorStatus 异常 4.10.0
Unknown HwMonitorStatus 未知 4.10.0
#raidStatus
名字 类型 描述 起始版本
Normal HwMonitorStatus 正常 4.10.0
Error HwMonitorStatus 异常 4.10.0
Unknown HwMonitorStatus 未知 4.10.0
#temperatureStatus
名字 类型 描述 起始版本
Normal HwMonitorStatus 正常 4.10.0
Error HwMonitorStatus 异常 4.10.0
Unknown HwMonitorStatus 未知 4.10.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

SDK示例

Java SDK
UpdateHostNqnAction action = new UpdateHostNqnAction();
action.uuid = "f8a3ebbe7419382cad360f53acc62d2a";
action.nqn = "nqn.2014-08.org.nvmexpress:uuid:748d0363-8366-44db-803b-146effb96988";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateHostNqnAction.Result res = action.call();
Python SDK
action = UpdateHostNqnAction()
action.uuid = "f8a3ebbe7419382cad360f53acc62d2a"
action.nqn = "nqn.2014-08.org.nvmexpress:uuid:748d0363-8366-44db-803b-146effb96988"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()

查询GPU信息(QueryGpuDevice)

API请求

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

可查询字段

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

API返回

返回示例
{
  "inventories": [
    {}
  ]
}
名字 类型 描述 起始版本
success boolean 5.1.8
inventories List 详情参考inventories 5.1.8
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 5.1.8
#inventories
名字 类型 描述 起始版本
serialNumber String 序列号 5.1.8
memory String 显存 5.1.8
power String 能耗 5.1.8
uuid String 资源的UUID,唯一标示该资源 5.1.8
name String 资源名称 5.1.8
description String 资源的详细描述 5.1.8
hostUuid String 主机UUID 5.1.8
parentUuid String 5.1.8
vmInstanceUuid String 虚拟机UUID 5.1.8
pciSpecUuid String 5.1.8
vendorId String 5.1.8
vendor String 5.1.8
deviceId String 5.1.8
device String 5.1.8
subvendorId String 5.1.8
subdeviceId String 5.1.8
pciDeviceAddress String 5.1.8
iommuGroup String 5.1.8
createDate Timestamp 创建时间 5.1.8
lastOpDate Timestamp 最后一次修改时间 5.1.8
type PciDeviceType 详情参考type 5.1.8
state PciDeviceState 详情参考state 5.1.8
status PciDeviceStatus 详情参考status 5.1.8
virtStatus PciDeviceVirtStatus 详情参考virtStatus 5.1.8
chooser PciDeviceChooser 详情参考chooser 5.1.8
metaData PciDeviceMetaData 详情参考metaData 5.1.8
matchedPciDeviceOfferingRef List 详情参考matchedPciDeviceOfferingRef 5.1.8
mdevSpecRefs List 详情参考mdevSpecRefs 5.1.8
#type
名字 类型 描述 起始版本
GPU_Video_Controller PciDeviceType GPU显卡控制器 2.1
GPU_Audio_Controller PciDeviceType GPU声卡控制器 2.1
GPU_3D_Controller PciDeviceType GPU 3D控制器 2.1
Moxa_Device PciDeviceType MOXA卡 2.1
Generic PciDeviceType 一般设备 2.1
#state
名字 类型 描述 起始版本
Enabled PciDeviceState 启用 2.1
Disabled PciDeviceState 停用 2.1
#status
名字 类型 描述 起始版本
Active PciDeviceStatus 就绪 2.1
Attached PciDeviceStatus 已挂载 2.1
System PciDeviceStatus 系统 2.1
#virtStatus
名字 类型 描述 起始版本
UNVIRTUALIZABLE PciDeviceVirtStatus 不可虚拟化 3.5.0
SRIOV_VIRTUALIZABLE PciDeviceVirtStatus 支持SRIOV虚拟化 3.5.0
VFIO_MDEV_VIRTUALIZABLE PciDeviceVirtStatus 支持VFIO_MDEV虚拟化 3.5.0
SRIOV_VIRTUALIZED PciDeviceVirtStatus 已SRIOV虚拟化 3.5.0
VFIO_MDEV_VIRTUALIZED PciDeviceVirtStatus 已VFIO_MDEV虚拟化 3.5.0
SRIOV_VIRTUAL PciDeviceVirtStatus SRIOV虚拟设备 3.5.0
UNKNOWN PciDeviceVirtStatus 未知 3.5.0
#chooser
名字 类型 描述 起始版本
None PciDeviceChooser 4.8.0
Device PciDeviceChooser 4.8.0
Spec PciDeviceChooser 4.8.0
#metaData
名字 类型 描述 起始版本
metaData String 2.1
metaDataEntries List 详情参考metaDataEntries 2.1
#metaDataEntries
名字 类型 描述 起始版本
key String 键 2.1
value String 值 2.1
op PciDeviceMetaDataOperator 详情参考op 2.1
#op
名字 类型 描述 起始版本
Equal PciDeviceMetaDataOperator 相等 2.1
Unequal PciDeviceMetaDataOperator 不等 2.1
#matchedPciDeviceOfferingRef
名字 类型 描述 起始版本
pciDeviceUuid String 2.1
pciDeviceOfferingUuid String 2.1
#mdevSpecRefs
名字 类型 描述 起始版本
pciDeviceUuid String PCI设备UUID 3.5.0
mdevSpecUuid String MDEV设备规格UUID 3.5.0
effective Boolean 当前MDEV规格是否被用于切分该PCI设备 3.5.0
createDate Timestamp 创建时间 3.5.0
lastOpDate Timestamp 最后一次修改时间 3.5.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

SDK示例

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

查询FC存储LUN(QueryFiberChannelLun)

API请求

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

可查询字段

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

API返回

返回示例
{
  "inventories": [
    {
      "fiberChannelStorageUuid": "9f1895c8d1b6306e908df42244901617",
      "scsiLunHostRefs": [],
      "scsiLunVmInstanceRefs": [],
      "name": "fc-lun-36b083fe000daf018000022905ba35d8f",
      "uuid": "aaab6d1a63713ae0ac18a21b9547312b",
      "wwid": "36b083fe000daf018000022905ba35d8f",
      "vendor": "DELL",
      "model": "MD32xx",
      "wwn": "0x6f01faf000d5c3e7",
      "serial": "6b083fe000daf018000015505abbe00a",
      "type": "mpath",
      "path": "pci-0000:05:00.0-fc-0x2012b083fedaf018-lun-11",
      "size": 5497558138880
    },
    {
      "fiberChannelStorageUuid": "9452ad8bb69f33c495bf0da260d80003",
      "scsiLunHostRefs": [],
      "scsiLunVmInstanceRefs": [],
      "name": "fc-lun-36f01faf000d5c3e7000023ef5ba362f2",
      "uuid": "cc050d2f06163d9dbf6d82cd61b7f008",
      "wwid": "36f01faf000d5c3e7000023ef5ba362f2",
      "vendor": "DELL",
      "model": "MD32xx",
      "wwn": "0x6b083fe000daf018",
      "serial": "6b083fe000daf018000015505abbe00a",
      "type": "mpath",
      "path": "pci-0000:05:00.0-fc-0x2012b083fedaf018-lun-12",
      "size": 5497558138880
    }
  ]
}
名字 类型 描述 起始版本
success boolean 0.6
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
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
QueryFiberChannelLunAction action = new QueryFiberChannelLunAction();
action.conditions = asList();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryFiberChannelLunAction.Result res = action.call();
Python SDK
QueryFiberChannelLunAction action = QueryFiberChannelLunAction()
action.conditions = []
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryFiberChannelLunAction.Result res = action.call()

查询HBA卡信息(QueryHBADevice)

API请求

URLs
GET zstack/v1/storage-devices/hba
GET zstack/v1/storage-devices/hba/{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/hba?q=uuid=db041d8a238732be82740eaf5a43d252
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/storage-devices/hba/1698716626f33b6fb1637a76590e1fe6

可查询字段

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

API返回

返回示例
{
  "inventories": [
    {
      "portName": "10000090fab38778",
      "portState": "Online",
      "speed": "8 Gbit",
      "supportedSpeeds": "16 Gbit",
      "symbolicName": "QLE2692 FW:v9.07.00 DVR:v10.02.00.106-k",
      "supportedClasses": "Class 3",
      "uuid": "511a5ac34b423ac99a33d5c863531d2e",
      "name": "host",
      "hostUuid": "38e3ebc0b54e3cf8a99db5f7c80ee59e",
      "hbaType": "FC"
    }
  ]
}
名字 类型 描述 起始版本
success boolean 5.3.0
inventories List 详情参考inventories 5.2.0
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 5.3.0
#inventories
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 5.3.0
name String 资源名称 5.3.0
hostUuid String 主机UUID 5.3.0
portName String 端口名字 5.3.0
portState String 端口状态 5.3.0
hbaType String 类型 5.3.0
speed String 速度 5.3.0
supportedSpeeds String 支持的速度 5.3.0
symbolicName String 符号名称 5.3.0
supportedClasses String 服务类别 5.3.0
createDate String 创建时间 5.3.0
lastOpDate String 最后一次修改时间 5.3.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

SDK示例

Java SDK
QueryFcHbaDeviceAction action = new QueryFcHbaDeviceAction();
action.conditions = asList("uuid=744cbe74c6f8365dafdbcf9568cfafa0");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryFcHbaDeviceAction.Result res = action.call();
Python SDK
QueryFcHbaDeviceAction action = QueryFcHbaDeviceAction()
action.conditions = ["uuid=e8b3f35dce0c38da8cec8a56347899e9"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryFcHbaDeviceAction.Result res = action.call()

获取主机多路径拓扑(GetHostMultipathTopology)

API请求

URLs
GET zstack/v1/storage-devices/multipath/topology
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/multipath/topology
参数列表
名字 类型 位置 描述 可选值 起始版本
hostUuid String query 主机UUID 5.0.0
lunUuids List query 5.0.0
systemTags (可选) List query 系统标签 0.6
userTags (可选) List query 用户标签 0.6

API返回

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

SDK示例

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

刷新NVMe服务器(RefreshNvmeServer)

API请求

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

API返回

返回示例
{
  "inventory": {
    "uuid": "a3ae41316951321e9170e43c71fa297a",
    "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 zsv 4.10.6
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error zsv 4.10.6
inventory NvmeServerInventory 详情参考inventory zsv 4.10.6
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 0.6
description String 错误的概要描述 0.6
details String 错误的详细信息 0.6
elaboration String 保留字段,默认为null 0.6
opaque LinkedHashMap 保留字段,默认为null 0.6
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 0.6
#inventory
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 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

SDK示例

Java SDK
RefreshNvmeServerAction action = new RefreshNvmeServerAction();
action.uuid = "03a08e55bf3239c7a72a3fee84593ef1";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
RefreshNvmeServerAction.Result res = action.call();
Python SDK
RefreshNvmeServerAction action = RefreshNvmeServerAction()
action.uuid = "03a08e55bf3239c7a72a3fee84593ef1"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
RefreshNvmeServerAction.Result res = action.call()

更新NVMe服务器配置(UpdateNvmeServer)

API请求

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

API返回

返回示例
{
  "inventory": {
    "uuid": "1aeed04f5f1730028ab808617aee75ec",
    "name": "nvme-server-10.0.0.201",
    "ip": "10.0.0.201",
    "port": 3260,
    "state": "Enabled"
  }
}
名字 类型 描述 起始版本
success boolean zsv 4.10.6
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error zsv 4.10.6
inventory NvmeServerInventory 详情参考inventory zsv 4.10.6
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 0.6
description String 错误的概要描述 0.6
details String 错误的详细信息 0.6
elaboration String 保留字段,默认为null 0.6
opaque LinkedHashMap 保留字段,默认为null 0.6
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 0.6
#inventory
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 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

SDK示例

Java SDK
UpdateNvmeServerAction action = new UpdateNvmeServerAction();
action.uuid = "3adcddf1292f3665805d5345919ac617";
action.name = "nvme-server-10.0.0.201";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateNvmeServerAction.Result res = action.call();
Python SDK
UpdateNvmeServerAction action = UpdateNvmeServerAction()
action.uuid = "3adcddf1292f3665805d5345919ac617"
action.name = "nvme-server-10.0.0.201"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateNvmeServerAction.Result res = action.call()

检查SCSI LUN与集群连接关系(CheckScsiLunClusterStatus)

API请求

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

API返回

返回示例
{
  "inventory": {
    "attachedHosts": [
      {
        "zoneUuid": "5899ac6fab7d3951acae1d43c4fd7f97",
        "name": "example",
        "uuid": "161616a23a4834cfbe3dd7000a75ef51",
        "clusterUuid": "b886a9367ff9362d8955443cc5065fab",
        "description": "example",
        "managementIp": "192.168.0.1",
        "hypervisorType": "KVM",
        "state": "Enabled",
        "status": "Connected",
        "totalCpuCapacity": 4,
        "availableCpuCapacity": 2,
        "totalMemoryCapacity": 4,
        "availableMemoryCapacity": 4
      }
    ],
    "unattachedHosts": [
      {
        "zoneUuid": "ee802d3432203cc99a9711b3d26e047d",
        "name": "example",
        "uuid": "0d28db87cedc3c729300bcc7f426f9b6",
        "clusterUuid": "5d5325e38b4331c28efe5367dc583110",
        "description": "example",
        "managementIp": "192.168.0.2",
        "hypervisorType": "KVM",
        "state": "Enabled",
        "status": "Connected",
        "totalCpuCapacity": 4,
        "availableCpuCapacity": 2,
        "totalMemoryCapacity": 4,
        "availableMemoryCapacity": 4
      }
    ],
    "isAllHostsAttached": false
  }
}
名字 类型 描述 起始版本
success boolean 0.6
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 3.1.0
inventory ScsiLunClusterStatusInventory 详情参考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
名字 类型 描述 起始版本
isAllHostsAttached Boolean SCSI Lun是否已与集群全部主机连接 3.1.0
attachedHosts List 详情参考attachedHosts 3.1.0
unattachedHosts List 详情参考unattachedHosts 3.1.0
#attachedHosts
名字 类型 描述 起始版本
zoneUuid String 数据中心UUID 0.6
name String 资源名称 0.6
uuid String 资源的UUID,唯一标示该资源 0.6
clusterUuid String 集群UUID 0.6
description String 资源的详细描述 0.6
managementIp String 0.6
hypervisorType String 0.6
state String 0.6
status String 0.6
totalCpuCapacity Long 0.6
availableCpuCapacity Long 0.6
cpuSockets Integer 物理CPU插槽数量 0.6
totalMemoryCapacity Long 0.6
availableMemoryCapacity Long 0.6
cpuNum Integer 逻辑CPU数量 0.6
ipmiAddress String IPMI地址 0.6
ipmiUsername String IPMI用户名 0.6
ipmiPort Integer IPMI端口 0.6
ipmiPowerStatus String IPMI电源状态 0.6
architecture String 0.6
nqn String NVMe 限定名称 zsv 4.10.6
createDate Timestamp 创建时间 0.6
lastOpDate Timestamp 最后一次修改时间 0.6
cpuStatus HwMonitorStatus 详情参考cpuStatus 4.10.0
memoryStatus HwMonitorStatus 详情参考memoryStatus 4.10.0
diskStatus HwMonitorStatus 详情参考diskStatus 4.10.0
nicStatus HwMonitorStatus 详情参考nicStatus 4.10.0
gpuStatus HwMonitorStatus 详情参考gpuStatus 4.10.0
powerSupplyStatus HwMonitorStatus 详情参考powerSupplyStatus 4.10.0
fanStatus HwMonitorStatus 详情参考fanStatus 4.10.0
raidStatus HwMonitorStatus 详情参考raidStatus 4.10.0
temperatureStatus HwMonitorStatus 详情参考temperatureStatus 4.10.0
#cpuStatus
名字 类型 描述 起始版本
Normal HwMonitorStatus 正常 4.10.0
Error HwMonitorStatus 异常 4.10.0
Unknown HwMonitorStatus 未知 4.10.0
#memoryStatus
名字 类型 描述 起始版本
Normal HwMonitorStatus 正常 4.10.0
Error HwMonitorStatus 异常 4.10.0
Unknown HwMonitorStatus 未知 4.10.0
#diskStatus
名字 类型 描述 起始版本
Normal HwMonitorStatus 正常 4.10.0
Error HwMonitorStatus 异常 4.10.0
Unknown HwMonitorStatus 未知 4.10.0
#nicStatus
名字 类型 描述 起始版本
Normal HwMonitorStatus 正常 4.10.0
Error HwMonitorStatus 异常 4.10.0
Unknown HwMonitorStatus 未知 4.10.0
#gpuStatus
名字 类型 描述 起始版本
Normal HwMonitorStatus 正常 4.10.0
Error HwMonitorStatus 异常 4.10.0
Unknown HwMonitorStatus 未知 4.10.0
#powerSupplyStatus
名字 类型 描述 起始版本
Normal HwMonitorStatus 正常 4.10.0
Error HwMonitorStatus 异常 4.10.0
Unknown HwMonitorStatus 未知 4.10.0
#fanStatus
名字 类型 描述 起始版本
Normal HwMonitorStatus 正常 4.10.0
Error HwMonitorStatus 异常 4.10.0
Unknown HwMonitorStatus 未知 4.10.0
#raidStatus
名字 类型 描述 起始版本
Normal HwMonitorStatus 正常 4.10.0
Error HwMonitorStatus 异常 4.10.0
Unknown HwMonitorStatus 未知 4.10.0
#temperatureStatus
名字 类型 描述 起始版本
Normal HwMonitorStatus 正常 4.10.0
Error HwMonitorStatus 异常 4.10.0
Unknown HwMonitorStatus 未知 4.10.0
#unattachedHosts
名字 类型 描述 起始版本
zoneUuid String 数据中心UUID 0.6
name String 资源名称 0.6
uuid String 资源的UUID,唯一标示该资源 0.6
clusterUuid String 集群UUID 0.6
description String 资源的详细描述 0.6
managementIp String 0.6
hypervisorType String 0.6
state String 0.6
status String 0.6
totalCpuCapacity Long 0.6
availableCpuCapacity Long 0.6
cpuSockets Integer 物理CPU插槽数量 0.6
totalMemoryCapacity Long 0.6
availableMemoryCapacity Long 0.6
cpuNum Integer 逻辑CPU数量 0.6
ipmiAddress String IPMI地址 0.6
ipmiUsername String IPMI用户名 0.6
ipmiPort Integer IPMI端口 0.6
ipmiPowerStatus String IPMI电源状态 0.6
architecture String 0.6
nqn String NVMe 限定名称 zsv 4.10.6
createDate Timestamp 创建时间 0.6
lastOpDate Timestamp 最后一次修改时间 0.6
cpuStatus HwMonitorStatus 详情参考cpuStatus 4.10.0
memoryStatus HwMonitorStatus 详情参考memoryStatus 4.10.0
diskStatus HwMonitorStatus 详情参考diskStatus 4.10.0
nicStatus HwMonitorStatus 详情参考nicStatus 4.10.0
gpuStatus HwMonitorStatus 详情参考gpuStatus 4.10.0
powerSupplyStatus HwMonitorStatus 详情参考powerSupplyStatus 4.10.0
fanStatus HwMonitorStatus 详情参考fanStatus 4.10.0
raidStatus HwMonitorStatus 详情参考raidStatus 4.10.0
temperatureStatus HwMonitorStatus 详情参考temperatureStatus 4.10.0
#cpuStatus
名字 类型 描述 起始版本
Normal HwMonitorStatus 正常 4.10.0
Error HwMonitorStatus 异常 4.10.0
Unknown HwMonitorStatus 未知 4.10.0
#memoryStatus
名字 类型 描述 起始版本
Normal HwMonitorStatus 正常 4.10.0
Error HwMonitorStatus 异常 4.10.0
Unknown HwMonitorStatus 未知 4.10.0
#diskStatus
名字 类型 描述 起始版本
Normal HwMonitorStatus 正常 4.10.0
Error HwMonitorStatus 异常 4.10.0
Unknown HwMonitorStatus 未知 4.10.0
#nicStatus
名字 类型 描述 起始版本
Normal HwMonitorStatus 正常 4.10.0
Error HwMonitorStatus 异常 4.10.0
Unknown HwMonitorStatus 未知 4.10.0
#gpuStatus
名字 类型 描述 起始版本
Normal HwMonitorStatus 正常 4.10.0
Error HwMonitorStatus 异常 4.10.0
Unknown HwMonitorStatus 未知 4.10.0
#powerSupplyStatus
名字 类型 描述 起始版本
Normal HwMonitorStatus 正常 4.10.0
Error HwMonitorStatus 异常 4.10.0
Unknown HwMonitorStatus 未知 4.10.0
#fanStatus
名字 类型 描述 起始版本
Normal HwMonitorStatus 正常 4.10.0
Error HwMonitorStatus 异常 4.10.0
Unknown HwMonitorStatus 未知 4.10.0
#raidStatus
名字 类型 描述 起始版本
Normal HwMonitorStatus 正常 4.10.0
Error HwMonitorStatus 异常 4.10.0
Unknown HwMonitorStatus 未知 4.10.0
#temperatureStatus
名字 类型 描述 起始版本
Normal HwMonitorStatus 正常 4.10.0
Error HwMonitorStatus 异常 4.10.0
Unknown HwMonitorStatus 未知 4.10.0

SDK示例

Java SDK
CheckScsiLunClusterStatusAction action = new CheckScsiLunClusterStatusAction();
action.uuid = "abe6bf1e763739f88f97055c14246245";
action.clusterUuid = "5415c2beb8a93447a27f69c109cdfb23";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CheckScsiLunClusterStatusAction.Result res = action.call();
Python SDK
CheckScsiLunClusterStatusAction action = CheckScsiLunClusterStatusAction()
action.uuid = "abe6bf1e763739f88f97055c14246245"
action.clusterUuid = "5415c2beb8a93447a27f69c109cdfb23"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CheckScsiLunClusterStatusAction.Result res = action.call()

将LUN设备从主机上卸载(DetachScsiLunFromHost)

API请求

URLs
PUT zstack/v1/storage-devices/scsi-lun/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "detachScsiLunFromHost": {
    "hostUuid": "dce542427a3a3d1fa13324c9f67352cb"
  },
  "systemTags": [],
  "userTags": []
}
Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"detachScsiLunFromHost":{"hostUuid":"dce542427a3a3d1fa13324c9f67352cb"}}' \
http://localhost:8080/zstack/v1/storage-devices/scsi-lun/fb5d3f596f683bd7a3b1bf1c396d5f4d/actions
参数列表
名字 类型 位置 描述 可选值 起始版本
uuid String url SCSI LUN UUID 4.1.6
hostUuid (可选) String body(包含在detachScsiLunFromHost结构中) 主机UUID 4.1.6
systemTags (可选) List body 系统标签 4.1.6
userTags (可选) List body 用户标签 4.1.6

API返回

返回示例
{
  "inventory": {
    "scsiLunHostRefs": [],
    "scsiLunVmInstanceRefs": [],
    "name": "test-scsi-lun",
    "uuid": "e09fbca6d27332a1946326f3ae114fc3",
    "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"
  }
}
名字 类型 描述 起始版本
success boolean 0.6
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 4.1.6
inventory ScsiLunInventory 详情参考inventory 4.1.6
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 0.6
description String 错误的概要描述 0.6
details String 错误的详细信息 0.6
elaboration String 保留字段,默认为null 0.6
opaque LinkedHashMap 保留字段,默认为null 0.6
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 0.6
#inventory
名字 类型 描述 起始版本
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
DetachScsiLunFromHostAction action = new DetachScsiLunFromHostAction();
action.uuid = "fb5d3f596f683bd7a3b1bf1c396d5f4d";
action.hostUuid = "dce542427a3a3d1fa13324c9f67352cb";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DetachScsiLunFromHostAction.Result res = action.call();
Python SDK
DetachScsiLunFromHostAction action = DetachScsiLunFromHostAction()
action.uuid = "fb5d3f596f683bd7a3b1bf1c396d5f4d"
action.hostUuid = "dce542427a3a3d1fa13324c9f67352cb"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DetachScsiLunFromHostAction.Result res = action.call()

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

API请求

URLs
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
参数列表
名字 类型 位置 描述 可选值 起始版本
vmInstanceUuid String url 虚拟机UUID 3.1.0
systemTags (可选) List query 3.1.0
userTags (可选) List query 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"
    }
  ]
}
名字 类型 描述 起始版本
success boolean 3.1.0
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
名字 类型 描述 起始版本
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
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()

查询 SCSI LUN(QueryScsiLun)

API请求

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示例
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

可查询字段

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

API返回

返回示例
{
  "inventories": [
    {
      "scsiLunHostRefs": [
        {
          "id": 1,
          "scsiLunUuid": "6f2428969262315488684c85e14eded2",
          "hostUuid": "0b756ca2d3843412860b7ec1b9315dd4",
          "createDate": "Nov 14, 2017 2:20:57 PM"
        }
      ],
      "scsiLunVmInstanceRefs": [],
      "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,
      "createDate": "Nov 14, 2017 2:20:57 PM",
      "lastOpDate": "Nov 14, 2017 2:20:57 PM"
    },
    {
      "scsiLunHostRefs": [],
      "scsiLunVmInstanceRefs": [],
      "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.zstack:tsn.0000003-lun-0",
      "size": 5497558138880,
      "createDate": "Nov 14, 2017 2:20:57 PM",
      "lastOpDate": "Nov 14, 2017 2:20:57 PM"
    }
  ]
}
名字 类型 描述 起始版本
success boolean 0.6
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 3.2.0
inventories List 详情参考inventories 3.2.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
名字 类型 描述 起始版本
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
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()

获取Raid物理盘SMART信息(GetLocalRaidPhysicalDriveSmart)

API请求

URLs
GET zstack/v1/storage-devices/local-raid/physical-drives/{uuid}/smart
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/local-raid/physical-drives/4608455038ef362b809cf8aff74e0131/smart
参数列表
名字 类型 位置 描述 可选值 起始版本
uuid String url 资源的UUID,唯一标示该资源 3.6
systemTags (可选) List query 3.6
userTags (可选) List query 3.6

API返回

返回示例
{
  "result": [
    {
      "id": 1,
      "attributeName": "Raw_Read_Error_Rate",
      "flag": "0x002f",
      "value": 200,
      "worst": 200,
      "thresh": 41,
      "type": "Pre-fail",
      "updated": "Always",
      "whenFailed": "-",
      "rawValue": 0
    },
    {
      "id": 3,
      "attributeName": "Spin_Up_Time",
      "flag": "0x0027",
      "value": 142,
      "worst": 142,
      "thresh": 17,
      "type": "Pre-fail",
      "updated": "Always",
      "whenFailed": "-",
      "rawValue": 3866
    },
    {
      "id": 4,
      "attributeName": "Start_Stop_Count",
      "flag": "0x0032",
      "value": 100,
      "worst": 100,
      "thresh": 0,
      "type": "Old_age",
      "updated": "Always",
      "whenFailed": "-",
      "rawValue": 22
    },
    {
      "id": 5,
      "attributeName": "Reallocated_Sector_Ct",
      "flag": "0x0033",
      "value": 200,
      "worst": 200,
      "thresh": 140,
      "type": "Pre-fail",
      "updated": "Always",
      "whenFailed": "-",
      "rawValue": 0
    },
    {
      "id": 7,
      "attributeName": "Seek_Error_Rate",
      "flag": "0x002e",
      "value": 200,
      "worst": 200,
      "thresh": 0,
      "type": "Old_age",
      "updated": "Always",
      "whenFailed": "-",
      "rawValue": 0
    },
    {
      "id": 9,
      "attributeName": "Power_On_Hours",
      "flag": "0x0032",
      "value": 97,
      "worst": 97,
      "thresh": 0,
      "type": "Old_age",
      "updated": "Always",
      "whenFailed": "-",
      "rawValue": 2585
    },
    {
      "id": 10,
      "attributeName": "Spin_Retry_Count",
      "flag": "0x0032",
      "value": 100,
      "worst": 253,
      "thresh": 0,
      "type": "Old_age",
      "updated": "Always",
      "whenFailed": "-",
      "rawValue": 0
    },
    {
      "id": 11,
      "attributeName": "Calibration_Retry_Count",
      "flag": "0x0032",
      "value": 100,
      "worst": 253,
      "thresh": 0,
      "type": "Old_age",
      "updated": "Always",
      "whenFailed": "-",
      "rawValue": 0
    },
    {
      "id": 12,
      "attributeName": "Power_Cycle_Count",
      "flag": "0x0032",
      "value": 100,
      "worst": 100,
      "thresh": 0,
      "type": "Old_age",
      "updated": "Always",
      "whenFailed": "-",
      "rawValue": 22
    },
    {
      "id": 16,
      "attributeName": "Unknown_Attribute",
      "flag": "0x0022",
      "value": 0,
      "worst": 200,
      "thresh": 0,
      "type": "Old_age",
      "updated": "Always",
      "whenFailed": "-",
      "rawValue": 34516442916
    },
    {
      "id": 183,
      "attributeName": "Runtime_Bad_Block",
      "flag": "0x0032",
      "value": 100,
      "worst": 100,
      "thresh": 0,
      "type": "Old_age",
      "updated": "Always",
      "whenFailed": "-",
      "rawValue": 0
    },
    {
      "id": 192,
      "attributeName": "Power-Off_Retract_Count",
      "flag": "0x0032",
      "value": 200,
      "worst": 200,
      "thresh": 0,
      "type": "Old_age",
      "updated": "Always",
      "whenFailed": "-",
      "rawValue": 20
    },
    {
      "id": 193,
      "attributeName": "Load_Cycle_Count",
      "flag": "0x0032",
      "value": 200,
      "worst": 200,
      "thresh": 0,
      "type": "Old_age",
      "updated": "Always",
      "whenFailed": "-",
      "rawValue": 4
    },
    {
      "id": 194,
      "attributeName": "Temperature_Celsius",
      "flag": "0x0022",
      "value": 112,
      "worst": 106,
      "thresh": 0,
      "type": "Old_age",
      "updated": "Always",
      "whenFailed": "-",
      "rawValue": 31
    },
    {
      "id": 196,
      "attributeName": "Reallocated_Event_Count",
      "flag": "0x0032",
      "value": 200,
      "worst": 200,
      "thresh": 0,
      "type": "Old_age",
      "updated": "Always",
      "whenFailed": "-",
      "rawValue": 0
    },
    {
      "id": 197,
      "attributeName": "Current_Pending_Sector",
      "flag": "0x0032",
      "value": 200,
      "worst": 200,
      "thresh": 0,
      "type": "Old_age",
      "updated": "Always",
      "whenFailed": "-",
      "rawValue": 0
    },
    {
      "id": 198,
      "attributeName": "Offline_Uncorrectable",
      "flag": "0x0030",
      "value": 200,
      "worst": 200,
      "thresh": 0,
      "type": "Old_age",
      "updated": "Offline",
      "whenFailed": "-",
      "rawValue": 0
    },
    {
      "id": 199,
      "attributeName": "UDMA_CRC_Error_Count",
      "flag": "0x0032",
      "value": 200,
      "worst": 200,
      "thresh": 0,
      "type": "Old_age",
      "updated": "Always",
      "whenFailed": "-",
      "rawValue": 0
    },
    {
      "id": 200,
      "attributeName": "Multi_Zone_Error_Rate",
      "flag": "0x08",
      "value": 200,
      "worst": 200,
      "thresh": 0,
      "type": "Old_age",
      "updated": "Offline",
      "whenFailed": "-",
      "rawValue": 0
    }
  ]
}
名字 类型 描述 起始版本
success boolean 0.6
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 3.6
result List 详情参考result 3.6
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 0.6
description String 错误的概要描述 0.6
details String 错误的详细信息 0.6
elaboration String 保留字段,默认为null 0.6
opaque LinkedHashMap 保留字段,默认为null 0.6
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 0.6
#result
名字 类型 描述 起始版本
id Integer Id 3.6
attributeName String 属性名 3.6
flag String 标志 3.6
value Integer 当前归一化值 3.6
worst Integer 最差归一化值 3.6
thresh Integer 阈值 3.6
type String 类型 3.6
updated String 更新 3.6
whenFailed String 磁盘失效 3.6
rawValue Long 原始值 3.6
state String 健康状态 3.6

SDK示例

Java SDK
GetLocalRaidPhysicalDriveSmartAction action = new GetLocalRaidPhysicalDriveSmartAction();
action.uuid = "4608455038ef362b809cf8aff74e0131";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetLocalRaidPhysicalDriveSmartAction.Result res = action.call();
Python SDK
GetLocalRaidPhysicalDriveSmartAction action = GetLocalRaidPhysicalDriveSmartAction()
action.uuid = "4608455038ef362b809cf8aff74e0131"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetLocalRaidPhysicalDriveSmartAction.Result res = action.call()

操作Raid物理盘定位灯(LocateLocalRaidPhysicalDrive)

API请求

URLs
PUT zstack/v1/storage-devices/local-raid/physical-drives/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "locateLocalRaidPhysicalDrive": {
    "locate": true
  },
  "systemTags": [],
  "userTags": []
}
Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"locateLocalRaidPhysicalDrive":{"locate":true}}' \
http://localhost:8080/zstack/v1/storage-devices/local-raid/physical-drives/572005810d8536c6a24ef9509f362c84/actions
参数列表
名字 类型 位置 描述 可选值 起始版本
uuid String url 资源的UUID,唯一标示该资源 3.6
locate (可选) Boolean body(包含在locateLocalRaidPhysicalDrive结构中) 打开或关闭定位灯 3.6
systemTags (可选) List body 3.6
userTags (可选) List body 3.6

API返回

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

SDK示例

Java SDK
LocateLocalRaidPhysicalDriveAction action = new LocateLocalRaidPhysicalDriveAction();
action.uuid = "572005810d8536c6a24ef9509f362c84";
action.locate = true;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
LocateLocalRaidPhysicalDriveAction.Result res = action.call();
Python SDK
LocateLocalRaidPhysicalDriveAction action = LocateLocalRaidPhysicalDriveAction()
action.uuid = "572005810d8536c6a24ef9509f362c84"
action.locate = true
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
LocateLocalRaidPhysicalDriveAction.Result res = action.call()

查询Raid控制器(QueryLocalRaidController)

API请求

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

可查询字段

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

API返回

返回示例
{
  "inventories": [
    {
      "uuid": "ba2fe0dcd360397a92748ea6efe9ffd6",
      "name": "raidPhysical",
      "raidLevel": "raid1",
      "raidControllerUuid": "1022305d664e34329a63f350a2fd1e02",
      "enclosureDeviceId": 252,
      "slotNumber": 1,
      "diskGroup": 0,
      "wwn": "50014ee059f2f491",
      "serialNumber": "V6GLEX2S",
      "deviceModel": "HGST HUS726T4TALA6L4",
      "size": 1000204886016,
      "driveState": "Online, Spun Up",
      "locateStatus": "Disabled",
      "driveType": "SATA",
      "mediaType": "HDD",
      "rotationRate": 7200,
      "createDate": "Nov 14, 2017 2:20:57 PM",
      "lastOpDate": "Nov 14, 2017 2:20:57 PM"
    },
    {}
  ]
}
名字 类型 描述 起始版本
success boolean 0.6
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 3.6
inventories List 详情参考inventories 3.6
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 0.6
description String 错误的概要描述 0.6
details String 错误的详细信息 0.6
elaboration String 保留字段,默认为null 0.6
opaque LinkedHashMap 保留字段,默认为null 0.6
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 0.6
#inventories
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 3.6
name String 资源名称 3.6
raidLevel String Raid级别 3.6
raidControllerUuid String Raid控制器Uuid 3.6
description String 资源的详细描述 3.6
enclosureDeviceId Integer Enclosure Id 3.6
slotNumber Integer 槽位号 3.6
deviceId Integer Device Id 3.6
diskGroup Integer 磁盘组 Id 3.6
wwn String WWN 3.6
serialNumber String 序列号 3.6
deviceModel String 磁盘规格 3.6
size Long 磁盘大小 3.6
driveState String 磁盘状态 3.6
driveType String 接口类型 3.6
mediaType String 介质类型 3.6
rotationRate Integer 转速 3.6
createDate Timestamp 创建时间 3.6
lastOpDate Timestamp 最后一次修改时间 3.6
locateStatus LocateStatus 详情参考locateStatus 3.6
#locateStatus
名字 类型 描述 起始版本
Enabled LocateStatus 定位灯闪烁 3.6
Disabled LocateStatus 定位灯关闭 3.6

SDK示例

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

查询Raid物理盘(QueryLocalRaidPhysicalDrive)

API请求

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

可查询字段

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

API返回

返回示例
{
  "inventories": [
    {
      "uuid": "ba2fe0dcd360397a92748ea6efe9ffd6",
      "name": "raidPhysical",
      "raidLevel": "raid1",
      "raidControllerUuid": "1022305d664e34329a63f350a2fd1e02",
      "enclosureDeviceId": 252,
      "slotNumber": 1,
      "diskGroup": 0,
      "wwn": "50014ee059f2f491",
      "serialNumber": "V6GLEX2S",
      "deviceModel": "HGST HUS726T4TALA6L4",
      "size": 1000204886016,
      "driveState": "Online, Spun Up",
      "locateStatus": "Disabled",
      "driveType": "SATA",
      "mediaType": "HDD",
      "rotationRate": 7200,
      "createDate": "Nov 14, 2017 2:20:57 PM",
      "lastOpDate": "Nov 14, 2017 2:20:57 PM"
    },
    {}
  ]
}
名字 类型 描述 起始版本
success boolean 0.6
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 3.6
inventories List 详情参考inventories 3.6
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 0.6
description String 错误的概要描述 0.6
details String 错误的详细信息 0.6
elaboration String 保留字段,默认为null 0.6
opaque LinkedHashMap 保留字段,默认为null 0.6
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 0.6
#inventories
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 3.6
name String 资源名称 3.6
raidLevel String Raid级别 3.6
raidControllerUuid String Raid控制器Uuid 3.6
description String 资源的详细描述 3.6
enclosureDeviceId Integer Enclosure Id 3.6
slotNumber Integer 槽位号 3.6
deviceId Integer Device Id 3.6
diskGroup Integer 磁盘组 Id 3.6
wwn String WWN 3.6
serialNumber String 序列号 3.6
deviceModel String 磁盘规格 3.6
size Long 磁盘大小 3.6
driveState String 磁盘状态 3.6
driveType String 接口类型 3.6
mediaType String 介质类型 3.6
rotationRate Integer 转速 3.6
createDate Timestamp 创建时间 3.6
lastOpDate Timestamp 最后一次修改时间 3.6
locateStatus LocateStatus 详情参考locateStatus 3.6
#locateStatus
名字 类型 描述 起始版本
Enabled LocateStatus 定位灯闪烁 3.6
Disabled LocateStatus 定位灯关闭 3.6

SDK示例

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

查询Raid物理盘自检历史(QueryPhysicalDriveSelfTestHistory)

API请求

URLs
GET zstack/v1/storage-devices/local-raid/physical-drives/self-test
GET zstack/v1/storage-devices/local-raid/physical-drives/{raidPhysicalDriveUuid}/self-test
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/local-raid/physical-drives/self-test
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/storage-devices/local-raid/physical-drives/{raidPhysicalDriveUuid}/self-test

可查询字段

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

API返回

返回示例
{
  "inventories": [
    {
      "id": 1,
      "raidPhysicalDriveUuid": "18862cfe4f383f1c8f4e6e64e8de9f4c",
      "runningState": "Success",
      "testResult": "Completed without error",
      "createDate": "Nov 14, 2017 2:20:57 PM",
      "lastOpDate": "Nov 14, 2017 2:20:57 PM"
    },
    {
      "id": 2,
      "raidPhysicalDriveUuid": "adbdac3931c03ab0a1ff769558816563",
      "runningState": "Success",
      "testResult": "Completed without error",
      "createDate": "Nov 14, 2017 2:20:57 PM",
      "lastOpDate": "Nov 14, 2017 2:20:57 PM"
    }
  ]
}
名字 类型 描述 起始版本
success boolean 0.6
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 3.6
inventories List 详情参考inventories 3.6
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 0.6
description String 错误的概要描述 0.6
details String 错误的详细信息 0.6
elaboration String 保留字段,默认为null 0.6
opaque LinkedHashMap 保留字段,默认为null 0.6
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 0.6
#inventories
名字 类型 描述 起始版本
id Long id 3.6
raidPhysicalDriveUuid String Raid物理盘Uuid 3.6
testResult String 自检结果 3.6
createDate Timestamp 创建时间 3.6
lastOpDate Timestamp 最后一次修改时间 3.6
runningState RunningState 详情参考runningState 3.6
#runningState
名字 类型 描述 起始版本
Running RunningState 正在执行 3.6
Success RunningState 执行成果 3.6
Failed RunningState 执行失败 3.6

SDK示例

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

刷新主机Raid信息(RefreshLocalRaid)

API请求

URLs
PUT zstack/v1/storage-devices/local-raid/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "refreshLocalRaid": {
    "hostUuid": "36e5bbc506d632a5ac8e474e6d3b0caf"
  },
  "systemTags": [],
  "userTags": []
}
Note: 上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"refreshLocalRaid":{"hostUuid":"36e5bbc506d632a5ac8e474e6d3b0caf"}}' \
http://localhost:8080/zstack/v1/storage-devices/local-raid/actions
参数列表
名字 类型 位置 描述 可选值 起始版本
hostUuid String body(包含在refreshLocalRaid结构中) 主机UUID 3.6
systemTags (可选) List body 3.6
userTags (可选) List body 3.6

API返回

返回示例
{
  "inventories": [
    {
      "name": "LSI 2208 Raid Controller",
      "uuid": "821bab441f4530b5a741bbed9ca76eb8",
      "description": "this is a description",
      "productName": "LSI 2208 MegaRAID",
      "sasAddress": "500304801f948100",
      "createDate": "Nov 14, 2017 2:20:57 PM",
      "lastOpDate": "Nov 14, 2017 2:20:57 PM"
    }
  ]
}
名字 类型 描述 起始版本
success boolean 0.6
error ErrorCode 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error 3.6
inventories List 详情参考inventories 3.6
#error
名字 类型 描述 起始版本
code String 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 0.6
description String 错误的概要描述 0.6
details String 错误的详细信息 0.6
elaboration String 保留字段,默认为null 0.6
opaque LinkedHashMap 保留字段,默认为null 0.6
cause ErrorCode 根错误,引发当前错误的源错误,若无原错误,该字段为null 0.6
#inventories
名字 类型 描述 起始版本
name String 资源名称 3.6
uuid String 资源的UUID,唯一标示该资源 3.6
description String 资源的详细描述 3.6
productName String 产品名 3.6
sasAddress String SAS地址 3.6
hostUuid String 主机UUID 3.6
createDate Timestamp 创建时间 3.6
lastOpDate Timestamp 最后一次修改时间 3.6
adapterNumber Integer Raid卡编好 3.6
raidPhysicalDrives List 详情参考raidPhysicalDrives 3.6
#raidPhysicalDrives
名字 类型 描述 起始版本
uuid String 资源的UUID,唯一标示该资源 3.6
name String 资源名称 3.6
raidLevel String Raid级别 3.6
raidControllerUuid String Raid控制器Uuid 3.6
description String 资源的详细描述 3.6
enclosureDeviceId Integer Enclosure Id 3.6
slotNumber Integer 槽位号 3.6
deviceId Integer Device Id 3.6
diskGroup Integer 磁盘组 Id 3.6
wwn String WWN 3.6
serialNumber String 序列号 3.6
deviceModel String 磁盘规格 3.6
size Long 磁盘大小 3.6
driveState String 磁盘状态 3.6
driveType String 接口类型 3.6
mediaType String 介质类型 3.6
rotationRate Integer 转速 3.6
createDate Timestamp 创建时间 3.6
lastOpDate Timestamp 最后一次修改时间 3.6
locateStatus LocateStatus 详情参考locateStatus 3.6
#locateStatus
名字 类型 描述 起始版本
Enabled LocateStatus 定位灯闪烁 3.6
Disabled LocateStatus 定位灯关闭 3.6

SDK示例

Java SDK
RefreshLocalRaidAction action = new RefreshLocalRaidAction();
action.hostUuid = "36e5bbc506d632a5ac8e474e6d3b0caf";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
RefreshLocalRaidAction.Result res = action.call();
Python SDK
RefreshLocalRaidAction action = RefreshLocalRaidAction()
action.hostUuid = "36e5bbc506d632a5ac8e474e6d3b0caf"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
RefreshLocalRaidAction.Result res = action.call()

自检主机Raid(SelfTestLocalRaid)

API请求

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

API返回

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

SDK示例

Java SDK
SelfTestLocalRaidAction action = new SelfTestLocalRaidAction();
action.uuid = "e99fe11fc50f342a8d3d14503f503486";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
SelfTestLocalRaidAction.Result res = action.call();
Python SDK
SelfTestLocalRaidAction action = SelfTestLocalRaidAction()
action.uuid = "e99fe11fc50f342a8d3d14503f503486"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
SelfTestLocalRaidAction.Result res = action.call()
开发手册 | ZStack ZSphere · ZVF | ZStack 资源中心