mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-09-13 02:54:26 +08:00
fix: 修复 MSD 启用时 Ventoy 资源初始化问题 #275
- 将 Ventoy 资源初始化纳入 MSD 控制器启用流程 - 支持运行时启用 MSD,无需重启服务 - 调整验收测试并移除启用后的重启逻辑
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user