[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MirageOS-devel] Deploying unikernels with files as arguments



> On 3 Aug 2015, at 10:44, Nick Betteridge <buzzheavyyear@xxxxxxxxxxx> wrote:
> 
> I'm trying to find a way of passing a file into a unikernel when deploying. 
> I'm pretty sure this has been mentioned in the lists in the past, but I just 
> can't track down the discussion.
> 
> I really want to avoid using any form of compiled approach or an alternative 
> like vchan etc.. I think that as the file sizes can be as large as 5MB, 
> encoding as a string and passing it as a variable would probably kill the 
> deployment.
> 
> Does anyone know of a simple way forward here?

Mirage 2.6.0 now supports block devices containing tar-formatted data, exposed 
as KV_RO inside the kernel.

To see how it works, check out this commit in mirage-www:

https://github.com/mirage/mirage-www/commit/5c4132ce944aed7375837211193b239d221da946

The function `archive_of_files` is defined here:

https://github.com/mirage/mirage/blob/cd92d39eefda34e73fcd0d365afc6b5be62e78bf/lib/mirage.mli#L159

The implementation will tar up the directory you give it, and add a block 
device to the VM configuration. Take a look at the generated .xl config file to 
see the generated `disk` section. When the VM starts it will scan once through 
the archive and build an index of file -> offset in the tar stream. All reads 
of the data will be done via the block interface, avoiding caching them in 
memory.

It’s also possible to use the FAT filesystem driver but the (driver) code is a 
bit more complicated and has known bugs (mainly concurrency ones which might 
not matter if your data is read only).

Cheers,
Dave


_______________________________________________
MirageOS-devel mailing list
MirageOS-devel@xxxxxxxxxxxxxxxxxxxx
http://lists.xenproject.org/cgi-bin/mailman/listinfo/mirageos-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.