-
Notifications
You must be signed in to change notification settings - Fork 15
Description
Opening a design issue to address the issue of passing initialization parameters to drivers.
Currently the library assumes that a domain_name parameter is required
https://github.com/Wenzel/libmicrovmi/blob/master/src/lib.rs#L30
and additional parameters can be passed via Option<DriverInitParam>.
adding Memflow comes with new requirements
The issue comes from integrating Memflow.
Memflow has multiple connectors to choose from
qemu_procfskvmpcileechcoredump
each one having a different set of parameters:
qemu_procfs- required: none (will select the first qemu process)
- optional: vm_name
kvm- required: pid
pcileech- required: device, default value:
FPGA - optional: memap, path to a file
- required: device, default value:
- coredump
- required: filepath
also, we might want to initialize the memflow driver without specifying the connector, and let it scan and select the appropriate connector.
Issue with the current implementation
- we require a
domain_nameeven though it might no be necessary with memflow - not related to memflow, but
DriverInitParamcan contain only a single enum for a single driver. It's impossible to pass multiple init args for multiple driver. (eg pass--kvmi-unix-socket=xxxand--memflow-param-xxx=yyyon the command line, in case one or the other is found)
Proposed solution
I'm in favor a removing the domain_name / DriverInitParam and switching to a HashMap<str, str> for connector arguments.
This solves both issues
- passing a
domain_nameis not required - you can pack multiple init args for multiple drivers in the hashmap
Looking at Memflow's own implementation of ConnectorArgs, they wrapped a HashMap.
Also they added a convenient way to set a default value.
Question now, if we go this way, is how to reflect from the examples the arguments that each driver can take (required and optional) ?
Ideally, each driver would explain what its requirements are.