@@ -526,7 +526,7 @@ impl Vmm {
526
526
path_on_host : String ,
527
527
) -> Result < ( ) , VmmError > {
528
528
self . device_manager
529
- . try_with_virtio_device_with_id ( drive_id, |block : & mut Block | {
529
+ . with_virtio_device ( drive_id, |block : & mut Block | {
530
530
block. update_disk_image ( path_on_host)
531
531
} )
532
532
. map_err ( VmmError :: FindDeviceError ) ??;
@@ -541,7 +541,7 @@ impl Vmm {
541
541
rl_ops : BucketUpdate ,
542
542
) -> Result < ( ) , VmmError > {
543
543
self . device_manager
544
- . try_with_virtio_device_with_id ( drive_id, |block : & mut Block | {
544
+ . with_virtio_device ( drive_id, |block : & mut Block | {
545
545
block. update_rate_limiter ( rl_bytes, rl_ops)
546
546
} )
547
547
. map_err ( VmmError :: FindDeviceError ) ??;
@@ -551,7 +551,7 @@ impl Vmm {
551
551
/// Updates the rate limiter parameters for block device with `drive_id` id.
552
552
pub fn update_vhost_user_block_config ( & mut self , drive_id : & str ) -> Result < ( ) , VmmError > {
553
553
self . device_manager
554
- . try_with_virtio_device_with_id ( drive_id, |block : & mut Block | block. update_config ( ) )
554
+ . with_virtio_device ( drive_id, |block : & mut Block | block. update_config ( ) )
555
555
. map_err ( VmmError :: FindDeviceError ) ??;
556
556
Ok ( ( ) )
557
557
}
@@ -566,7 +566,7 @@ impl Vmm {
566
566
tx_ops : BucketUpdate ,
567
567
) -> Result < ( ) , VmmError > {
568
568
self . device_manager
569
- . with_virtio_device_with_id ( net_id, |net : & mut Net | {
569
+ . with_virtio_device ( net_id, |net : & mut Net | {
570
570
net. patch_rate_limiters ( rx_bytes, rx_ops, tx_bytes, tx_ops)
571
571
} )
572
572
. map_err ( VmmError :: FindDeviceError )
@@ -575,23 +575,23 @@ impl Vmm {
575
575
/// Returns a reference to the balloon device if present.
576
576
pub fn balloon_config ( & self ) -> Result < BalloonConfig , VmmError > {
577
577
self . device_manager
578
- . with_virtio_device_with_id ( BALLOON_DEV_ID , |dev : & mut Balloon | dev. config ( ) )
578
+ . with_virtio_device ( BALLOON_DEV_ID , |dev : & mut Balloon | dev. config ( ) )
579
579
. map_err ( VmmError :: FindDeviceError )
580
580
}
581
581
582
582
/// Returns the latest balloon statistics if they are enabled.
583
583
pub fn latest_balloon_stats ( & self ) -> Result < BalloonStats , VmmError > {
584
584
let stats = self
585
585
. device_manager
586
- . try_with_virtio_device_with_id ( BALLOON_DEV_ID , |dev : & mut Balloon | dev. latest_stats ( ) )
586
+ . with_virtio_device ( BALLOON_DEV_ID , |dev : & mut Balloon | dev. latest_stats ( ) )
587
587
. map_err ( VmmError :: FindDeviceError ) ??;
588
588
Ok ( stats)
589
589
}
590
590
591
591
/// Updates configuration for the balloon device target size.
592
592
pub fn update_balloon_config ( & mut self , amount_mib : u32 ) -> Result < ( ) , VmmError > {
593
593
self . device_manager
594
- . try_with_virtio_device_with_id ( BALLOON_DEV_ID , |dev : & mut Balloon | {
594
+ . with_virtio_device ( BALLOON_DEV_ID , |dev : & mut Balloon | {
595
595
dev. update_size ( amount_mib)
596
596
} )
597
597
. map_err ( VmmError :: FindDeviceError ) ??;
@@ -604,7 +604,7 @@ impl Vmm {
604
604
stats_polling_interval_s : u16 ,
605
605
) -> Result < ( ) , VmmError > {
606
606
self . device_manager
607
- . try_with_virtio_device_with_id ( BALLOON_DEV_ID , |dev : & mut Balloon | {
607
+ . with_virtio_device ( BALLOON_DEV_ID , |dev : & mut Balloon | {
608
608
dev. update_stats_polling_interval ( stats_polling_interval_s)
609
609
} )
610
610
. map_err ( VmmError :: FindDeviceError ) ??;
0 commit comments