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 {
213213 self . balloon . set_device ( balloon) ;
214214
215215 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+ ) ) ;
217219 }
218220 }
219221
@@ -255,7 +257,10 @@ impl VmResources {
255257 }
256258
257259 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+ ) ) ;
259264 }
260265 self . machine_config = updated;
261266
@@ -312,7 +317,7 @@ impl VmResources {
312317 }
313318
314319 if self . machine_config . huge_pages != HugePageConfig :: None {
315- return Err ( BalloonConfigError :: HugePages ) ;
320+ return Err ( BalloonConfigError :: IncompatibleWith ( "huge pages" ) ) ;
316321 }
317322
318323 self . balloon . set ( config)
@@ -1394,7 +1399,7 @@ mod tests {
13941399 assert ! (
13951400 matches!(
13961401 err,
1397- ResourcesError :: BalloonDevice ( BalloonConfigError :: HugePages )
1402+ ResourcesError :: BalloonDevice ( BalloonConfigError :: IncompatibleWith ( "huge pages" ) )
13981403 ) ,
13991404 "{:?}" ,
14001405 err
Original file line number Diff line number Diff line change @@ -28,8 +28,8 @@ pub enum BalloonConfigError {
2828 CreateFailure ( crate :: devices:: virtio:: balloon:: BalloonError ) ,
2929 /// Error updating the balloon device configuration: {0}
3030 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 ) ,
3333}
3434
3535/// 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 {
2727 /// Enabling simultaneous multithreading is not supported on aarch64.
2828 #[ cfg( target_arch = "aarch64" ) ]
2929 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 )
3432}
3533
3634/// 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):
255255 uvm_plain .basic_config (huge_pages = HugePagesConfig .HUGETLBFS_2MB )
256256 with pytest .raises (
257257 RuntimeError ,
258- match = "Firecracker's huge pages support is incompatible with memory ballooning ." ,
258+ match = "Memory ballooning is incompatible with huge pages ." ,
259259 ):
260260 uvm_plain .api .balloon .put (amount_mib = 0 , deflate_on_oom = False )
261261
@@ -264,6 +264,6 @@ def test_negative_huge_pages_plus_balloon(uvm_plain):
264264 uvm_plain .api .balloon .put (amount_mib = 0 , deflate_on_oom = False )
265265 with pytest .raises (
266266 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 ." ,
268268 ):
269269 uvm_plain .basic_config (huge_pages = HugePagesConfig .HUGETLBFS_2MB )
You can’t perform that action at this time.
0 commit comments