Proxmox の PHP Api を使用して新しいコンテナを作成しようとしていますが、リクエストを送信しようとすると、Apache のエラー ログに次のように表示されます。
----------------------------------------------
FULL RESPONSE:\n\nHTTP/1.1 200 OK\r\nCache-Control: max-age=0\r\nConnection: Keep-Alive\r\nDate: Sat, 21 Oct 2017 19:12:24 GMT\r\nPragma: no-cache\r\nServer: pve-api-daemon/3.0\r\nContent-Length: 197\r\nContent-Type: application/json;charset=UTF-8\r\nExpires: Sat, 21 Oct 2017 19:12:24 GMT\r\n\r\n{"data":[{"maxdisk":1890533244928,"type":"node","id":"node/px2","disk":2463367168,"maxmem":8335933440,"uptime":270689,"cpu":0.0131703340463503,"maxcpu":4,"node":"px2","mem":4635709440,"level":""}]}\n\nEND FULL RESPONSE\n\nHeaders:\n\nHTTP/1.1 200 OK\r\nCache-Control: max-age=0\r\nConnection: Keep-Alive\r\nDate: Sat, 21 Oct 2017 19:12:24 GMT\r\nPragma: no-cache\r\nServer: pve-api-daemon/3.0\r\nContent-Length: 197\r\nContent-Type: application/json;charset=UTF-8\r\nExpires: Sat, 21 Oct 2017 19:12:24 GMT\n\nEnd Headers\n\nData:\n\n{"data":[{"maxdisk":1890533244928,"type":"node","id":"node/px2","disk":2463367168,"maxmem":8335933440,"uptime":270689,"cpu":0.0131703340463503,"maxcpu":4,"node":"px2","mem":4635709440,"level":""}]}\n\nEnd Data\n\nRESPONSE ARRAY:\n\narray (\n 'data' => \n array (\n 0 => \n array (\n 'maxdisk' => 1890533244928,\n 'type' => 'node',\n 'id' => 'node/px2',\n 'disk' => 2463367168,\n 'maxmem' => 8335933440,\n 'uptime' => 270689,\n 'cpu' => 0.013170334046350299,\n 'maxcpu' => 4,\n 'node' => 'px2',\n 'mem' => 4635709440,\n 'level' => '',\n ),\n ),\n)\n\nEND RESPONSE ARRAY\n----------------------------------------------
[:error] [pid 9148:tid 924] [client ::1:58574] ----------------------------------------------\nFULL RESPONSE:\n\nHTTP/1.1 200 OK\r\nCache-Control: max-age=0\r\nConnection: Keep-Alive\r\nDate: Sat, 21 Oct 2017 19:12:24 GMT\r\nPragma: no-cache\r\nServer: pve-api-daemon/3.0\r\nContent-Length: 197\r\nContent-Type: application/json;charset=UTF-8\r\nExpires: Sat, 21 Oct 2017 19:12:24 GMT\r\n\r\n{"data":[{"uptime":270689,"disk":2463367168,"maxmem":8335933440,"id":"node/px2","type":"node","maxdisk":1890533244928,"level":"","mem":4635709440,"node":"px2","maxcpu":4,"cpu":0.0131703340463503}]}\n\nEND FULL RESPONSE\n\nHeaders:\n\nHTTP/1.1 200 OK\r\nCache-Control: max-age=0\r\nConnection: Keep-Alive\r\nDate: Sat, 21 Oct 2017 19:12:24 GMT\r\nPragma: no-cache\r\nServer: pve-api-daemon/3.0\r\nContent-Length: 197\r\nContent-Type: application/json;charset=UTF-8\r\nExpires: Sat, 21 Oct 2017 19:12:24 GMT\n\nEnd Headers\n\nData:\n\n{"data":[{"uptime":270689,"disk":2463367168,"maxmem":8335933440,"id":"node/px2","type":"node","maxdisk":1890533244928,"level":"","mem":4635709440,"node":"px2","maxcpu":4,"cpu":0.0131703340463503}]}\n\nEnd Data\n\nRESPONSE ARRAY:\n\narray (\n 'data' => \n array (\n 0 => \n array (\n 'uptime' => 270689,\n 'disk' => 2463367168,\n 'maxmem' => 8335933440,\n 'id' => 'node/px2',\n 'type' => 'node',\n 'maxdisk' => 1890533244928,\n 'level' => '',\n 'mem' => 4635709440,\n 'node' => 'px2',\n 'maxcpu' => 4,\n 'cpu' => 0.013170334046350299,\n ),\n ),\n)\n\nEND RESPONSE ARRAY\n----------------------------------------------
[:error] [pid 9148:tid 924] [client ::1:58574] ----------------------------------------------\nFULL RESPONSE:\n\nHTTP/1.1 501 Method 'POST /nodes/px2/openvz' not implemented\r\nCache-Control: max-age=0\r\nConnection: close\r\nDate: Sat, 21 Oct 2017 19:12:24 GMT\r\nPragma: no-cache\r\nServer: pve-api-daemon/3.0\r\nContent-Length: 13\r\nContent-Type: application/json;charset=UTF-8\r\nExpires: Sat, 21 Oct 2017 19:12:24 GMT\r\n\r\n{"data":null}\n\nEND FULL RESPONSE\n\nHeaders:\n\nHTTP/1.1 501 Method 'POST /nodes/px2/openvz' not implemented\r\nCache-Control: max-age=0\r\nConnection: close\r\nDate: Sat, 21 Oct 2017 19:12:24 GMT\r\nPragma: no-cache\r\nServer: pve-api-daemon/3.0\r\nContent-Length: 13\r\nContent-Type: application/json;charset=UTF-8\r\nExpires: Sat, 21 Oct 2017 19:12:24 GMT\n\nEnd Headers\n\nData:\n\n{"data":null}\n\nEnd Data\n\nRESPONSE ARRAY:\n\narray (\n 'data' => NULL,\n)\n\nEND RESPONSE ARRAY\n----------------------------------------------
[:error] [pid 9148:tid 924] [client ::1:58574] This API Request Failed.\nHTTP Response - 501\nHTTP Error - HTTP/1.1 501 Method 'POST /nodes/px2/openvz' not implemented
px2 というノードが 1 つしかありません。関数を呼び出してノード リストを応答として取得すると、NULL が返されます。そのため、ノード名を手動でパスに入れようとしましたが、error.log でこれらのエラーを受け取りました
私は Proxmox v5.0-30 を使用しており、API としてこれを使用しています: https://github.com/CpuID/pve2-api-php-client
--- 編集: コンテナの作成に使用されるコード:
<?php
require ('pve-1/pve2_api.class.php');
$pve2 = new PVE2_API("10.11.12.89", "root", "pam", "password");
$pve2->login();
if ($pve2->login()) {
# Get first node name.
$nodes = $pve2->get_node_list();
$first_node = $nodes[0];
unset($nodes);
$vm
# Create a VZ container on the first node in the cluster.
$new_container_settings = array();
$new_container_settings['ostemplate'] = "local:vztmpl/ubuntu-16.04-standard_16.04-1_amd64.tar.gz";
$new_container_settings['vmid'] = "7777";
$new_container_settings['cpus'] = "2";
$new_container_settings['description'] = "106(test-container)";
$new_container_settings['disk'] = "8";
$new_container_settings['hostname'] = "testapi.domain.tld";
$new_container_settings['memory'] = "1024";
$new_container_settings['nameserver'] = "10.11.12.233";
print_r($new_container_settings);
print("---------------------------\n");
var_dump($pve2->post("/nodes/px2/openvz", $new_container_settings));
print("\n\n");
} else {
print("Login to Proxmox Host failed.\n");
exit;
}