[Xen-devel] xenapi.VM.create() with (data) uri for PV_kernel and PV_ramdisk

Andreas Florath
2009-07-14T19:02:37Z

Hello!

In my environment there is a central management system which starts
domUs on different dom0s.  This should be done with the help
of the XenAPI.  The problem is that when creating a VM, the remote
local filename must be specified (PV_kernel and PV_ramdisk).
This is a kind of strange; especially when a shared storage between all
dom0s is not possible.
To fix this, I added support for the data uri (as described in RFC 2397)
for the PV_kernel and PV_ramdisk parameters. So it is now possible to
specify the vm in the management system like:
    vmdesc = {
        ''memory_dynamic_max'': 96 * 1024 * 1024,
        ''memory_static_max'': 96 * 1024 * 1024,
        ''PV_kernel'': schema_data.create_from_file(
            "/debian/images/vmlinuz-2.6.26-2-xen-686"),
        ''PV_ramdisk'': schema_data.create_from_file(
            "/debian/images/initrd.img-2.6.26-2-xen-686"),
    ... }
    xenapi.VM.create(vmdesc)
The images are send base64 encoded to the remote host; there the files
are extracted and the vm is started with these files (mostly the same
idea as in pygrub).

The attached code should be seen as PoC.  The following things must be done:
o Add more test cases (file writer is not tested very well)
o The temp files must be deleted at some point of time (check how this
is done in pygrub).
o Add more encodings (RFC 2397 allows also URL encoding) [Really needed?]
o What about other language bindings? (Java, C, ...)
o Adapt documentation

My questions:
1) What do you think about this approach?
2) Is there a chance that this idea will make it to the xen-unstable some
   day?

If there is some kind of ''yes'' for the second question,
I''ll invest some
time and clean up the code and handle the other ToDos.

Any additional hints / remarks are welcome.

Kind regards

Andreas Florath



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com