fix: 修复 MSD 启用时 Ventoy 资源初始化问题 #275

- 将 Ventoy 资源初始化纳入 MSD 控制器启用流程
- 支持运行时启用 MSD,无需重启服务
- 调整验收测试并移除启用后的重启逻辑
This commit is contained in:
mofeng-git
2026-07-19 20:08:03 +08:00
parent d31e70515a
commit 5d871e8b21
5 changed files with 24 additions and 48 deletions

View File

@@ -1,5 +1,5 @@
use std::collections::HashMap;
use std::path::PathBuf;
use std::path::{Path, PathBuf};
use std::sync::Arc;
use tokio::sync::RwLock;
use tokio_util::sync::CancellationToken;
@@ -47,9 +47,21 @@ impl MsdController {
}
}
pub async fn init(&self) -> Result<()> {
pub async fn init(&self, ventoy_resource_dir: &Path) -> Result<()> {
info!("Initializing MSD controller");
match ventoy_img::init_resources(ventoy_resource_dir) {
Ok(()) => info!(
"Ventoy resources ready from {}",
ventoy_resource_dir.display()
),
Err(e) => warn!(
"Failed to initialize Ventoy resources from {}: {}. Ventoy drive creation will be unavailable, but regular ISO/IMG MSD remains available",
ventoy_resource_dir.display(),
e
),
}
if let Err(e) = std::fs::create_dir_all(&self.images_path) {
warn!("Failed to create images directory: {}", e);
}