File tree Expand file tree Collapse file tree 4 files changed +15
-12
lines changed
tests/integration_tests/performance Expand file tree Collapse file tree 4 files changed +15
-12
lines changed Original file line number Diff line number Diff line change @@ -213,7 +213,9 @@ impl VmResources {
213
213
self . balloon . set_device ( balloon) ;
214
214
215
215
if self . machine_config . huge_pages != HugePageConfig :: None {
216
- return Err ( ResourcesError :: BalloonDevice ( BalloonConfigError :: HugePages ) ) ;
216
+ return Err ( ResourcesError :: BalloonDevice (
217
+ BalloonConfigError :: IncompatibleWith ( "huge pages" ) ,
218
+ ) ) ;
217
219
}
218
220
}
219
221
@@ -255,7 +257,10 @@ impl VmResources {
255
257
}
256
258
257
259
if self . balloon . get ( ) . is_some ( ) && updated. huge_pages != HugePageConfig :: None {
258
- return Err ( MachineConfigError :: BalloonAndHugePages ) ;
260
+ return Err ( MachineConfigError :: Incompatible (
261
+ "balloon device" ,
262
+ "huge pages" ,
263
+ ) ) ;
259
264
}
260
265
self . machine_config = updated;
261
266
@@ -312,7 +317,7 @@ impl VmResources {
312
317
}
313
318
314
319
if self . machine_config . huge_pages != HugePageConfig :: None {
315
- return Err ( BalloonConfigError :: HugePages ) ;
320
+ return Err ( BalloonConfigError :: IncompatibleWith ( "huge pages" ) ) ;
316
321
}
317
322
318
323
self . balloon . set ( config)
@@ -1394,7 +1399,7 @@ mod tests {
1394
1399
assert ! (
1395
1400
matches!(
1396
1401
err,
1397
- ResourcesError :: BalloonDevice ( BalloonConfigError :: HugePages )
1402
+ ResourcesError :: BalloonDevice ( BalloonConfigError :: IncompatibleWith ( "huge pages" ) )
1398
1403
) ,
1399
1404
"{:?}" ,
1400
1405
err
Original file line number Diff line number Diff line change @@ -28,8 +28,8 @@ pub enum BalloonConfigError {
28
28
CreateFailure ( crate :: devices:: virtio:: balloon:: BalloonError ) ,
29
29
/// Error updating the balloon device configuration: {0}
30
30
UpdateFailure ( std:: io:: Error ) ,
31
- /// Firecracker's huge pages support is incompatible with memory ballooning .
32
- HugePages ,
31
+ /// Memory ballooning is incompatible with {0} .
32
+ IncompatibleWith ( & ' static str ) ,
33
33
}
34
34
35
35
/// This struct represents the strongly typed equivalent of the json body
Original file line number Diff line number Diff line change @@ -27,10 +27,8 @@ pub enum MachineConfigError {
27
27
/// Enabling simultaneous multithreading is not supported on aarch64.
28
28
#[ cfg( target_arch = "aarch64" ) ]
29
29
SmtNotSupported ,
30
- /// Could not determine host kernel version when checking hugetlbfs compatibility
31
- KernelVersion ,
32
- /// Firecracker's huge pages support is incompatible with memory ballooning.
33
- BalloonAndHugePages ,
30
+ /// '{0}' and '{1}' are mutually exclusive and cannot be used together.
31
+ Incompatible ( & ' static str , & ' static str )
34
32
}
35
33
36
34
/// Describes the possible (huge)page configurations for a microVM's memory.
Original file line number Diff line number Diff line change @@ -255,7 +255,7 @@ def test_negative_huge_pages_plus_balloon(uvm_plain):
255
255
uvm_plain .basic_config (huge_pages = HugePagesConfig .HUGETLBFS_2MB )
256
256
with pytest .raises (
257
257
RuntimeError ,
258
- match = "Firecracker's huge pages support is incompatible with memory ballooning ." ,
258
+ match = "Memory ballooning is incompatible with huge pages ." ,
259
259
):
260
260
uvm_plain .api .balloon .put (amount_mib = 0 , deflate_on_oom = False )
261
261
@@ -264,6 +264,6 @@ def test_negative_huge_pages_plus_balloon(uvm_plain):
264
264
uvm_plain .api .balloon .put (amount_mib = 0 , deflate_on_oom = False )
265
265
with pytest .raises (
266
266
RuntimeError ,
267
- match = "Machine config error: Firecracker's huge pages support is incompatible with memory ballooning ." ,
267
+ match = "Machine config error: 'balloon device' and ' huge pages' are mutually exclusive and cannot be used together ." ,
268
268
):
269
269
uvm_plain .basic_config (huge_pages = HugePagesConfig .HUGETLBFS_2MB )
You can’t perform that action at this time.
0 commit comments