Get Host Disk Information

GET/zstack/v1/host/get-block-devices

Headers

Authorization: OAuth the-session-uuid

Curl Examples

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 47c467d5c9944985bfbfead8d44cfec2" \
-X GET http://localhost:8080/zstack/v1/host/get-block-devices?username=username&password=password&sshPort=22&hostName=192.168.1.1

Parameter List

NameTypeLocationDescriptionAllowed ValuesStarting Version
usernameStringqueryUsername 4.3.0
password (optional)StringqueryPassword 4.3.0
sshPortIntegerquerySSH Port 4.3.0
hostNameStringqueryHost IP 4.3.0
excludedTypes (optional)ListquerySpecified disk types to exclude 4.3.0
systemTags (optional)ListquerySystem tags 4.3.0
userTags (optional)ListqueryUser tags 4.3.0

API Response

Response Example

{
  "blockDevices": {
    "unusedBlockDevices": [
      {
        "name": "/dev/vdb",
        "type": "disk",
        "size": 322122547200,
        "used": 0,
        "available": 0,
        "physicalSector": 512,
        "logicalSector": 512,
        "partitionTable": "msdos",
        "usedRatio": 0,
        "multipath": false
      },
      {
        "name": "/dev/vdc",
        "type": "disk",
        "size": 429496729600,
        "used": 0,
        "available": 0,
        "physicalSector": 512,
        "logicalSector": 512,
        "partitionTable": "unknown",
        "usedRatio": 0,
        "multipath": false
      }
    ],
    "usedBlockDevices": [
      {
        "name": "/dev/vda",
        "type": "disk",
        "size": 429496729600,
        "used": 0,
        "available": 0,
        "physicalSector": 512,
        "logicalSector": 512,
        "children": [
          {
            "name": "/dev/vda1",
            "type": "part",
            "size": 1073741824,
            "used": 0,
            "available": 0,
            "physicalSector": 512,
            "logicalSector": 512,
            "mountPoint": "/boot",
            "partitionTable": "unknown",
            "usedRatio": 0,
            "multipath": false
          },
          {
            "name": "/dev/vda2",
            "type": "part",
            "size": 428421939200,
            "used": 0,
            "available": 0,
            "physicalSector": 512,
            "logicalSector": 512,
            "children": [
              {
                "name": "/dev/mapper/zstack-root",
                "type": "lvm",
                "size": 419950493696,
                "used": 0,
                "available": 0,
                "physicalSector": 512,
                "logicalSector": 512,
                "mountPoint": "/",
                "partitionTable": "unknown",
                "usedRatio": 0,
                "multipath": false
              },
              {
                "name": "/dev/mapper/zstack-swap",
                "type": "lvm",
                "size": 8468299776,
                "used": 0,
                "available": 0,
                "physicalSector": 512,
                "logicalSector": 512,
                "mountPoint": "[SWAP]",
                "partitionTable": "unknown",
                "usedRatio": 0,
                "multipath": false
              }
            ],
            "partitionTable": "unknown",
            "usedRatio": 0,
            "multipath": false
          }
        ],
        "partitionTable": "unknown",
        "usedRatio": 0,
        "multipath": false
      }
    ]
  }
}
NameTypeDescriptionStarting Version
successboolean 4.3.0
blockDevicesBlockDevicesFor details, see blockDevices4.3.0
errorErrorCodeError code. If not null, indicates the operation failed. This field is null when the operation succeeds. For details, see error4.3.0

blockDevices

NameTypeDescriptionStarting Version
unusedBlockDevicesListFor details, see unusedBlockDevices4.3.0
usedBlockDevicesListFor details, see usedBlockDevices4.3.0

unusedBlockDevices

NameTypeDescriptionStarting Version
nameStringDisk device name4.3.0
typeStringDisk type4.3.0
sizelongDisk capacity4.3.0
usedlongUsed disk capacity4.10.0
availablelongAvailable disk capacity4.10.0
physicalSectorlongPhysical sector size4.3.0
logicalSectorlongLogical sector size4.3.0
mountPointStringMount point4.3.0
partitionTableStringPartition table type4.3.0
fsTypeStringFile system type4.10.0
serialNumberStringSerial number4.10.0
modelStringModel4.10.0
mediaTypeStringMedia type4.10.0
usedRatioStringUsage ratio4.10.0
smartPassedBooleanDisk SMART status4.10.0
smartMessageStringOutput message when failed to get disk SMART status4.10.0
multipathbooleanWhether it is a multipath device. true means the disk itself is a multipath device or an underlying path disk of multipath5.0.0
childrenListFor details, see children4.3.0

usedBlockDevices

NameTypeDescriptionStarting Version
nameStringDisk device name4.3.0
typeStringDisk type4.3.0
sizelongDisk capacity4.3.0
usedlongUsed disk capacity4.10.0
availablelongAvailable disk capacity4.10.0
physicalSectorlongPhysical sector size4.3.0
logicalSectorlongLogical sector size4.3.0
mountPointStringMount point4.3.0
partitionTableStringPartition table type4.3.0
fsTypeStringFile system type4.10.0
serialNumberStringSerial number4.10.0
modelStringModel4.10.0
mediaTypeStringMedia type4.10.0
usedRatioStringUsage ratio4.10.0
smartPassedBooleanDisk SMART status4.10.0
smartMessageStringOutput message when failed to get disk SMART status4.10.0
multipathbooleanWhether it is a multipath device. true means the disk itself is a multipath device or an underlying path disk of multipath5.0.0
childrenListFor details, see children4.3.0

error

NameTypeDescriptionStarting Version
codeStringError code number, globally unique identifier for the error, such as SYS.1000, HOST.10010.6
descriptionStringBrief description of the error0.6
detailsStringDetailed error information0.6
elaborationStringReserved field, defaults to null0.6
opaqueLinkedHashMapReserved field, defaults to null0.6
causeErrorCodeRoot cause. The source error that triggered the current error. If there is no original error, this field is null0.6

SDK Examples

Java SDK

GetPhysicalMachineBlockDevicesAction action = new GetPhysicalMachineBlockDevicesAction();
action.username = "username";
action.password = "password";
action.sshPort = 22;
action.hostName = "192.168.1.1";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetPhysicalMachineBlockDevicesAction.Result res = action.call();

Python SDK

action = GetPhysicalMachineBlockDevicesAction()
action.username = "username"
action.password = "password"
action.sshPort = 22
action.hostName = "192.168.1.1"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()