Hello, I have a problem with creation of LXC container via PHP.
API is connectig correctly with pve, because i can start / stop existing container, i am able to list nodes, and check what VIM is next. but while creating LXC i receive bool(false) value.
My code look's like that:
Any Idea what could i do wrong ?
API is connectig correctly with pve, because i can start / stop existing container, i am able to list nodes, and check what VIM is next. but while creating LXC i receive bool(false) value.
My code look's like that:
PHP:
<?php
require ('pve-1/pve2_api.class.php');
$pve2 = new PVE2_API("SERVER_ADRESS", "USERNAME", "pam", "PASSWORD");
$pve2->login();
if ($pve2->login()) {
# Get first node name.
$nodes = $pve2->get_node_list();
$first_node = $nodes[0];
unset($nodes);
$nextVMID = $pve2->get_next_vmid();
$new_container_settings = array();
$new_container_settings['ostemplate'] = "local:vztmpl/ubuntu-16.04-standard_16.04-1_amd64.tar.gz";
$new_container_settings['vmid'] = $nextVMID;
$new_container_settings['cpus'] = "2";
$new_container_settings['description'] = "Test VM using Proxmox 2.0 API";
$new_container_settings['disk'] = "8";
$new_container_settings['hostname'] = "testapi.domain.tld";
$new_container_settings['memory'] = "1024";
$new_container_settings['nameserver'] = "10.11.12.252";
// print_r($new_container_settings);
print("---------------------------\n");
var_dump($pve2->post("/nodes/".$first_node."/lxc/", $new_container_settings));
print("\n\n");
// print_r($pve2->post("/nodes/".$first_node."/lxc/107/status/start", array())); // start lxc
// print_r($pve2->post("/nodes/".$first_node."/lxc/107/status/stop", array())); // stop lxc
} else {
print("Login to Proxmox Host failed.\n");
exit;
}
Any Idea what could i do wrong ?