<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi,<div><br></div><div>I've made some quick changes to ONEMC to show the VNC port in the interface. I've updated the template that onemc creates with a GRAPHICS section, enabling vnc on the quest. </div><div><br></div><div>As a workaround until ONE can use the VMID in the graphics section, I use a virsh command to get the vncport. To get this working the webserver user should be allowed to execute the virsh command via sudo. Add the following to sudoers:</div><div><div>apache     ALL=(ALL)       NOPASSWD: /usr/bin/virsh *</div><div><br></div></div><div>Also I encountered some problems with the model section in the KVM template so I commented that out as well. </div><div><br></div><div>Cheers,</div><div><br></div><div>rogier</div><div><br></div><div><a href="http://rogierm.redbee.nl/blog/2010/02/25/one-management-console-show-vnc-display/">ONE Management Console show VNC display</a></div><div><br></div><div><div>--- onemc/include/onemc_funcs.php<span class="Apple-tab-span" style="white-space:pre">     </span>2010-02-25 02:33:04.000000000 +0100</div><div>+++ /var/www/html/onemc/include/onemc_funcs.php<span class="Apple-tab-span" style="white-space:pre">   </span>2010-02-25 02:30:51.000000000 +0100</div><div>@@ -237,11 +237,12 @@</div><div>         if (valid('nbridge')) { if ($comma) { $template .= ",\n"; }; $comma = TRUE; $template .= "BRIDGE = \"".$_GET['nbridge']."\" "; }</div><div>         if (valid('ntarget')) { if ($comma) { $template .= ",\n"; }; $comma = TRUE; $template .= "TARGET = \"".$_GET['ntarget']."\" "; }</div><div>         if (valid('nscript')) { if ($comma) { $template .= ",\n"; }; $comma = TRUE; $template .= "SCRIPT = \"".$_GET['nscript']."\" "; }</div><div>-        if (valid('nmodel')) { if ($comma) { $template .= ",\n"; }; $comma = TRUE; $template .= "MODEL = \"".$_GET['nmodel']."\" "; }</div><div>+        //if (valid('nmodel')) { if ($comma) { $template .= ",\n"; }; $comma = TRUE; $template .= "MODEL = \"".$_GET['nmodel']."\" "; }</div><div>         $template .= "]\n";</div><div>+        $template .= "GRAPHICS = [ type = \"vnc\",listen  = \"0.0.0.0\"] "; </div><div>         $status = rpc2_request("one.vm.allocate", array($_SESSION['auth'], $template));</div><div>         if (isset($status['failed'])) {</div><div>-            print "<tr><td>Err: ".$status['failed']."</td><td></td></tr>\n";</div><div>+            print "<tr><td>Err: ".$status['failed']." $template</td><td></td></tr>\n";</div><div>         }</div><div>     }</div><div> </div><div>@@ -344,9 +345,10 @@</div><div>             $vmpool_info = $vmpool_info['VM_POOL'];</div><div>         else</div><div>             $vmpool_info = array();</div><div>-</div><div>-        print "<tr><td>Id</td><td>User</td><td>Name</td><td>VM State</td><td>LCM State</td><td>Cpu</td><td>Memory</td><td>Host</td><td>Time</td><td></td><td></td></tr>\n";</div><div>+        print "<tr><td>Id</td><td>User</td><td>Name</td><td>VM State</td><td>LCM State</td><td>Cpu</td><td>Memory</td><td>Host</td><td>Time</td><td>VNC port</td><td></td><td></td></tr>\n";</div><div>         foreach ($vmpool_info as $vm) {</div><div>+<span class="Apple-tab-span" style="white-space:pre">  </span>    $vnccommand = "sudo /usr/bin/virsh -c remote:///".$vm['HISTORY']['HOSTNAME'] ." vncdisplay one-" . $vm['ID'];</div><div>+<span class="Apple-tab-span" style="white-space:pre">     </span>    $vncport = `$vnccommand`;</div><div>             $_vm_state = $vm_state[$vm['STATE']];</div><div>             $_lcm_state = $lcm_state[$vm['LCM_STATE']];</div><div>             $time = $vm['ETIME'] - $vm['STIME'];</div><div>@@ -357,7 +359,7 @@</div><div>             $time = (int)$days."d ".(int)$hours.":".(int)$minutes.":".$seconds;</div><div>             print "<tr><td>".$vm['ID']."</td><td>".$vm['USERNAME']."</td><td>".$vm['NAME']."</td><td>".$_vm_state."</td><td>"</div><div>                 .$_lcm_state."</td><td>".$vm['CPU']."</td><td>".$vm['MEMORY']."</td><td>".$vm['HISTORY']['HOSTNAME']."</td>"</div><div>-                ."<td>".$time."</td><td><a href=\"?details=".$vm['ID']."\">details</a> "</div><div>+                ."<td>".$time."</td><td>$vncport</td><td><a href=\"?details=".$vm['ID']."\">details</a> "</div><div>                 ."<a href=\"?log=".$vm['ID']."\">log</a></td>";</div><div>             print "<td><form method=\"GET\"><select name=\"action\">";</div><div>             if ($_vm_state == "pending") {</div><div><br></div></div></body></html>