Open Wenzel opened 5 years ago
I was looking at adding a new function in the Introspectable
trait:
fn detect() -> Result<bool,Box<Error>> where Self: Sized {
And then you could loop over the DriverType
enum, and pick the only hypervisor that will return true
We should rename this feature as hypervisor test, and test whether a given domain name is available on for a specific hypervisor.
Implementing the same logic that LibVMI's driver_init_mode
function does.
Overview:
Next here would be to enable a set of features by default. Of course, we have to take the platform into account, Linux or Windows.
I tried to play with Cargo conditional compilation, but I can't get this thing working as I expect:
Im getting
warning: unused manifest key: target.cfg(target_os="linux").features
warning: unused manifest key: target.cfg(target_os="windows").features
Finished dev [unoptimized + debuginfo] target(s) in 0.02s
I saw the syntax in a SO post: https://stackoverflow.com/questions/39709542/why-does-the-last-platform-specific-dependency-take-precedence-in-cargo
of course, if this isn't supported for the features section, we can ditch the hyper-v driver and set the default linux drivers
Thanks for finding this. At least this should be available in nightly already, according to:
Target-specific features for dependencies has been implemented and is available as a nightly-only feature on the latest nightly 2020-02-23. See the tracking issue at #7914.
In the meantime, we can assume linux by default.
Libmicrovmi's api needs to explicitely specify the hypervisor that we want to use.
We could improve that behavior by detecting if a given hypervisor is present, and test all possible hypervisors (the ones compiled in the library).
As we are only compiling a specific hypervisor, there will be only 2 hypervisors available:
How can we modify the
init
function, so that it takes an optional driver type ?So we could pass None and let the function decide.
What do you think @tathanhdinh, how to implement this feature ?
Thanks.