Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Children Display
alltrue
styleh3
pageSuperb Cloud API

POST /virtual_machines/:virtual_machine_id/disks 

Adds a new disk to specified virtual machine

Sections:

Table of Contents
maxLevel4
minLevel2
includeResponse.*|JSON.*|XML.*

Request Parameters

disk_type* - Either "HDD" (Hard Disk Drive) or "SSD" (Solid State Drive)

label - disk label

primary - set 1 if the disk is primary, otherwise set 0

disk_size* - the disk space in GB

is_swap - set true if this is a swap disk, otherwise set false

mount_point - a physical location in the partition used as a root filesystem

hot_attach -set 1 to enable hot attachment, otherwise set 0. In this case virtual server will not be stopped when adding a disk.

min_iops - minimum number of  IO operations per second (this is a SolidFire related parameter)

add_to_linux_fstab -set true to add the disk to your Linux fstab file, otherwise set false

add_to_freebsd_fstab - set true to add the disk to your FreeBSD fstab file, otherwise set false

require_format_disk – set 1 to format disk, otherwise set 0

file_system - for Linux templates, you can choose ext4 file system instead of the ext3 default one. To set the file-system parameter, you must set the require_format_disk option

Response Parameters

Info

201 status and the newly created disk is returned

 

JSON Request example

Code Block
languagebash
themeRDark
 curl -i -X POST <api_url>/virtual_machines/:virtual_machine_id/disks.json -d '{"disk":{"primary":"0","disk_size":"2","file_system":"ext4","disk_type":"HDD","label":"qwerq", "require_format_disk":"1","mount_point":"/mnt/aaa","hot_attach":"1","min_iops":"600","add_to_linux_fstab":"true","add_to_freebsd_fstab":"false"}}' -u user:userpass -H 'Accept: application/json' -H 'Content-type: application/json'

JSON Response

Code Block
themeRDark
 {
    "disk": {
        "add_to_freebsd_fstab": false,
        "add_to_linux_fstab": true,
        "built": false,
        "burst_bw": 1000,
        "created_at": "2015-08-21T23:59:07+00:00",
        "disk_type": "HDD",
        "disk_size": 2,
        "disk_vm_number": 16,
        "file_system": null,
        "id": 800,
        "identifier": "mrencbv0vggvyg",
        "iqn": null,
        "is_swap": false,
        "label": "qwerq",
        "locked": true,
        "max_bw": 1000,
        "mount_point": "/mnt/aaa",
        "primary": false,
        "updated_at": "2015-08-21T23:59:07+00:00",
        "virtual_machine_id": 488,
        "volume_id": null,
        "has_autobackups": false
    }
}

XML Request example

Code Block
languagebash
themeRDark
 curl -i -X POST <api_url>/virtual_machines/:virtual_machine_id/disks.xml -d '<disk><primary>0</primary><disk_size>5</disk_size><file_system>ext4</file_system><disk_type>SSD</disk_type><mount_point>true</mount_point><hot_attach>1</hot_attach><min_iops>600</min_iops><is_swap>true</is_swap><require_format_disk>1</require_format_disk><add_to_linux_fstab>true</add_to_linux_fstab><add_to_freebsd_fstab>false</add_to_freebsd_fstab></disk>' -u user:userpass -H 'Accept: application/xml' -H 'Content-type: application/xml'