1 |
<?php |
2 |
include("config.php"); |
3 |
include('xenapi.php'); |
4 |
|
5 |
// http://docs.vmd.citrix.com/XenServer/5.5.0/1.0/en_gb/api/docs/html/browser.html |
6 |
|
7 |
/* Establish session with Xenserver */ |
8 |
$xenserver = new XenApi($url, $login, $password); |
9 |
|
10 |
|
11 |
if ($_GET["action"] != "" && $_GET["uuid"] != "" ) { |
12 |
if ($_GET["key"] != $password) { |
13 |
die("Invalid key"); |
14 |
} |
15 |
|
16 |
$uuid = $_GET["uuid"]; |
17 |
$action = $_GET["action"]; |
18 |
|
19 |
$vmref = $xenserver->VM__get_by_uuid($uuid); |
20 |
|
21 |
if ($action == "start") { |
22 |
$xenserver->VM__start($vmref, false, false); |
23 |
} |
24 |
if ($action == "shutdown") { |
25 |
$xenserver->VM__clean_shutdown($vmref); |
26 |
} |
27 |
if ($action == "hardshutdown") { |
28 |
$xenserver->VM__hard_shutdown($vmref); |
29 |
} |
30 |
|
31 |
echo "OK"; |
32 |
} else { |
33 |
echo "Missing action or uuid"; |
34 |
} |
35 |
?> |