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

Annotation of /misc/xenconsole/getisolist.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2018 - (hide annotations) (download)
Thu Jul 18 13:00:14 2013 UTC (10 years, 10 months ago) by torben
File size: 800 byte(s)
first functioning CD selector
1 torben 2016 <?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     $srlist = $xenserver->SR__get_all_records();
10    
11 torben 2018 $vdimap = array();
12     $vdilist = $xenserver->VDI__get_all_records();
13     foreach( $vdilist as $key => $vdirecord) {
14    
15     $vdimap[ $key ] = $vdirecord["name_label"];
16     }
17    
18    
19    
20 torben 2016 foreach($srlist as $sr) {
21     $srname = $sr["name_label"];
22     $srtype = $sr["type"];
23     if ($srtype != "iso" )
24     continue;
25     //var_dump($sr);
26    
27 torben 2018 $isolist = array();
28    
29 torben 2016 echo "<optgroup label='$srname'>\n";
30     foreach($sr["VDIs"] as $vdiuuid) {
31 torben 2018 $iso = $vdimap[$vdiuuid];
32    
33     $isolist[$iso] = $vdiuuid;
34     }
35    
36     uksort($isolist, strcasecmp);
37    
38     foreach($isolist as $iso => $vdiuuid) {
39 torben 2016 echo "<option value='{$vdiuuid}'>$iso</option>\n";
40     }
41 torben 2018
42 torben 2016 echo "</optgroup>\n";
43     }

  ViewVC Help
Powered by ViewVC 1.1.20