From 8efdf4d8821f630446489d89320c18aa54c14fba Mon Sep 17 00:00:00 2001 From: vincent Date: Tue, 12 Sep 2023 02:56:47 +0800 Subject: [PATCH] Add an auto-detect plugins mechanism for the Wasmedge shim Signed-off-by: vincent --- crates/containerd-shim-wasmedge/src/instance.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/crates/containerd-shim-wasmedge/src/instance.rs b/crates/containerd-shim-wasmedge/src/instance.rs index e2757ac81..9ab7636d5 100644 --- a/crates/containerd-shim-wasmedge/src/instance.rs +++ b/crates/containerd-shim-wasmedge/src/instance.rs @@ -15,13 +15,8 @@ pub struct WasmEdgeEngine { impl Default for WasmEdgeEngine { fn default() -> Self { - PluginManager::load(None).unwrap(); - let host_options = HostRegistrationConfigOptions::default(); let host_options = host_options.wasi(true); - #[cfg(all(target_os = "linux", feature = "wasi_nn", target_arch = "x86_64"))] - let host_options = host_options.wasi_nn(true); - let config = ConfigBuilder::default() .with_host_registration_config(host_options) .build() @@ -59,6 +54,8 @@ impl Engine for WasmEdgeEngine { None => "main".to_string(), }; + PluginManager::load(None)?; + let vm = vm.auto_detect_plugins()?; let vm = vm .register_module_from_file(&mod_name, &path) .context("registering module")?;