Use the Add Storage API to define multiple storage on the virtualizor, Which will used to create vps on the node.The different type of storage can be defined in virtualizor panel such as (LVM, File, Thin LVM, Openvz, ZFS Pool, ZFS Thin, ZFS Compressed, Ceph Block Device).
Storages can be shared between the multple servers.
HTTP Request
https://hostname:4085/index.php?act=addstorage
Parameters
Name | Method | Value | Description | Required |
---|---|---|---|---|
act | GET | volumes | The action specified carries out operation and returns success if the storage has been added successfully | Yes |
name | POST | name | Name of the storage | Yes |
path | POST | text | Path of the Storage | Yes |
type | POST | text | Type of storage | Yes |
serid | POST | array | serid of node integer, for shared storage array | Yes |
format | POST | text | Format type of storage (raw, vhd, qcow2) | Yes |
primary_storage | POST | 1/0 | To make storage primary pass 1 or 0 | Yes |
oversell | POST | int | Max disk space you want to Overcommit for this storage in GB's | No |
alert_threshold | POST | int | Email will be send to admin if it crosses threshold limit | No |
Lightbit project name | POST | string | while adding lightbits storage add project of lightbits storage | No |
Storage type available
Name | Path |
---|---|
LVM | Volume Group path /dev/VG_NAME |
File | Absolute path /FileStorage |
OpenVZ | Absolute path /vz |
Thin LVM | Thin Volume Group path /dev/VGName/THINPOOLNAME |
ZFS Pool | ZFS Volume Group path /dev/zvol/YOUR_POOLNAME |
ZFS Thin | ZFS Volume Group path /dev/zvol/YOUR_POOLNAME |
ZFS Compressed | ZFS Volume Group path /dev/zvol/YOUR_POOLNAME |
ZFS Thin Compressed | ZFS Volume Group path /dev/zvol/YOUR_POOLNAME |
Ceph Block Device | Ceph Block Device path /dev/rbd/CEPH_POOLNAME |
Lightbits storage | Lightbits Block Device path /dev/disk/by-id/uuid |
Sample Code
<?php
require_once('/usr/local/virtualizor/sdk/admin.php');
$key = 'your_api_key';
$pass = 'your_api_pass';
$ip = 'your_server_ip';
$admin = new Virtualizor_Admin_API($ip, $key, $pass);
$post = array();
$post['name'] = 'Test Storage';
$post['serid'] = 0;
$post['path'] = '/dev/vg/thin_pool';
$post['type'] = 'thin block';
$post['format'] = 'raw';
$output = $admin->addstorage($post);
print_r(json_encode($output));
?>
Output
{
"title": "Add Storage",
"done": "2",
"timenow": 1535562728,
"time_taken": "0.303"
}