Monday, July 26, 2010

phpVirtualBox

I would like to point your attention to phpVirtualBox, a new project that - even though still in early beta - provides an almost complete web interface to VirtualBox.

In 2009, we saw that over a dozen web interfaces for VirtualBox were started but none of them was really promising. Our team has always focused on the hypervisor and generally consists of system software developers so we never planned to get in the business of developing web interfaces. From the very beginning, VirtualBox has offered comprehensive APIs and while they initially were only available in C++, we gradually extended language support and now have the most comprehensive API bindings of all virtualization products in the market. Still, most projects we saw made one or more major mistakes in how they talked to VirtualBox. Often they just issued command line calls and parsed output (VBoxManage). We tried to improve the SDK documentation, posted on mailing lists, wrote sample code but still, the project we were hoping for did not emerge.

Finally we decided that we have to kick off this project and get it to state where other capable community members would take over. This is how vboxweb came to life. We did not have a lot of experience writing AJAX software so we first had to do some research about which toolkits would show good results and have the highest chance of attracting contributors. Python, jQuery and an integrated web server were chosen as we wanted to get something that is easy to install.

During the course of playing with vboxweb, we noticed that our scripting API had several deficiencies and that there were some very subtle bugs in SMP environments. We took the time to cleanup those things and generally, vboxweb was a very good tool to refine our scripting APIs. The biggest issue of the vboxweb approach is that it required the Python interpreter (and thus the web server) to live on the same machine as VirtualBox. The reason for this is that we used the local Python bindings as opposed to the web service (SOAP). The main advantage of the local bindings is support for events (callbacks) whereas the web service approach required a good amount of polling for updates. In the next major version of VirtualBox, we will introduce a completely redesigned event handling system allowing web service clients and all scripting languages to listen for events and go without the time consuming polling.

vboxweb inspired a lot of community members and customers about how to use our API and we are happy that Ian Moore took the initiative to develop a comprehensive web interface to VirtualBox. He used PHP (for which we provide equally good bindings thanks to community member James Lucas) and jQuery and the result is simply amazing. phpVirtualBox first showed up as version 0.3 and it is almost feature complete! You will find the full VirtualBox GUI as you know it from your local system in a modern AJAX web interface. In addition to that, the source is extremely well designed -- much better than we could do with vboxweb.

So it's clear that phpVirtualBox is the new star and vboxweb will officially retire and only serve as a sample program.

Thursday, September 10, 2009

VirtualBox 3.0.6 released

The latest update to VirtualBox, version 3.0.6, just got released. As mentioned before, this is good news for the Web Console project as it comes with several fixes and enhancements required for smooth operation.

Once you've updated to 3.0.6, check out the VirtualBox Web Console as described here. Within some minutes, you should be up and running. Still a lot of work to do but there are some useful features that you can enjoy today:

  • Browse your virtual machines and inspect their settings
  • Start virtual machines in headless mode
  • Pause/resume VMs
  • Save the state of running VMs
  • Terminate VMs (hard power off or ACPI)
  • Remote control your VMs using the integrated RDP Web Control
A lot of limitations still like no authentication for the RDP viewer. You will also find a Create VM wizard which is not fully done yet but gives you an idea of what to expect in the near future.

The VirtualBox Web Console is a community project and we are looking for contributors. In an earlier post I talked about the architecture and the mailing lists for developers and users.

Wednesday, September 2, 2009

VirtualBox 3.0.6 BETA 1

Sun has quietly released VirtualBox 3.0.6 BETA 1. The list of changes is quite long and many outstanding issues were addressed.

The good news for the VirtualBox Web Console is that with VirtualBox 3.0.6 BETA 1, it actually becomes usable. The architecture of the Web Console was pushing the VirtualBox Python API to its limits and quite a few issues were detected. Often, event processing got stuck and you had to kill and restart VirtualBox. Luckily, all those issues got fixed in the development version of VirtualBox (called 3.0.51 but not recommended for general use) and now also applied to the stable 3.0 series.

The VirtualBox developers also addressed one important feature request from the Web Console project: automatic RDP port assignment. When running multiple virtual machines on a host, each VM has to bind to a different port for its RDP functionality. With the old API, this was difficult to accomplish. Basically the Web Console would have had to scan ports and find a free port, assign the port to the VM and then hope that the VM could actually bind to the port. The new API allows the Web Console to specify a whole range of ports (even multiple ranges) and the RDP server will try all of those ports and bind to the first available.

If you've been following the Web Console project, you've seen that various bits and pieces got added and that there is steady progress. Still a lot of work to do so no big announcements yet. Once the basic functionality is there and VirtualBox 3.0.6 leaves the beta phase, we're planning to make a public announcement.

PS: The VirtualBox Web Console project is still looking for contributors! Join the Developer Mailing List, check out the code and see what you can contribute!

Tuesday, August 11, 2009

