Delete Storage

Use the Delete Storage API to delete the storage space information by passing the storage ID. The API response will contain “done” as the details of the deleted storage disk.

HTTP Request

https://hostname:4085/index.php?act=storage

Parameters

NameMethodValueDescriptionRequired
actGETstorageThe action to delete storagesYes
deletePOSTIntThe ID of the storage that needs to be deletedYes

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['delete'] = 2;
    $post['delete'] = '3,4'; // for deleting multiple storage values

    $output = $admin->storages($post);

    print_r(json_encode($output));
?>

Output

{
    "title": "Storage Overview",
    "done": {
        "2": {
            "stid": "2",
            "st_uuid": "6o5q9m2fvmakvmco",
            "name": "QCOW Fi Storage",
            "path": "/dev/vg",
            "type": "block",
            "format": "raw",
            "size": "18.03",
            "free": "18.03",
            "oversell": "0",
            "alert_threshold": "0.00",
            "primary_storage": "0",
            "last_alert": "0"
        }
    },
    "storage": null,
    "storage_servers": {
        "2|0|-2": {
            "stid": "2",
            "serid": "0",
            "sgid": "-2"
        }
    },
    "timenow": 1535565753,
    "time_taken": "0.284"
}
Was this helpful to you?