[one-users] vnc port in onemc + another vnc port discussion

Ruben S. Montero rubensm at dacya.ucm.es
Thu Feb 25 03:43:47 PST 2010


Hi,

Our current approach to solve this is described in

http://dev.opennebula.org/issues/189

The idea is if you do not request a port OpenNebula, it will assign a
default one to you and it will make sure that it does not collide with
other VM's VNC port. We will have a VNC_BASE_PORT in oned.conf and
then if the GRAPHICS attribute does not contain a PORT OpenNebula will
assign VNC_BASE_PORT+VM_ID.

You will be able to access the PORT either with onevm show info, or
you can just derive it from the VM_ID... Note that does not require to
ssh the node and query the hypervisor nor to hack each hypervisor
driver... However in some (really unusual) situations you may end
asking for a used port, but you should be able to solve this for the
cluster nodes of your cloud using the BASE_PORT...

Also using this approach the VNC port can be easily queried and
generated in the OCCI interface as Claude suggests.

Cheers

On Thu, Feb 25, 2010 at 11:55 AM, Jeroen Nijhof <jeroen at nijhofnet.nl> wrote:
>
> Hi Rogier,
>
> It was one of my things I had to do.
> I've to look into it, because onemc is now using the XMLRPC2 api to get
> all the information from ONE.
> Maybe I can get the current VNC port information from XMLRPC2 or I can
> ask or make a patch myself in a way XMLRPC2 does.
>
> Any ideas Ruben?
>
> Thanks for your work so far..
>
> Regards,
> Jeroen Nijhof
>
>
> Op 25/2/2010 schreef "Rogier Mars" <rogier at fortytwo.nl>:
>
>>Hi,
>>
>>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.
>>
>>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:
>>apache     ALL=(ALL)       NOPASSWD: /usr/bin/virsh *
>>
>>Also I encountered some problems with the model section in the KVM
>>template so I commented that out as well.
>>
>>Cheers,
>>
>>rogier
>>
>>ONE Management Console show VNC display
>>
>>--- onemc/include/onemc_funcs.php      2010-02-25 02:33:04.000000000 +0100
>>+++ /var/www/html/onemc/include/onemc_funcs.php        2010-02-25
>>02:30:51.000000000 +0100
>>@@ -237,11 +237,12 @@
>>          if (valid('nbridge')) { if ($comma) { $template .= ",\n"; };
>>$comma = TRUE; $template .= "BRIDGE = \"".$_GET['nbridge']."\" "; }
>>          if (valid('ntarget')) { if ($comma) { $template .= ",\n"; };
>>$comma = TRUE; $template .= "TARGET = \"".$_GET['ntarget']."\" "; }
>>          if (valid('nscript')) { if ($comma) { $template .= ",\n"; };
>>$comma = TRUE; $template .= "SCRIPT = \"".$_GET['nscript']."\" "; }
>>-        if (valid('nmodel')) { if ($comma) { $template .= ",\n"; };
>>$comma = TRUE; $template .= "MODEL = \"".$_GET['nmodel']."\" "; }
>>+        //if (valid('nmodel')) { if ($comma) { $template .= ",\n"; };
>>$comma = TRUE; $template .= "MODEL = \"".$_GET['nmodel']."\" "; }
>>          $template .= "]\n";
>>+        $template .= "GRAPHICS = [ type = \"vnc\",listen  =
>>\"0.0.0.0\"] ";
>>          $status = rpc2_request("one.vm.allocate",
>>array($_SESSION['auth'], $template));
>>          if (isset($status['failed'])) {
>>-            print "<tr><td>Err: ".$status['failed']."</td><td></td></
>>tr>\n";
>>+            print "<tr><td>Err: ".$status['failed']." $template</
>>td><td></td></tr>\n";
>>          }
>>      }
>>
>>@@ -344,9 +345,10 @@
>>              $vmpool_info = $vmpool_info['VM_POOL'];
>>          else
>>              $vmpool_info = array();
>>-
>>-        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";
>>+        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";
>>          foreach ($vmpool_info as $vm) {
>>+          $vnccommand = "sudo /usr/bin/virsh -c remote:///".$vm['HISTORY']
>>['HOSTNAME'] ." vncdisplay one-" . $vm['ID'];
>>+          $vncport = `$vnccommand`;
>>              $_vm_state = $vm_state[$vm['STATE']];
>>              $_lcm_state = $lcm_state[$vm['LCM_STATE']];
>>              $time = $vm['ETIME'] - $vm['STIME'];
>>@@ -357,7 +359,7 @@
>>              $time = (int)$days."d ".(int)$hours.":".(int)
>>$minutes.":".$seconds;
>>              print "<tr><td>".$vm['ID']."</td><td>".
>>$vm['USERNAME']."</td><td>".$vm['NAME']."</td><td>".$_vm_state."</
>>td><td>"
>>                  .$_lcm_state."</td><td>".$vm['CPU']."</td><td>".
>>$vm['MEMORY']."</td><td>".$vm['HISTORY']['HOSTNAME']."</td>"
>>-                ."<td>".$time."</td><td><a href=\"?details=".
>>$vm['ID']."\">details</a> "
>>+                ."<td>".$time."</td><td>$vncport</td><td><a href=\"?
>>details=".$vm['ID']."\">details</a> "
>>                  ."<a href=\"?log=".$vm['ID']."\">log</a></td>";
>>              print "<td><form method=\"GET\"><select name=\"action\">";
>>              if ($_vm_state == "pending") {
>>
> _______________________________________________
> Users mailing list
> Users at lists.opennebula.org
> http://lists.opennebula.org/listinfo.cgi/users-opennebula.org
>



-- 
Dr. Ruben Santiago Montero
Associate Professor, Complutense University of Madrid

URL:    http://dsa-research.org/doku.php?id=people:ruben
Weblog: http://blog.dsa-research.org/?author=7



More information about the Users mailing list