One Laptop Per Child: SDK

Posted: February 19th, 2006 | Filed under: Uncategorized | No Comments »

So, with Chris announcing our work to the world, I can now be a little less coy with my postings. As I mentioned previously, we decided that we needed the management API to be a first class peer of the management UI. One of the first examples of its benefit was in creation of the OLPC Simulator tool. This simple command line tool provides a way to quick way to create machine instances for testing/running OLPC firmware images:

$ olpc-simulator create /path/to/olpc-2006_02_06_16_08.ext3 demo
$ olpc-simulator start demo

It calls out to the same DBus API as the main QEMU Admin GUI, so all changes it makes immediately appear in the GUI too! Another plan we have is to write an extension to the Test-AutoBuild workflow engine providing a means to automate the testing of OS images by having the test harness run them with QEMU. For example, the code for a stage to start a VM would be as short as

    my $qemu = $bus->get_service("com.redhat.qemu.Manager");
    my $manager = $qemu->get_object("/qemu/manager");

    if (!$manager->has_machine($self->option("vm-name"))) {
        $self->fail("no virtual machine called " . $self->option("vm-name") . " is available");
        return;
    }

    my $machine = $manager->get_child_object("/machine/" . $self->option("vm-name"));

    my $delay = $self->option("startup-delay");
    $delay = 5 unless defined $delay;

    if ($machine->is_running) {
        $log->warn("Machine was already running, so we stopped it");
        $machine->stop;
        sleep $delay;
    }

    $machine->start;

    sleep $delay;

    unless ($machine->is_running) {
        $self->fail("unable to start the virtual machine");
        return;
    }

Last week I hoooked up the functionality for managing ISO & disk images within QEMU-Admin. This lets one import a disk image into the management tool, and then when adding a new harddrive to a machine, you can quickly clone the disk image for use with this machine. When cloning disks one can also convert formats to, for example, VMWare compatible format. Similarly with the ISO image library, one might import the Fedora install CD isos, so when setting up CDROM devices, they’re just a click away. In time it’d be desirable to have UI to directly launch “Live CD” isos with a generic machine template. To show off this new functionality, here’s a new flash demo