Get Host Disk Information
Headers
Authorization: OAuth the-session-uuidCurl 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.1Parameter List
| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| username | String | query | Username | 4.3.0 | |
| password (optional) | String | query | Password | 4.3.0 | |
| sshPort | Integer | query | SSH Port | 4.3.0 | |
| hostName | String | query | Host IP | 4.3.0 | |
| excludedTypes (optional) | List | query | Specified disk types to exclude | 4.3.0 | |
| systemTags (optional) | List | query | System tags | 4.3.0 | |
| userTags (optional) | List | query | User 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
}
]
}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | 4.3.0 | |
| blockDevices | BlockDevices | For details, see blockDevices | 4.3.0 |
| error | ErrorCode | Error code. If not null, indicates the operation failed. This field is null when the operation succeeds. For details, see error | 4.3.0 |
blockDevices
| Name | Type | Description | Starting Version |
|---|---|---|---|
| unusedBlockDevices | List | For details, see unusedBlockDevices | 4.3.0 |
| usedBlockDevices | List | For details, see usedBlockDevices | 4.3.0 |
unusedBlockDevices
| Name | Type | Description | Starting Version |
|---|---|---|---|
| name | String | Disk device name | 4.3.0 |
| type | String | Disk type | 4.3.0 |
| size | long | Disk capacity | 4.3.0 |
| used | long | Used disk capacity | 4.10.0 |
| available | long | Available disk capacity | 4.10.0 |
| physicalSector | long | Physical sector size | 4.3.0 |
| logicalSector | long | Logical sector size | 4.3.0 |
| mountPoint | String | Mount point | 4.3.0 |
| partitionTable | String | Partition table type | 4.3.0 |
| fsType | String | File system type | 4.10.0 |
| serialNumber | String | Serial number | 4.10.0 |
| model | String | Model | 4.10.0 |
| mediaType | String | Media type | 4.10.0 |
| usedRatio | String | Usage ratio | 4.10.0 |
| smartPassed | Boolean | Disk SMART status | 4.10.0 |
| smartMessage | String | Output message when failed to get disk SMART status | 4.10.0 |
| multipath | boolean | Whether it is a multipath device. true means the disk itself is a multipath device or an underlying path disk of multipath | 5.0.0 |
| children | List | For details, see children | 4.3.0 |
usedBlockDevices
| Name | Type | Description | Starting Version |
|---|---|---|---|
| name | String | Disk device name | 4.3.0 |
| type | String | Disk type | 4.3.0 |
| size | long | Disk capacity | 4.3.0 |
| used | long | Used disk capacity | 4.10.0 |
| available | long | Available disk capacity | 4.10.0 |
| physicalSector | long | Physical sector size | 4.3.0 |
| logicalSector | long | Logical sector size | 4.3.0 |
| mountPoint | String | Mount point | 4.3.0 |
| partitionTable | String | Partition table type | 4.3.0 |
| fsType | String | File system type | 4.10.0 |
| serialNumber | String | Serial number | 4.10.0 |
| model | String | Model | 4.10.0 |
| mediaType | String | Media type | 4.10.0 |
| usedRatio | String | Usage ratio | 4.10.0 |
| smartPassed | Boolean | Disk SMART status | 4.10.0 |
| smartMessage | String | Output message when failed to get disk SMART status | 4.10.0 |
| multipath | boolean | Whether it is a multipath device. true means the disk itself is a multipath device or an underlying path disk of multipath | 5.0.0 |
| children | List | For details, see children | 4.3.0 |
error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | Error code number, globally unique identifier for the error, such as SYS.1000, HOST.1001 | 0.6 |
| description | String | Brief description of the error | 0.6 |
| details | String | Detailed error information | 0.6 |
| elaboration | String | Reserved field, defaults to null | 0.6 |
| opaque | LinkedHashMap | Reserved field, defaults to null | 0.6 |
| cause | ErrorCode | Root cause. The source error that triggered the current error. If there is no original error, this field is null | 0.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()