@@ -501,7 +501,6 @@ mod tests {
501
501
use std:: str:: FromStr ;
502
502
503
503
use serde_json:: { Map , Value } ;
504
- use utils:: kernel_version:: KernelVersion ;
505
504
use utils:: net:: mac:: MacAddr ;
506
505
use utils:: tempfile:: TempFile ;
507
506
@@ -1409,14 +1408,12 @@ mod tests {
1409
1408
VmConfigError :: InvalidMemorySize
1410
1409
) ;
1411
1410
1412
- if KernelVersion :: get ( ) . unwrap ( ) >= KernelVersion :: new ( 5 , 10 , 0 ) {
1413
- // mem_size_mib compatible with huge page configuration
1414
- aux_vm_config. mem_size_mib = Some ( 2048 ) ;
1415
- // Remove the balloon device config that's added by `default_vm_resources` as it would
1416
- // trigger the "ballooning incompatible with huge pages" check.
1417
- vm_resources. balloon = BalloonBuilder :: new ( ) ;
1418
- vm_resources. update_vm_config ( & aux_vm_config) . unwrap ( ) ;
1419
- }
1411
+ // mem_size_mib compatible with huge page configuration
1412
+ aux_vm_config. mem_size_mib = Some ( 2048 ) ;
1413
+ // Remove the balloon device config that's added by `default_vm_resources` as it would
1414
+ // trigger the "ballooning incompatible with huge pages" check.
1415
+ vm_resources. balloon = BalloonBuilder :: new ( ) ;
1416
+ vm_resources. update_vm_config ( & aux_vm_config) . unwrap ( ) ;
1420
1417
}
1421
1418
1422
1419
#[ test]
@@ -1454,29 +1451,27 @@ mod tests {
1454
1451
1455
1452
#[ test]
1456
1453
fn test_negative_restore_balloon_device_with_huge_pages ( ) {
1457
- if KernelVersion :: get ( ) . unwrap ( ) >= KernelVersion :: new ( 4 , 16 , 0 ) {
1458
- let mut vm_resources = default_vm_resources ( ) ;
1459
- vm_resources. balloon = BalloonBuilder :: new ( ) ;
1460
- vm_resources
1461
- . update_vm_config ( & MachineConfigUpdate {
1462
- huge_pages : Some ( HugePageConfig :: Hugetlbfs2M ) ,
1463
- ..Default :: default ( )
1464
- } )
1465
- . unwrap ( ) ;
1466
- let err = vm_resources
1467
- . update_from_restored_device ( SharedDeviceType :: Balloon ( Arc :: new ( Mutex :: new (
1468
- Balloon :: new ( 128 , false , 0 , true ) . unwrap ( ) ,
1469
- ) ) ) )
1470
- . unwrap_err ( ) ;
1471
- assert ! (
1472
- matches!(
1473
- err,
1474
- ResourcesError :: BalloonDevice ( BalloonConfigError :: HugePages )
1475
- ) ,
1476
- "{:?}" ,
1477
- err
1478
- ) ;
1479
- }
1454
+ let mut vm_resources = default_vm_resources ( ) ;
1455
+ vm_resources. balloon = BalloonBuilder :: new ( ) ;
1456
+ vm_resources
1457
+ . update_vm_config ( & MachineConfigUpdate {
1458
+ huge_pages : Some ( HugePageConfig :: Hugetlbfs2M ) ,
1459
+ ..Default :: default ( )
1460
+ } )
1461
+ . unwrap ( ) ;
1462
+ let err = vm_resources
1463
+ . update_from_restored_device ( SharedDeviceType :: Balloon ( Arc :: new ( Mutex :: new (
1464
+ Balloon :: new ( 128 , false , 0 , true ) . unwrap ( ) ,
1465
+ ) ) ) )
1466
+ . unwrap_err ( ) ;
1467
+ assert ! (
1468
+ matches!(
1469
+ err,
1470
+ ResourcesError :: BalloonDevice ( BalloonConfigError :: HugePages )
1471
+ ) ,
1472
+ "{:?}" ,
1473
+ err
1474
+ ) ;
1480
1475
}
1481
1476
1482
1477
#[ test]
0 commit comments