/[projects]/misc/xenconsole/action.php
ViewVC logotype

Contents of /misc/xenconsole/action.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2069 - (show annotations) (download)
Thu Nov 7 21:27:15 2013 UTC (10 years, 6 months ago) by torben
File size: 1261 byte(s)
add reboot option
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 $key = $_GET["key"];
16
17 $uuid = $_GET["uuid"];
18 $action = $_GET["action"];
19
20 $vmref = $xenserver->VM__get_by_uuid($uuid);
21
22 if ($action == "start") {
23 $xenserver->VM__start($vmref, false, false);
24 }
25 if ($action == "shutdown") {
26 $xenserver->VM__clean_shutdown($vmref);
27 }
28 if ($action == "hardshutdown") {
29 $xenserver->VM__hard_shutdown($vmref);
30 }
31
32
33 if ($action == "reboot") {
34 $xenserver->VM__clean_reboot($vmref);
35 }
36 if ($action == "hardreboot") {
37 $xenserver->VM__hard_reboot($vmref);
38 }
39
40 if ($action == "setMemory") {
41 $val = $_GET["val"];
42 if ($val == "") {
43 echo "val is missing";
44 exit(1);
45 }
46
47
48 $xenserver->VM__set_memory_limits($vmref, $val,$val, $val, $val);
49
50
51 }
52 if ($action == "setCPU") {
53 $val = $_GET["val"];
54 if ($val == "") {
55 echo "val is missing";
56 exit(1);
57 }
58
59 $xenserver->VM__set_VCPUs_max($vmref, $val);
60 }
61
62 echo "OK";
63 } else {
64 echo "Missing action or uuid";
65 }
66 ?>

  ViewVC Help
Powered by ViewVC 1.1.20