[PVE-User] pve2_api.class.php - create vz container - 500 can't find file / can't parse directory

Robert Anderson randerson at lbsd.net
Thu Oct 18 11:04:59 CEST 2012


I'm using the script available at 
https://github.com/CpuID/pve2-api-php-client

My problem is that I can't seem to get the ostemplate parameter 
directory path right.

The result I'm getting is as follows:

This API Request Failed.
HTTP Response - 500
HTTP Error - HTTP/1.1 500 can't find file 
'/var/lib/vz/template/cache/debian-6.0-x86_64.tar.gz'



The part of the script making the call is as follows:

# Get first node name.
$nodes = $pve2->get_node_list();
$first_node = $nodes[0];
unset($nodes);

# Create a VZ container on the first node in the cluster.
$new_container_settings = array();
$new_container_settings['ostemplate'] = 
"local:vztmpl/debian-6.0-x86_64.tar.gz";
$new_container_settings['vmid'] = "131231";
$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'] = "pve2api-test-host";
$new_container_settings['memory'] = "1024";
#$new_container_settings['nameserver'] = "4.2.2.1";

// print_r($new_container_settings);
print("---------------------------\n");

print_r($pve2->post("/nodes/".$first_node."/openvz", 
$new_container_settings));
print("\n\n");


On the machine I'm connecting to I've used the following command to list 
templates:

root at vserver-host1:~# pvesm list local --content vztmpl
local:vztmpl/centos-6-x86_64-20120114.tar.gz              tgz  181180617
local:vztmpl/debian-6.0-x86_64.tar.gz                     tgz  158084534


Other ostemplate strings I've tried are:

/var/lib/vz/template/cache/debian-6.0-x86_64.tar.gz
cache/debian-6.0-x86_64.tar.gz


What am I doing wrong?



More information about the pve-user mailing list