Add New Disk
To add a new disk, use the following request:
POST /virtual_machines/:virtual_machine_id/disks.xml
POST /virtual_machines/:virtual_machine_id/disks.json
XML Request Example
curl -i -X POST http://onapp.test/virtual_machines/458/disks.xml -d '<disk><primary>0</primary><disk_size>5</disk_size><file_system>ext4</file_system><data_store_id>5</data_store_id><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><mounted>true</mounted></disk>' -u user:userpass -H 'Accept: application/xml' -H 'Content-type: application/xml'
JSON Request Example
curl -i -X POST http://onapp.test/virtual_machines/458/disks.json -d '{"disk":{"primary":"0","disk_size":"2","file_system":"ext4","data_store_id":"5","label":"qwerq", "require_format_disk":"1","mount_point":"/mnt/aaa","hot_attach":"1","min_iops":"600","mounted":"true"}}' -u user:userpass -H 'Accept: application/json' -H 'Content-type: application/json'
Where:
data_store_id* - the ID of a data store where this disk is located
label - the disk label
primary - set 1 if the disk is primary, otherwise, set 0
disk_size* - the disk space in GB
Please note that support of secondary disks larger than 2 TB is limited. Certain operations might fail. This will be improved in future releases.
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, a virtual server is not stopped when a disk is added.
To run hot attach, a virtual server template should support VirtIO virtualization. The hot attach option is available only on KVM compute resources based on CentOS 6.x/7.x for virtual servers with VirtIO support.
min_iops - the 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
mounted - set true to mount the disk inside OS automatically, otherwise, set false
You can use a single mounted parameter to substitute the two add_to_linux_fstab and add_to_freebsd_fstab parameters.
require_format_disk - set 1 to format disk, otherwise, set 0
file_system - for Linux-based virtual servers, you can specify the ext4 or xfs file system instead of the ext3 default one. For Windows-based virtual servers, you cannot specify a file system other than ntfs. To set the file_system parameter, you must set the require_format_disk option.