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 @@ -227,7 +227,9 @@ impl VmResources {
227
227
self . balloon . set_device ( balloon) ;
228
228
229
229
if self . machine_config . huge_pages != HugePageConfig :: None {
230
- return Err ( ResourcesError :: BalloonDevice ( BalloonConfigError :: HugePages ) ) ;
230
+ return Err ( ResourcesError :: BalloonDevice (
231
+ BalloonConfigError :: IncompatibleWith ( "huge pages" ) ,
232
+ ) ) ;
231
233
}
232
234
}
233
235
@@ -269,7 +271,10 @@ impl VmResources {
269
271
}
270
272
271
273
if self . balloon . get ( ) . is_some ( ) && updated. huge_pages != HugePageConfig :: None {
272
- return Err ( MachineConfigError :: BalloonAndHugePages ) ;
274
+ return Err ( MachineConfigError :: Incompatible (
275
+ "balloon device" ,
276
+ "huge pages" ,
277
+ ) ) ;
273
278
}
274
279
self . machine_config = updated;
275
280
@@ -326,7 +331,7 @@ impl VmResources {
326
331
}
327
332
328
333
if self . machine_config . huge_pages != HugePageConfig :: None {
329
- return Err ( BalloonConfigError :: HugePages ) ;
334
+ return Err ( BalloonConfigError :: IncompatibleWith ( "huge pages" ) ) ;
330
335
}
331
336
332
337
self . balloon . set ( config)
@@ -1446,7 +1451,7 @@ mod tests {
1446
1451
assert ! (
1447
1452
matches!(
1448
1453
err,
1449
- ResourcesError :: BalloonDevice ( BalloonConfigError :: HugePages )
1454
+ ResourcesError :: BalloonDevice ( BalloonConfigError :: IncompatibleWith ( "huge pages" ) )
1450
1455
) ,
1451
1456
"{:?}" ,
1452
1457
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