mirror of
				https://github.com/xcat2/xcat-core.git
				synced 2025-10-31 19:32:31 +00:00 
			
		
		
		
	Merge pull request #5569 from xuweibj/reset
retry in rpower reset when get 'Connection aborted' [ DO NOT MERGE ]
This commit is contained in:
		| @@ -109,12 +109,15 @@ class OpenBMCPowerTask(ParallelNodesCommand): | ||||
|                     off_flag = False | ||||
|                     start_timeStamp = int(time.time()) | ||||
|                     for i in range (0, 30): | ||||
|                         states = obmc.list_power_states() | ||||
|                         status = obmc.get_host_state(states) | ||||
|                         if openbmc.RPOWER_STATES.get(status) == 'off': | ||||
|                             off_flag = True | ||||
|                             break | ||||
|                         gevent.sleep( 2 ) | ||||
|                         try: | ||||
|                             states = obmc.list_power_states() | ||||
|                             status = obmc.get_host_state(states) | ||||
|                             if openbmc.RPOWER_STATES.get(status) == 'off': | ||||
|                                 off_flag = True | ||||
|                                 break | ||||
|                         except SelfServerException as e: | ||||
|                             continue | ||||
|  | ||||
|                     end_timeStamp = int(time.time()) | ||||
|  | ||||
| @@ -123,10 +126,18 @@ class OpenBMCPowerTask(ParallelNodesCommand): | ||||
|                                  'to off after waiting %s seconds. (State= %s).' % (end_timeStamp - start_timeStamp, status) | ||||
|                         raise SelfServerException(error) | ||||
|  | ||||
|                 ret = obmc.set_power_state('on') | ||||
|                 self.callback.update_node_attributes('status', node, POWER_STATE_DB['on']) | ||||
|                 for i in range(0, 2): | ||||
|                     try: | ||||
|                         ret = obmc.set_power_state('on') | ||||
|                         self.callback.update_node_attributes('status', node, POWER_STATE_DB['on']) | ||||
|                         self.callback.info('%s: %s'  % (node, 'reset')) | ||||
|                         return | ||||
|                     except SelfServerException as e: | ||||
|                         self.callback.syslog('%s: %s' % (node, e.message)) | ||||
|                         gevent.sleep( 1 ) | ||||
|                         continue | ||||
|  | ||||
|                 self.callback.info('%s: %s'  % (node, 'reset')) | ||||
|                 self.callback.error(e.message, node) | ||||
|  | ||||
|         except (SelfServerException, SelfClientException) as e: | ||||
|             self.callback.error(e.message, node) | ||||
|   | ||||
| @@ -345,7 +345,7 @@ class OpenBMCRest(object): | ||||
|                 e.message = "Login to BMC failed: Can't connect to {0} {1}.".format(e.host_and_port, e.detail_msg) | ||||
|             else: | ||||
|                 e.message = 'BMC did not respond. ' \ | ||||
|                             'Validate BMC configuration and retry the command.' | ||||
|                             'Validate BMC configuration and retry the command. ' + e.detail_msg | ||||
|             self._print_error_log(e.message, cmd) | ||||
|             raise | ||||
|         except ValueError: | ||||
|   | ||||
		Reference in New Issue
	
	Block a user