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

Contents of /misc/xenconsole/getcdinfo.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2018 - (show annotations) (download)
Thu Jul 18 13:00:14 2013 UTC (10 years, 10 months ago) by torben
File size: 707 byte(s)
first functioning CD selector
1 <?php
2
3 require('config.php');
4 include('xenapi.php');
5
6 /* Establish session with Xenserver */
7 $xenserver = new XenApi($url, $login, $password);
8
9
10 $vmuuid = $_GET["uuid"];
11
12 $vmref = $xenserver->VM__get_by_uuid($vmuuid);
13 $vm = $xenserver->VM__get_record($vmref);
14
15 $vdiref = "";
16 $iso = "";
17
18 foreach($vm["VBDs"] as $vbdref) {
19 $vbd = $xenserver->VBD__get_record($vbdref);
20 if ($vbd["type"] == "CD") {
21
22 if ($vbd["empty"] == false) {
23 $vdiref = $vbd["VDI"];
24 $vdi = $xenserver->VDI__get_record($vdiref);
25 $iso = $vdi["name_label"];
26 }
27
28 break;
29 }
30 }
31
32
33 echo "{\n";
34 echo " \"VBD\": \"" . $vbdref . "\", \n";
35 echo " \"VDI\": \"" . $vdiref . "\", \n";
36 echo " \"ISO\": \"" . $iso . "\" \n";
37 echo "}";
38
39 ?>

  ViewVC Help
Powered by ViewVC 1.1.20