
On Wed, Sep 28, 2011 at 06:37:17PM +0100, Daniel P. Berrange wrote:
We do have a historical syntax from Xen paravirt which lets us call out to a helper at boot time, namely the "<bootloader>" element. With Xen this is typically something like pygrub, or pxegrub, which does some work and writes out a kernel+initrd into temporary files, and prints the file paths + any kernel args on stdout.
We could just wire up this concept in KVM too without any real trouble, and then we could have guestfs-bootloader script todo the magic setup
The attached scripts show how it would work, and furthermore they show that it really does work. The first script is the bootloader script. This creates the libguestfs appliance (3 files called /tmp/kernel, /tmp/initrd and /tmp/root). At the moment, no caching of the appliance is implemented, but that is easy to add. The second script shows the sort of changes we would make to the guestfs_add_domain API in order to run the appliance from libvirt. It's a Ruby script that creates a transient domain, booting from the appliance created in step 1, with the correct virtio-serial port etc. It then tells libguestfs to connect to the virtio-serial socket. Finally it issues some libguestfs commands to create a filesystem, so you can tell that it is actually talking to the libguestfs daemon. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://et.redhat.com/~rjones/virt-top