File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed
Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -3882,9 +3882,15 @@ def _show_progress(progress):
38823882 compute_client .evacuate_server (server , ** kwargs )
38833883
38843884 if parsed_args .wait :
3885+ orig_status = server .status
3886+ success = ['ACTIVE' ]
3887+ if orig_status == 'SHUTOFF' :
3888+ success .append ('SHUTOFF' )
3889+
38853890 if utils .wait_for_status (
38863891 compute_client .get_server ,
38873892 server .id ,
3893+ success_status = success ,
38883894 callback = _show_progress ,
38893895 ):
38903896 self .app .stdout .write (_ ('Complete\n ' ))
Original file line number Diff line number Diff line change @@ -7039,6 +7039,7 @@ def setUp(self):
70397039 'image' : self .image ,
70407040 'networks' : {},
70417041 'adminPass' : 'passw0rd' ,
7042+ 'status' : 'ACTIVE' ,
70427043 }
70437044 self .server = compute_fakes .create_one_server (attrs = attrs )
70447045 attrs ['id' ] = self .server .id
@@ -7176,6 +7177,33 @@ def test_evacuate_with_wait_ok(self, mock_wait_for_status):
71767177 mock_wait_for_status .assert_called_once_with (
71777178 self .compute_client .get_server ,
71787179 self .server .id ,
7180+ success_status = ['ACTIVE' ],
7181+ callback = mock .ANY ,
7182+ )
7183+
7184+ @mock .patch .object (common_utils , 'wait_for_status' , return_value = True )
7185+ def test_evacuate_with_wait_ok_shutoff (self , mock_wait_for_status ):
7186+ self .server .status = 'SHUTOFF'
7187+ self .compute_client .get_server .return_value = self .server
7188+
7189+ args = [
7190+ self .server .id ,
7191+ '--wait' ,
7192+ ]
7193+ verify_args = [
7194+ ('server' , self .server .id ),
7195+ ('wait' , True ),
7196+ ]
7197+ evac_args = {
7198+ 'host' : None ,
7199+ 'on_shared_storage' : False ,
7200+ 'admin_pass' : None ,
7201+ }
7202+ self ._test_evacuate (args , verify_args , evac_args )
7203+ mock_wait_for_status .assert_called_once_with (
7204+ self .compute_client .get_server ,
7205+ self .server .id ,
7206+ success_status = ['ACTIVE' , 'SHUTOFF' ],
71797207 callback = mock .ANY ,
71807208 )
71817209
You can’t perform that action at this time.
0 commit comments