File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -485,6 +485,10 @@ impl App {
485485 }
486486
487487 let pci_devices = self . config . cvm . gpu . list_devices ( ) ?;
488+ let used_slots = pci_devices
489+ . iter ( )
490+ . map ( |d| d. slot . clone ( ) )
491+ . collect :: < HashSet < _ > > ( ) ;
488492 let mut state = self . lock ( ) ;
489493 state. gpu_pool . iter_mut ( ) . for_each ( |gpu| {
490494 gpu. pci_in_use = false ;
@@ -505,7 +509,13 @@ impl App {
505509 if vm. config . manifest . gpus . is_empty ( ) {
506510 continue ;
507511 }
508- allocated_devices. extend ( vm. state . devices . iter ( ) . cloned ( ) ) ;
512+ allocated_devices. extend (
513+ vm. state
514+ . devices
515+ . iter ( )
516+ . filter ( |slot| used_slots. contains ( * slot) )
517+ . cloned ( ) ,
518+ ) ;
509519 }
510520 for gpu in state. gpu_pool . iter_mut ( ) {
511521 if allocated_devices. contains ( & gpu. slot ) {
You can’t perform that action at this time.
0 commit comments