diff options
author | wu.zhihui <wu.zhihui1@zte.com.cn> | 2016-09-09 15:55:01 +0800 |
---|---|---|
committer | zhihui wu <wu.zhihui1@zte.com.cn> | 2016-09-13 02:44:25 +0000 |
commit | 72248b41f0f26b0daaacb5a61623f2f7f0f4a9b5 (patch) | |
tree | 9014a7999393a62b5d2220662b64fa906d219c5b | |
parent | 5bd3673cb88408f13b7d84d4c09462cb15816476 (diff) |
update node_reset() in zte_adapter.py
Change-Id: I71790b8abb25936045f777a78ed903f3b8ce4303
Signed-off-by: wu.zhihui <wu.zhihui1@zte.com.cn>
(cherry picked from commit 161dd445f06aa9a5dfcd273d89a00d1f02260ba3)
-rw-r--r-- | deploy/dha_adapters/zte_adapter.py | 28 |
1 files changed, 5 insertions, 23 deletions
diff --git a/deploy/dha_adapters/zte_adapter.py b/deploy/dha_adapters/zte_adapter.py index a40a02685..da651ca15 100644 --- a/deploy/dha_adapters/zte_adapter.py +++ b/deploy/dha_adapters/zte_adapter.py @@ -1,5 +1,5 @@ ############################################################################### -# Copyright (c) 2015 Ericsson AB and others. +# Copyright (c) 2016 Ericsson AB, ZTE and others. # szilard.cserey@ericsson.com # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 @@ -24,27 +24,9 @@ class ZteAdapter(IpmiAdapter): super(ZteAdapter, self).__init__(yaml_path, attempts) def node_reset(self, node_id): - WAIT_LOOP = 600 log('RESET Node %s' % node_id) - cmd_prefix = self.ipmi_cmd(node_id) - state = exec_cmd('%s chassis power status' % cmd_prefix, mask_args=[8,10]) - if state == 'Chassis Power is on': - was_shut_off = False - done = False - exec_cmd('%s chassis power cycle' % cmd_prefix, mask_args=[8,10]) - for i in range(WAIT_LOOP): - state, _ = exec_cmd('%s chassis power status' % cmd_prefix, - check=False, - mask_args=[8,10]) - if state == 'Chassis Power is off': - was_shut_off = True - elif state == 'Chassis Power is on' and was_shut_off: - done = True - break - time.sleep(1) - if not done: - err('Could Not RESET Node %s' % node_id) - else: - err('Cannot RESET Node %s because it\'s not Active, state: %s' - % (node_id, state)) + cmd = '%s chassis power cycle' % self.ipmi_cmd(node_id) + exec_cmd(cmd, attempts=self.attempts, delay=self.delay, + verbose=True, + mask_args=[8,10]) |