@@ -1221,7 +1221,7 @@ impl Vmm {
12211221 fn handle_start_instance ( & mut self , sender : SyncOutcomeSender ) {
12221222 START_INSTANCE_REQUEST_TS . store ( time:: precise_time_ns ( ) as usize , Ordering :: Release ) ;
12231223
1224- if self . is_instance_running ( ) {
1224+ if self . is_instance_initialized ( ) {
12251225 sender
12261226 . send ( Box :: new ( SyncError :: MicroVMAlreadyRunning ) )
12271227 . map_err ( |_| ( ) )
@@ -1241,7 +1241,7 @@ impl Vmm {
12411241 } ;
12421242 }
12431243
1244- fn is_instance_running ( & self ) -> bool {
1244+ fn is_instance_initialized ( & self ) -> bool {
12451245 let instance_state = {
12461246 // Use unwrap() to crash if the other thread poisoned this lock.
12471247 let shared_info = self . shared_info . read ( ) . unwrap ( ) ;
@@ -1258,7 +1258,7 @@ impl Vmm {
12581258 block_device_config : BlockDeviceConfig ,
12591259 sender : SyncOutcomeSender ,
12601260 ) {
1261- if self . is_instance_running ( ) {
1261+ if self . is_instance_initialized ( ) {
12621262 sender
12631263 . send ( Box :: new ( SyncError :: UpdateNotAllowedPostBoot ) )
12641264 . map_err ( |_| ( ) )
@@ -1294,7 +1294,7 @@ impl Vmm {
12941294 }
12951295
12961296 fn handle_patch_drive ( & mut self , fields : Value , sender : SyncOutcomeSender ) {
1297- if self . is_instance_running ( ) {
1297+ if self . is_instance_initialized ( ) {
12981298 match self . check_patch_payload_post_boot ( & fields) {
12991299 Ok ( ( ) ) => ( ) ,
13001300 Err ( e) => {
@@ -1324,7 +1324,7 @@ impl Vmm {
13241324 logger_description : APILoggerDescription ,
13251325 sender : SyncOutcomeSender ,
13261326 ) {
1327- if self . is_instance_running ( ) {
1327+ if self . is_instance_initialized ( ) {
13281328 sender
13291329 . send ( Box :: new ( SyncError :: UpdateNotAllowedPostBoot ) )
13301330 . map_err ( |_| ( ) )
@@ -1349,7 +1349,7 @@ impl Vmm {
13491349 boot_source_body : BootSourceBody ,
13501350 sender : SyncOutcomeSender ,
13511351 ) {
1352- if self . is_instance_running ( ) {
1352+ if self . is_instance_initialized ( ) {
13531353 sender
13541354 . send ( Box :: new ( SyncError :: UpdateNotAllowedPostBoot ) )
13551355 . map_err ( |_| ( ) )
@@ -1407,7 +1407,7 @@ impl Vmm {
14071407 machine_config_body : MachineConfiguration ,
14081408 sender : SyncOutcomeSender ,
14091409 ) {
1410- if self . is_instance_running ( ) {
1410+ if self . is_instance_initialized ( ) {
14111411 sender
14121412 . send ( Box :: new ( SyncError :: UpdateNotAllowedPostBoot ) )
14131413 . map_err ( |_| ( ) )
@@ -1431,7 +1431,7 @@ impl Vmm {
14311431 netif_body : NetworkInterfaceBody ,
14321432 sender : SyncOutcomeSender ,
14331433 ) {
1434- if self . is_instance_running ( ) {
1434+ if self . is_instance_initialized ( ) {
14351435 sender
14361436 . send ( Box :: new ( SyncError :: UpdateNotAllowedPostBoot ) )
14371437 . map_err ( |_| ( ) )
@@ -1446,7 +1446,7 @@ impl Vmm {
14461446 }
14471447
14481448 fn handle_rescan_block_device ( & mut self , req_body : ActionBody , sender : SyncOutcomeSender ) {
1449- if !self . is_instance_running ( ) {
1449+ if !self . is_instance_initialized ( ) {
14501450 sender
14511451 . send ( Box :: new ( SyncError :: OperationNotAllowedPreBoot ) )
14521452 . map_err ( |_| ( ) )
@@ -2010,21 +2010,21 @@ mod tests {
20102010 }
20112011
20122012 #[ test]
2013- fn test_is_instance_running ( ) {
2013+ fn test_is_instance_initialized ( ) {
20142014 let vmm = create_vmm_object ( InstanceState :: Uninitialized ) ;
2015- assert_eq ! ( vmm. is_instance_running ( ) , false ) ;
2015+ assert_eq ! ( vmm. is_instance_initialized ( ) , false ) ;
20162016
20172017 let vmm = create_vmm_object ( InstanceState :: Starting ) ;
2018- assert_eq ! ( vmm. is_instance_running ( ) , true ) ;
2018+ assert_eq ! ( vmm. is_instance_initialized ( ) , true ) ;
20192019
20202020 let vmm = create_vmm_object ( InstanceState :: Halting ) ;
2021- assert_eq ! ( vmm. is_instance_running ( ) , true ) ;
2021+ assert_eq ! ( vmm. is_instance_initialized ( ) , true ) ;
20222022
20232023 let vmm = create_vmm_object ( InstanceState :: Halted ) ;
2024- assert_eq ! ( vmm. is_instance_running ( ) , true ) ;
2024+ assert_eq ! ( vmm. is_instance_initialized ( ) , true ) ;
20252025
20262026 let vmm = create_vmm_object ( InstanceState :: Running ) ;
2027- assert_eq ! ( vmm. is_instance_running ( ) , true ) ;
2027+ assert_eq ! ( vmm. is_instance_initialized ( ) , true ) ;
20282028 }
20292029
20302030 #[ test]
0 commit comments