commit | author | age
|
413d3b
|
1 |
<?php |
T |
2 |
|
b1a6a5
|
3 |
require 'soap_config.php'; |
413d3b
|
4 |
|
T |
5 |
|
|
6 |
$client = new SoapClient(null, array('location' => $soap_location, |
b1a6a5
|
7 |
'uri' => $soap_uri, |
MC |
8 |
'trace' => 1, |
|
9 |
'exceptions' => 1)); |
413d3b
|
10 |
|
T |
11 |
|
|
12 |
try { |
b1a6a5
|
13 |
if($session_id = $client->login($username, $password)) { |
413d3b
|
14 |
echo 'Logged successfull. Session ID:'.$session_id.'<br />'; |
T |
15 |
} |
b1a6a5
|
16 |
|
413d3b
|
17 |
//* Set the function parameters. |
T |
18 |
$client_id = 1; |
|
19 |
$params = array( |
b1a6a5
|
20 |
'template_name' => 'tone', |
MC |
21 |
'diskspace' => 10, |
|
22 |
'traffic' => -1, |
|
23 |
'bandwidth' => -1, |
|
24 |
'ram' => 256, |
|
25 |
'ram_burst' => 512, |
|
26 |
'cpu_units' => 1000, |
|
27 |
'cpu_num' => 4, |
|
28 |
'cpu_limit' => 400, |
|
29 |
'io_priority' => 4, |
|
30 |
'active' => 'y', |
|
31 |
'description' => 'howto', |
|
32 |
'numproc' => '999999:999999', |
|
33 |
'numtcpsock' => '7999992:7999992', |
|
34 |
'numothersock' => '7999992:7999992', |
411a6f
|
35 |
'vmguarpages' => '65536:unlimited', |
b1a6a5
|
36 |
'kmemsize' => '2147483646:2147483646', |
MC |
37 |
'tcpsndbuf' => '214748160:396774400', |
|
38 |
'tcprcvbuf' => '214748160:396774400', |
|
39 |
'othersockbuf' => '214748160:396774400', |
|
40 |
'dgramrcvbuf' => '214748160:396774400', |
|
41 |
'oomguarpages' => '65536:65536', |
411a6f
|
42 |
'privvmpages' => '131072:139264', |
b1a6a5
|
43 |
'lockedpages' => '999999:999999', |
MC |
44 |
'shmpages' => '65536:65536', |
|
45 |
'physpages' => '0:2147483647', |
|
46 |
'numfile' => '23999976:23999976', |
|
47 |
'avnumproc' => '180:180', |
|
48 |
'numflock' => '999999:999999', |
|
49 |
'numpty' => '500000:500000', |
|
50 |
'numsiginfo' => '999999:999999', |
|
51 |
'dcachesize' => '2147483646:2147483646', |
|
52 |
'numiptent' => '999999:999999', |
|
53 |
'swappages' => '256000:256000', |
|
54 |
'hostname' => 'host', |
|
55 |
'nameserver' => 'ns1', |
|
56 |
'create_dns' => 'n', |
|
57 |
'capability' => '' |
|
58 |
); |
|
59 |
|
413d3b
|
60 |
$template_id = $client->openvz_template_add($session_id, $client_id, $params); |
T |
61 |
|
|
62 |
echo "Template ID: ".$template_id."<br>"; |
b1a6a5
|
63 |
|
413d3b
|
64 |
if($client->logout($session_id)) { |
T |
65 |
echo 'Logged out.<br />'; |
|
66 |
} |
b1a6a5
|
67 |
|
MC |
68 |
|
413d3b
|
69 |
} catch (SoapFault $e) { |
T |
70 |
echo $client->__getLastResponse(); |
|
71 |
die('SOAP Error: '.$e->getMessage()); |
|
72 |
} |
|
73 |
|
|
74 |
?> |