Architecture Overview

The VirtualBox Web Console project is a traditional Web 2.0 / AJAX application. We've tried to select toolkits that are both powerful and widespread, making it easy for other Web 2.0 developers to get up to speed on the project. This article will give you an overview of the architecture and the technologies used.

Presently, the VirtualBox Web Console "server side" has to run on the same computer that is running the VirtualBox instance to be controlled. Even though VirtualBox comes with a remote capable Web Services (SOAP) API, only the local API is supported. Over time, this will change and we also envision managing multiple VirtualBox hosts from a single instance of the VirtualBox Web Console sometime in the future.

The server components are written in the Python programming language and make use of the VirtualBox Python API which is now part of the standard installation of VirtualBox (previously you had to get the VirtualBox SDK and manually setup the Python bindings). On top of Python we chose CherryPy as a very lightweight and powerful web server. The server side code contained in VBoxWebSrv.py talks to VirtualBox using its API and to web clients over HTTP. It's a very thin layer taking requests from the browser clients, validating them and then making the appropriate VirtualBox API calls. Data is transfered using the JSON standard which is easy to parse in an AJAX environment. The Python module also registers for all VirtualBox events (such as VM state changes) and collects the changes for the AJAX module to pick up.

As the Sun RDP Web Control (the Adobe Flash module that can display the VM screens) is not part of the project, the Python module attempts to download it at startup directly from the Sun download server. It is unpacked automatically and will only be downloaded again if an update is available.

The largest part of the code actually runs in the browser. We chose jQuery and jQuery UI as our main AJAX toolkits. The usual mix of HTML, CSS and JavaScript is used to display the interface. As we deal a lot with the VirtualBox data model (e.g. a VM and its properties), we decided to automatically generate JavaScript code that contains suitable objects. The generation happens based on the VirtualBox API description (a custom XML format) and in order to make things simpler, we decided to checkin both the generator and the generated code to avoid any kind of dependency on the VirtualBox SDK.

Thursday, August 6, 2009

In the beginning...

When the VirtualBox Web Console rules the world, you can look back on this posting to remind you what the interface looked like in the early days.

-FB





VirtualBox Web Console Kickoff

We are glad to announce the VirtualBox Web Console project. Over the last years, VirtualBox has become the most popular virtualization software on the desktop (over 16M users). Among its many strengths, user friendliness is probably the most important one. VirtualBox has gained in features, platform support, performance and stability and people are putting it to use in more and more areas.

Being able to run VirtualBox on servers and accessing both the product and the virtual machines remotely, has been on the top of the wishlist of many users. VirtualBox tried to accommodate these users by providing a rich API and command line interface, letting others pick up these interfaces and build web interfaces around. In the early days, there was only C/C++ to choose from (VirtualBox is low level system software and this is where C/C++ are still the way to go). This didn't get the Web 2.0 generation excited. Next, the VirtualBox team added support for Java along with SOAP based Web Services allowing to access the VirtualBox API from a remote machine. This was good for the enterprise where Java is the de facto standard but again, the Web 2.0 generation is far ahead of the old style compiled languages. Finally, the VirtualBox team started a significant effort to add Python to its list of supported languages and they really tried to do it well. The Python bindings are available both locally (i.e. the machine VirtualBox is running on) and remotely using the SOAP bindings. The API looks exactly the same in both cases. The VirtualBox SDK also contains an interactive Python shell which illustrates the concepts.

A lot of people started to work on VirtualBox web interfaces using different techniques. Most actually resorted to calling the command line interface VBoxManage and parsing its output. That's simple to get started but it's not very elegant. Now with all the Python stuff in place, we thought it's time to start a new effort and get all those people on board.

The mission of the VirtualBox Web Console project is very simple: implement the VirtualBox user interface using modern Web 2.0 techniques like AJAX. It will start with very little functionality but our intention is to grow this quickly into a very powerful and easy to use web interface for either a single VirtualBox host or a group of hosts.

The code has been released under the very liberal MIT license. The initial contributor is Sun Microsystems (the VirtualBox team actually) but we expect our role to become smaller over time as more people are joining this project. Initially, the VirtualBox team wanted to contribute the following:
  • A solid architecture that makes optimal use of what VirtualBox provides
  • A selection of suitable technologies like JQuery, CherryPy, Prototype, etc.
  • The Sun RDP Web Control which is a fully featured RDP viewer written in Adobe Flash. We will post more about this component later but this is probably the most innovative part of the VirtualBox Web Console, allowing it to go far beyond what the competition can offer. Note that the Sun RDP Web Control is available under the PUEL, the same license as VirtualBox so its source code is not included with the VirtualBox Web Console.
As of today, the VirtualBox Web Console is still in its very early stages and the benefits to end users are limited. However, it will grow very quickly and with a bit of Web 2.0 knowledge, it should be fairly easy to get up to speed and start contributing!