[one-users] vnc port in onemc

sergio garcia escriche sergei.garcia at gmail.com
Thu Feb 25 06:25:01 PST 2010


Hi Rogier ,

I try to put your patch in onemc_funcs.php, but when i start the vm not show
the vncport.
I put in /etc/sudoers permission to www-data(apache user) to acces tor
virsh.

Thank you very much

Sergio

2010/2/25 Ignacio Martin Llorente <llorente at dacya.ucm.es>

> Dear friends,
>
> Please move this discussion to the ecosystem mailing list, so we could keep
> this list for opennebula core discussions. We have created the ecosystem
> mailing list to discuss integration issues of ONE with other components in
> the ecosystem catalog (http://www.opennebula.org/software:ecosystem).
>
> Thanks!
>
> Ignacio
>
> --
> Ignacio M. Llorente, Full Professor (Catedratico):
> http://dsa-research.org/llorente
> DSA Research Group:  web http://dsa-research.org and blog
> http://blog.dsa-research.org
> OpenNebula Open Source Toolkit for Cloud Computing:
> http://www.OpenNebula.org
> RESERVOIR European Project in Cloud Computing: http://www.reservoir-fp7.eu
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> On 25/02/2010, at 11:55, Jeroen Nijhof 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
>
> _______________________________________________
> Users mailing list
> Users at lists.opennebula.org
> http://lists.opennebula.org/listinfo.cgi/users-opennebula.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opennebula.org/pipermail/users-opennebula.org/attachments/20100225/03a73f6e/attachment-0003.htm>


More information about the Users mailing list