summaryrefslogtreecommitdiffstats
path: root/modules/opnfv
diff options
context:
space:
mode:
Diffstat (limited to 'modules/opnfv')
-rw-r--r--modules/opnfv/deployment/fuel/adapter.py18
-rw-r--r--modules/opnfv/deployment/manager.py46
-rw-r--r--modules/opnfv/utils/ovs_logger.py16
3 files changed, 52 insertions, 28 deletions
diff --git a/modules/opnfv/deployment/fuel/adapter.py b/modules/opnfv/deployment/fuel/adapter.py
index 4ba9ca961..a71d6cbf9 100644
--- a/modules/opnfv/deployment/fuel/adapter.py
+++ b/modules/opnfv/deployment/fuel/adapter.py
@@ -170,26 +170,30 @@ class FuelAdapter(manager.DeploymentHandler):
cmd = 'source openrc;nova-manage version 2>/dev/null'
version = None
for node in self.nodes:
- if node.is_controller():
+ if node.is_controller() and node.is_active():
version = node.run_cmd(cmd)
break
return version
def get_sdn_version(self):
- cmd = "apt-cache show opendaylight|grep Version|sed 's/^.*\: //'"
+ cmd = "apt-cache show opendaylight|grep Version"
version = None
for node in self.nodes:
- if node.is_controller():
+ if manager.Role.ODL in node.roles and node.is_active():
odl_version = node.run_cmd(cmd)
if odl_version:
- version = 'OpenDaylight ' + odl_version
- break
+ version = 'OpenDaylight ' + odl_version.split(' ')[-1]
+ break
return version
def get_deployment_status(self):
- cmd = 'fuel env|grep operational'
+ cmd = "fuel env|tail -1|awk '{print $3}'"
result = self.installer_node.run_cmd(cmd)
if result is None or len(result) == 0:
- return 'failed'
+ return 'unknown'
+ elif 'operational' in result:
+ return 'active'
+ elif 'deploy' in result:
+ return 'deploying'
else:
return 'active'
diff --git a/modules/opnfv/deployment/manager.py b/modules/opnfv/deployment/manager.py
index e1fd9497f..7047a4dd3 100644
--- a/modules/opnfv/deployment/manager.py
+++ b/modules/opnfv/deployment/manager.py
@@ -174,13 +174,15 @@ class Node(object):
Run command remotely on a node
'''
if self.status is not NodeStatus.STATUS_OK:
- logger.error("The node %s is not active" % self.ip)
+ logger.error(
+ "Error running command %s. The node %s is not active"
+ % (cmd, self.ip))
return None
_, stdout, stderr = (self.ssh_client.exec_command(cmd))
error = stderr.readlines()
if len(error) > 0:
logger.error("error %s" % ''.join(error))
- return error
+ return None
output = ''.join(stdout.readlines()).rstrip()
return output
@@ -200,28 +202,40 @@ class Node(object):
'info': self.info
}
- def is_controller(self):
+ def is_active(self):
'''
- Returns if the node is a controller
+ Returns if the node is active
'''
- if 'controller' in self.roles:
+ if self.status == NodeStatus.STATUS_OK:
return True
return False
+ def is_controller(self):
+ '''
+ Returns if the node is a controller
+ '''
+ return Role.CONTROLLER in self.roles
+
def is_compute(self):
'''
Returns if the node is a compute
'''
- if 'compute' in self.roles:
- return True
- return False
+ return Role.COMPUTE in self.roles
+
+ def is_odl(self):
+ '''
+ Returns if the node is an opendaylight
+ '''
+ return Role.ODL in self.roles
def get_ovs_info(self):
'''
Returns the ovs version installed
'''
- cmd = "ovs-vsctl --version|head -1| sed 's/^.*) //'"
- return self.run_cmd(cmd)
+ if self.is_active():
+ cmd = "ovs-vsctl --version|head -1| sed 's/^.*) //'"
+ return self.run_cmd(cmd)
+ return None
def get_system_info(self):
'''
@@ -345,6 +359,18 @@ class DeploymentHandler(object):
'''
return self.installer_node
+ def get_arch(self):
+ '''
+ Returns the architecture of the first compute node found
+ '''
+ arch = None
+ for node in self.nodes:
+ if node.is_compute():
+ arch = node.cpu_info.get('arch', None)
+ if arch:
+ break
+ return arch
+
def get_deployment_info(self):
'''
Returns an object of type Deployment
diff --git a/modules/opnfv/utils/ovs_logger.py b/modules/opnfv/utils/ovs_logger.py
index d650eb9ab..7777a9a16 100644
--- a/modules/opnfv/utils/ovs_logger.py
+++ b/modules/opnfv/utils/ovs_logger.py
@@ -101,19 +101,13 @@ class OVSLogger(object):
if timestamp is None:
timestamp = time.strftime("%Y%m%d-%H%M%S")
- for controller_client in controller_clients:
- self.ofctl_dump_flows(controller_client,
- timestamp=timestamp)
- self.vsctl_show(controller_client,
- timestamp=timestamp)
-
- for compute_client in compute_clients:
- self.ofctl_dump_flows(compute_client,
- timestamp=timestamp)
- self.vsctl_show(compute_client,
- timestamp=timestamp)
+ clients = controller_clients + compute_clients
+ for client in clients:
+ self.ofctl_dump_flows(client, timestamp=timestamp)
+ self.vsctl_show(client, timestamp=timestamp)
if related_error is not None:
dumpdir = os.path.join(self.ovs_dir, timestamp)
+ self.__mkdir_p(dumpdir)
with open(os.path.join(dumpdir, 'error'), 'w') as f:
f.write(related_error)