princeton-sns / firecracker-tools

5 stars 5 forks source link

A more complete Firerunner, with unbounded requests and responses to the VM #6

Closed alevy closed 5 years ago

alevy commented 5 years ago

This PR adds Vsock support to Firerunner, better structures the Firerunner code to pave the way towards a full controller, and completes the image creation tool to actually use the vsock to receive and respond to requests.

You can now use it as follows:

$ cd images/
$ ./mk_rtimage.sh nodejs nodejs.ext4
...
$ cd examples/loremjs
$ make
...
$ cd ../../firerunner
$ cat > test.jsonl # we'll add some dummy requests
{"foo": 1}
{"foo": 2}
{"foo": 3}
{"foo": 4}
$ cargo run --release --bin firerunner -- --rootfs ../images/nodejs.ext4 --appfs ../images/examples/loremjs/output.ext4 --kernel hello-vmlinux.bin < test.jsonl
Connection from VsockAddr { port: 1024, cid: 42 }
{"request":{"foo":1},"sentence":"Occaecat labore laboris officia laboris."}
{"request":{"foo":2},"sentence":"Minim ad pariatur id dolor consectetur non sunt nulla aute nisi elit dolore aute deserunt."}                                                                                
{"request":{"foo":3},"sentence":"Adipisicing ullamco Lorem enim ut pariatur cupidatat in cupidatat qui ullamco non."}                                                                                        
{"request":{"foo":4},"sentence":"Sint culpa sint aute et excepteur."}
tan-yue commented 5 years ago

Before this PR, I ran into the issue that write to the magic port caused segmentation fault when I used root file system generated by mk_rtimage.sh. Have you @alevy ever tested this?

alevy commented 5 years ago

Ah, I have not actually tried write to the io port with read only file systems. We can keep the devices read/write and resolve it separately