Mount Disk to Mount Point

POST/zstack/v1/host/mount-block-device

Headers

Authorization: OAuth the-session-uuid

Body

{
  "params": {
    "username": "username",
    "password": "password",
    "sshPort": 22,
    "hostName": "192.168.1.1",
    "path": "/dev/vdb",
    "mountPoint": "/root/data",
    "filesystemType": "xfs"
  },
  "systemTags": [],
  "userTags": []
}

In the example above, systemTags and userTags fields can be omitted. They are listed to indicate that the body can contain these two fields.

Curl Examples

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"username":"username","password":"password","sshPort":22,"hostName":"192.168.1.1","path":"/dev/vdb","mountPoint":"/root/data","filesystemType":"xfs"}}' \
http://localhost:8080/zstack/v1/host/mount-block-device

Parameter List

Name

Type

Location

Description

Allowed Values

Starting Version

username

String

body (nested in params structure)

Username

 

4.3.0

password (optional)

String

body (nested in params structure)

Password

 

4.3.0

sshPort

Integer

body (nested in params structure)

SSH Port

 

4.3.0

hostName

String

body (nested in params structure)

Host IP

 

4.3.0

path

String

body (nested in params structure)

Absolute path of the disk (for example: /dev/vdb)

 

4.3.0

mountPoint

String

body (nested in params structure)

Mount point

 

4.3.0

filesystemType (optional)

String

body (nested in params structure)

File system type

  • ext4
  • xfs

4.3.0

systemTags (optional)

List

body

System tags

 

4.3.0

userTags (optional)

List

body

User tags

 

4.3.0

API Response

When the API succeeds, it returns an empty JSON structure {}. When an error occurs, the returned JSON structure contains an error field, for example:

{
  "error": {
    "code": "SYS.1001",
    "description": "A message or a operation timeout",
    "details": "Create VM on KVM timeout after 300s"
  }
}

SDK Examples

Java SDK

MountBlockDeviceAction action = new MountBlockDeviceAction();
action.username = "username";
action.password = "password";
action.sshPort = 22;
action.hostName = "192.168.1.1";
action.path = "/dev/vdb";
action.mountPoint = "/root/data";
action.filesystemType = "xfs";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
MountBlockDeviceAction.Result res = action.call();

Python SDK

action = MountBlockDeviceAction()
action.username = "username"
action.password = "password"
action.sshPort = 22
action.hostName = "192.168.1.1"
action.path = "/dev/vdb"
action.mountPoint = "/root/data"
action.filesystemType = "xfs"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()