pub trait HypervisorProbe:
Send
+ Sync
+ 'static {
// Required methods
fn name(&self) -> &str;
fn try_new_resource(&self) -> Result<Option<Resource<HypervisorKind>>>;
fn new_resource(
&self,
params: &[(&str, &str)],
) -> Result<Resource<HypervisorKind>>;
}Expand description
Trait for probing hypervisor backend availability.
Each registered backend provides a probe that can check whether the backend is available and construct a resource for it.
Required Methods§
Sourcefn try_new_resource(&self) -> Result<Option<Resource<HypervisorKind>>>
fn try_new_resource(&self) -> Result<Option<Resource<HypervisorKind>>>
Checks whether this backend is available and, if so, returns a new
[Resource<HypervisorKind>] for it with default settings.
Used for auto-detection: backends are tried in priority order, and
Ok(None) means “skip me, try the next one”.
Sourcefn new_resource(
&self,
params: &[(&str, &str)],
) -> Result<Resource<HypervisorKind>>
fn new_resource( &self, params: &[(&str, &str)], ) -> Result<Resource<HypervisorKind>>
Constructs a [Resource<HypervisorKind>] for an explicitly selected
backend, with optional parameters.
Unlike try_new_resource, this returns
Err (not Ok(None)) if the backend is unavailable, so the caller
gets a specific error message.
params contains backend-specific key-value pairs parsed from the
--hypervisor name:key=val,... CLI syntax. A bare key (no =) is
passed as (key, "true"). Backends should return an error for
unrecognized keys.