aboutsummaryrefslogtreecommitdiffstats
path: root/deploy
diff options
context:
space:
mode:
Diffstat (limited to 'deploy')
-rw-r--r--deploy/dha.py3
-rw-r--r--deploy/dha_adapters/zte_adapter.py49
-rw-r--r--deploy/execution_environment.py2
3 files changed, 53 insertions, 1 deletions
diff --git a/deploy/dha.py b/deploy/dha.py
index cb413cbb0..3f09da40a 100644
--- a/deploy/dha.py
+++ b/deploy/dha.py
@@ -15,6 +15,7 @@ from dha_adapters.libvirt_adapter import LibvirtAdapter
from dha_adapters.ipmi_adapter import IpmiAdapter
from dha_adapters.hp_adapter import HpAdapter
from dha_adapters.amt_adapter import AmtAdapter
+from dha_adapters.zte_adapter import ZteAdapter
class DeploymentHardwareAdapter(object):
@@ -32,4 +33,6 @@ class DeploymentHardwareAdapter(object):
return HpAdapter(yaml_path)
if type == 'amt':
return AmtAdapter(yaml_path)
+ if type == 'zte':
+ return ZteAdapter(yaml_path)
return super(DeploymentHardwareAdapter, cls).__new__(cls)
diff --git a/deploy/dha_adapters/zte_adapter.py b/deploy/dha_adapters/zte_adapter.py
new file mode 100644
index 000000000..f6279fbf0
--- /dev/null
+++ b/deploy/dha_adapters/zte_adapter.py
@@ -0,0 +1,49 @@
+###############################################################################
+# Copyright (c) 2015 Ericsson AB 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
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+###############################################################################
+
+
+import time
+from ipmi_adapter import IpmiAdapter
+
+from common import (
+ log,
+ exec_cmd,
+ err,
+)
+
+
+class ZteAdapter(IpmiAdapter):
+
+ def __init__(self, yaml_path):
+ super(ZteAdapter, self).__init__(yaml_path)
+
+ 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)
+ if state == 'Chassis Power is on':
+ was_shut_off = False
+ done = False
+ exec_cmd('%s chassis power cycle' % cmd_prefix)
+ for i in range(WAIT_LOOP):
+ state, _ = exec_cmd('%s chassis power status' % cmd_prefix,
+ False)
+ 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))
+
diff --git a/deploy/execution_environment.py b/deploy/execution_environment.py
index b2d268253..b8e861c4a 100644
--- a/deploy/execution_environment.py
+++ b/deploy/execution_environment.py
@@ -31,7 +31,7 @@ class ExecutionEnvironment(object):
if type == 'libvirt':
return LibvirtEnvironment(storage_dir, dha_path, dea, root_dir)
- if type in ['ipmi', 'hp', 'amt']:
+ if type in ['ipmi', 'hp', 'amt', 'zte']:
return VirtualFuel(storage_dir, pxe_bridge, dha_path, root_dir)
return super(ExecutionEnvironment, cls).__new__(cls)