@@ -315,16 +315,6 @@ impl VmResources {
315315 mmds_config
316316 }
317317
318- /// Gets a reference to the boot source configuration.
319- pub fn boot_source_config ( & self ) -> & BootSourceConfig {
320- & self . boot_source . config
321- }
322-
323- /// Gets a reference to the boot source builder.
324- pub fn boot_source_builder ( & self ) -> Option < & BootConfig > {
325- self . boot_source . builder . as_ref ( )
326- }
327-
328318 /// Sets a balloon device to be attached when the VM starts.
329319 pub fn set_balloon_device (
330320 & mut self ,
@@ -354,14 +344,12 @@ impl VmResources {
354344 return Err ( BootSourceConfigError :: HugePagesAndInitRd ) ;
355345 }
356346
357- self . set_boot_source_config ( boot_source_cfg ) ;
358- self . boot_source . builder = Some ( BootConfig :: new ( self . boot_source_config ( ) ) ? ) ;
359- Ok ( ( ) )
360- }
347+ self . boot_source = BootSource {
348+ builder : Some ( BootConfig :: new ( & boot_source_cfg ) ? ) ,
349+ config : boot_source_cfg ,
350+ } ;
361351
362- /// Set the boot source configuration (contains raw kernel config details).
363- pub fn set_boot_source_config ( & mut self , boot_source_cfg : BootSourceConfig ) {
364- self . boot_source . config = boot_source_cfg;
352+ Ok ( ( ) )
365353 }
366354
367355 /// Inserts a block to be attached when the VM starts.
@@ -512,7 +500,7 @@ impl From<&VmResources> for VmmConfig {
512500 VmmConfig {
513501 balloon_device : resources. balloon . get_config ( ) . ok ( ) ,
514502 block_devices : resources. block . configs ( ) ,
515- boot_source : resources. boot_source_config ( ) . clone ( ) ,
503+ boot_source : resources. boot_source . config . clone ( ) ,
516504 cpu_config : None ,
517505 logger : None ,
518506 machine_config : Some ( MachineConfig :: from ( & resources. vm_config ) ) ,
@@ -1521,15 +1509,6 @@ mod tests {
15211509 assert_eq ! ( actual_entropy_cfg, entropy_device_cfg) ;
15221510 }
15231511
1524- #[ test]
1525- fn test_boot_config ( ) {
1526- let vm_resources = default_vm_resources ( ) ;
1527- let expected_boot_cfg = vm_resources. boot_source . builder . as_ref ( ) . unwrap ( ) ;
1528- let actual_boot_cfg = vm_resources. boot_source_builder ( ) . unwrap ( ) ;
1529-
1530- assert ! ( actual_boot_cfg == expected_boot_cfg) ;
1531- }
1532-
15331512 #[ test]
15341513 fn test_set_boot_source ( ) {
15351514 let tmp_file = TempFile :: new ( ) . unwrap ( ) ;
@@ -1541,7 +1520,7 @@ mod tests {
15411520 } ;
15421521
15431522 let mut vm_resources = default_vm_resources ( ) ;
1544- let boot_builder = vm_resources. boot_source_builder ( ) . unwrap ( ) ;
1523+ let boot_builder = vm_resources. boot_source . builder . as_ref ( ) . unwrap ( ) ;
15451524 let tmp_ino = tmp_file. as_file ( ) . metadata ( ) . unwrap ( ) . st_ino ( ) ;
15461525
15471526 assert_ne ! (
@@ -1568,7 +1547,7 @@ mod tests {
15681547 ) ;
15691548
15701549 vm_resources. build_boot_source ( expected_boot_cfg) . unwrap ( ) ;
1571- let boot_source_builder = vm_resources. boot_source_builder ( ) . unwrap ( ) ;
1550+ let boot_source_builder = vm_resources. boot_source . builder . unwrap ( ) ;
15721551 assert_eq ! (
15731552 boot_source_builder
15741553 . cmdline
0 commit comments