Get Virtualizor

List Storage

Virtualizor allows you to define multiple storage per physical node. Use the List Storage API to list information about the storage disks on the server. This information is needed while creating VPS which needs the 'st_uuid'. The API response contains all the details of the storages which are listed according to their IDs. To filter or limit the size of the list, you can specify one or more query parameters.

See also: Add Storage guide.

HTTP Request

https://hostname:4085/index.php?act=storage&name=STORAGENAME&path=PATH

Parameters

NameMethodValueDescriptionRequired
actGETstorageThe action performed to perform operation and retrieve list of storagesYes
pagePOSTIntIf not specified then first 50 records would be returnedNo
reslenPOSTIntNumber of records to be returned, default is 50No
nameGETtextSearch storage by storage nameNo
pathGETtextSearch storage by storage pathNo

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);

    $page = 1;
    $reslen = 50;
    $post = array();
    $post['name'] = '';
    $post['path'] = '';

    $output = $admin->storages($post, $page, $reslen);

    print_r(json_encode($output));
?>

Output

{
    "title": "Storage Overview",
    "storage": {
        "773": {
            "stid": "773",
            "st_uuid": "nonm2bfqpnbhehyb",
            "name": "Default Storage",
            "path": "/dev/VolGroup",
            "type": "block",
            "format": "",
            "size": "1862.52",
            "free": "1332.66",
            "oversell": "0",
            "alert_threshold": "0.00",
            "primary_storage": "1",
            "last_alert": "0"
        },
        "782": {
            "stid": "782",
            "st_uuid": "hqfunlq9plmlmj3d",
            "name": "Thin_pool",
            "path": "/dev/VolGroup/thin_pool",
            "type": "thin block",
            "format": "raw",
            "size": "0.00",
            "free": "0.00",
            "oversell": "150",
            "alert_threshold": "90.00",
            "primary_storage": "0",
            "last_alert": "0"
        }
    },
    "storage_servers": [
        {
            "stid": "773",
            "serid": "0",
            "sgid": "-2"
        },
        {
            "stid": "782",
            "serid": "0",
            "sgid": "-2"
        }
    ],
    "timenow": 1535546599,
    "time_taken": "0.076"
}
    Was this page helpful?
    Newsletter Subscription
    Subscribing you to the mailing list