firecracker-microvm / firecracker

Secure and fast microVMs for serverless computing.

Home Page:http://firecracker-microvm.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Refactor `vmm` builder code to simplify logic that creates the microVM to boot

bchalios opened this issue · comments

Description

Currently, the logic to create a Vmm object is scattered across vmm/lib.rs and vmm.builder.rs files and it is quite convoluted and some times difficult to follow. Moreover, there is a lot of architecture specific code inserted in arbitrary places which further increases the un-readability.

Apart from the aesthetics and readability aspect, the state of the code makes it quite difficult to unit test. There are functions that take 7 arguments just to pass them (way) down the stack. That makes unit-testing very hard, since we often need to construct dummy versions of objects (like EventManager) even though they are not used in the part of the code we are trying to test.

Solution

Re-work the vmm construction code to simplify code paths and isolate architecture-specific code.