Skip to content

Commit 5c02ae8

Browse files
committed
vmm: Allow empty gpus list when gpu is not enabled
1 parent 4631d94 commit 5c02ae8

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

vmm/rpc/src/lib.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,12 @@ extern crate alloc;
77
pub use generated::*;
88

99
mod generated;
10+
11+
impl GpuConfig {
12+
pub fn is_empty(&self) -> bool {
13+
if self.attach_mode == "all" {
14+
return false;
15+
}
16+
self.gpus.is_empty()
17+
}
18+
}

vmm/src/main_service.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ pub fn resolve_gpus_with_config(
6666
gpu_cfg: &rpc::GpuConfig,
6767
cvm_config: &crate::config::CvmConfig,
6868
) -> Result<GpuConfig> {
69-
if !cvm_config.gpu.enabled {
69+
if !cvm_config.gpu.enabled && !gpu_cfg.is_empty() {
7070
bail!("GPU is not enabled");
7171
}
7272
let gpus = resolve_gpus(gpu_cfg)?;

0 commit comments

Comments
 (0)