@@ -123,7 +123,6 @@ use std::time::Duration;
123123
124124use device_manager:: DeviceManager ;
125125use devices:: acpi:: vmgenid:: VmGenIdError ;
126- use devices:: virtio:: device:: VirtioDevice ;
127126use event_manager:: { EventManager as BaseEventManager , EventOps , Events , MutEventSubscriber } ;
128127use seccomp:: BpfProgram ;
129128use snapshot:: Persist ;
@@ -329,20 +328,6 @@ impl Vmm {
329328 self . shutdown_exit_code
330329 }
331330
332- /// Gets the specified bus device.
333- pub fn get_virtio_device (
334- & self ,
335- device_type : u32 ,
336- device_id : & str ,
337- ) -> Option < Arc < Mutex < dyn VirtioDevice > > > {
338- let device = self
339- . device_manager
340- . mmio_devices
341- . get_virtio_device ( device_type, device_id) ?;
342-
343- Some ( device. inner . lock ( ) . expect ( "Poisoned lock" ) . device ( ) . clone ( ) )
344- }
345-
346331 /// Starts the microVM vcpus.
347332 ///
348333 /// # Errors
@@ -591,7 +576,10 @@ impl Vmm {
591576
592577 /// Returns a reference to the balloon device if present.
593578 pub fn balloon_config ( & self ) -> Result < BalloonConfig , BalloonError > {
594- if let Some ( virtio_device) = self . get_virtio_device ( TYPE_BALLOON , BALLOON_DEV_ID ) {
579+ if let Some ( virtio_device) = self
580+ . device_manager
581+ . get_virtio_device ( TYPE_BALLOON , BALLOON_DEV_ID )
582+ {
595583 let config = virtio_device
596584 . lock ( )
597585 . expect ( "Poisoned lock" )
@@ -608,7 +596,10 @@ impl Vmm {
608596
609597 /// Returns the latest balloon statistics if they are enabled.
610598 pub fn latest_balloon_stats ( & self ) -> Result < BalloonStats , BalloonError > {
611- if let Some ( virtio_device) = self . get_virtio_device ( TYPE_BALLOON , BALLOON_DEV_ID ) {
599+ if let Some ( virtio_device) = self
600+ . device_manager
601+ . get_virtio_device ( TYPE_BALLOON , BALLOON_DEV_ID )
602+ {
612603 let latest_stats = virtio_device
613604 . lock ( )
614605 . expect ( "Poisoned lock" )
@@ -633,7 +624,10 @@ impl Vmm {
633624 return Err ( BalloonError :: TooManyPagesRequested ) ;
634625 }
635626
636- if let Some ( virtio_device) = self . get_virtio_device ( TYPE_BALLOON , BALLOON_DEV_ID ) {
627+ if let Some ( virtio_device) = self
628+ . device_manager
629+ . get_virtio_device ( TYPE_BALLOON , BALLOON_DEV_ID )
630+ {
637631 {
638632 virtio_device
639633 . lock ( )
@@ -655,7 +649,10 @@ impl Vmm {
655649 & mut self ,
656650 stats_polling_interval_s : u16 ,
657651 ) -> Result < ( ) , BalloonError > {
658- if let Some ( virtio_device) = self . get_virtio_device ( TYPE_BALLOON , BALLOON_DEV_ID ) {
652+ if let Some ( virtio_device) = self
653+ . device_manager
654+ . get_virtio_device ( TYPE_BALLOON , BALLOON_DEV_ID )
655+ {
659656 {
660657 virtio_device
661658 . lock ( )
0 commit comments