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.


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!