summaryrefslogtreecommitdiffstats
path: root/modules/opnfv/deployment/fuel
diff options
context:
space:
mode:
authorjose.lausuch <jose.lausuch@ericsson.com>2017-02-10 17:10:18 +0100
committerjose.lausuch <jose.lausuch@ericsson.com>2017-02-14 21:06:22 +0100
commit6b3e7cdec66603ab1596ec02b137a854bf758bd3 (patch)
treef6c05414a580ad1d9e7d53a5436ef6a4fabe080c /modules/opnfv/deployment/fuel
parent9f93b28a66f8782b74252c242481248bd46f816e (diff)
[deployment handler] Add Roles and Status classes
By doing this, we can handle roles and status as a list in the node object. Output: http://pastebin.com/raw/PAMrWRJi Change-Id: I0e3c7f375b19548a7e424e3257b84424c8fe4725 Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
Diffstat (limited to 'modules/opnfv/deployment/fuel')
-rw-r--r--modules/opnfv/deployment/fuel/adapter.py24
1 files changed, 17 insertions, 7 deletions
diff --git a/modules/opnfv/deployment/fuel/adapter.py b/modules/opnfv/deployment/fuel/adapter.py
index 3e6ef50a0..9e22ba891 100644
--- a/modules/opnfv/deployment/fuel/adapter.py
+++ b/modules/opnfv/deployment/fuel/adapter.py
@@ -124,26 +124,36 @@ class FuelAdapter(manager.DeploymentHandler):
fields = lines[i].rsplit(' | ')
id = fields[index_id].strip().encode()
ip = fields[index_ip].strip().encode()
- status_node = fields[index_status].strip().encode()
+ status_node = fields[index_status].strip().encode().lower()
name = fields[index_name].strip().encode()
- roles = fields[index_roles].strip().encode()
+ roles_all = fields[index_roles].strip().encode().lower()
+
+ roles = [x for x in [manager.Role.CONTROLLER,
+ manager.Role.COMPUTE,
+ manager.Role.ODL] if x in roles_all]
dict = {"cluster": fields[index_cluster].strip().encode(),
"mac": fields[index_mac].strip().encode(),
"status_node": status_node,
"online": fields[index_online].strip().encode()}
+ ssh_client = None
if status_node == 'ready':
- status = manager.Node.STATUS_OK
+ status = manager.NodeStatus.STATUS_OK
proxy = {'ip': self.installer_ip,
'username': self.installer_user,
'password': self.installer_pwd}
ssh_client = ssh_utils.get_ssh_client(hostname=ip,
username='root',
proxy=proxy)
+ elif 'error' in status_node:
+ status = manager.NodeStatus.STATUS_ERROR
+ elif 'off' in status_node:
+ status = manager.NodeStatus.STATUS_OFFLINE
+ elif 'discover' in status_node:
+ status = manager.NodeStatus.STATUS_UNUSED
else:
- status = manager.Node.STATUS_INACTIVE
- ssh_client = None
+ status = manager.NodeStatus.STATUS_INACTIVE
node = manager.Node(
id, ip, name, status, roles, ssh_client, dict)
@@ -160,7 +170,7 @@ class FuelAdapter(manager.DeploymentHandler):
cmd = 'source openrc;nova-manage version 2>/dev/null'
version = None
for node in self.nodes:
- if 'controller' in node.get_attribute('roles'):
+ if node.is_controller():
version = node.run_cmd(cmd)
break
return version
@@ -169,7 +179,7 @@ class FuelAdapter(manager.DeploymentHandler):
cmd = "apt-cache show opendaylight|grep Version|sed 's/^.*\: //'"
version = None
for node in self.nodes:
- if 'controller' in node.get_attribute('roles'):
+ if node.is_controller():
odl_version = node.run_cmd(cmd)
if odl_version:
version = 'OpenDaylight ' + odl_version