Softaculous


Topic : The primary storage could not be found


Posted By: zetservers on October 12, 2019, 3:20 pm
Hello,

I tried to create a php script creating a server with virtualizor api (tested functions and boot/reboot and so on works fine). I need the script to create a vps on the less used node automatically, so I didn't filled the slave_server and stid values (they are not marked as required in the API documentation). Checked the storage which is marked as primary for one of the nodes and it has enough space available (1.8TB). I am able to create VPS from virtualizor panel itself by selecting the node. However when I run the command on the PHP script via API, I get the error: "error":{"no_storage":"The primary storage could not be found"}. If I set the slave_server to a server ID, it works fine, however I need it to automatically select the node. Is this possible?

Here is the script I made:

    $post = array();
    $post['virt'] = 'xen';
    $post['user_email'] = 'test@test.com';
    $post['user_pass'] = 'test123';
    $post['hostname'] = 'cloud.zetservers.com';
    $post['rootpass'] = 'test123';
    $post['ips'] = array('46.20.140.101');
    $post['space'] = '25';
    $post['ram'] = 1024;
    $post['swapram'] = 0;
    $post['bandwidth'] = 0;
    $post['network_speed'] = 0;
    $post['cpu'] = 1000;
    $post['cores'] = 2;
    $post['osid'] = 866;
    $output = $admin->addvs_v2($post);

    return json_encode($output);

Powered By AEF 1.0.8 © 2007-2008 Electron Inc.