aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--baro_tests/collectd.py8
-rw-r--r--baro_tests/config_server.py42
2 files changed, 36 insertions, 14 deletions
diff --git a/baro_tests/collectd.py b/baro_tests/collectd.py
index 4a7aacbd..1b5a9232 100644
--- a/baro_tests/collectd.py
+++ b/baro_tests/collectd.py
@@ -22,7 +22,6 @@ import time
import logging
import config_server
import tests
-import subprocess
from opnfv.deployment import factory
AODH_NAME = 'aodh'
@@ -30,7 +29,7 @@ GNOCCHI_NAME = 'gnocchi'
ID_RSA_SRC = '/root/.ssh/id_rsa'
ID_RSA_DST_DIR = '/root/.ssh'
ID_RSA_DST = ID_RSA_DST_DIR + '/id_rsa'
-APEX_IP = subprocess.check_output("echo $INSTALLER_IP", shell=True)
+APEX_IP = os.getenv("INSTALLER_IP").rstrip('\n')
APEX_USER = 'root'
APEX_USER_STACK = 'stack'
APEX_PKEY = '/root/.ssh/id_rsa'
@@ -624,6 +623,7 @@ def mcelog_install():
APEX_USER_STACK,
APEX_PKEY)
nodes = handler.get_nodes()
+ mce_bin = os.path.dirname(os.path.realpath(__file__)) + '/mce-inject_ea'
for node in nodes:
if node.is_compute():
centos_release = node.run_cmd('uname -r')
@@ -648,9 +648,7 @@ def mcelog_install():
logger.info(
'Mcelog will be enabled on node-{}...'.format(
node.get_dict()['id']))
- node.put_file(
- '/usr/local/lib/python2.7/dist-packages/baro_tests/'
- + 'mce-inject_ea', 'mce-inject_ea')
+ node.put_file(mce_bin, 'mce-inject_ea')
node.run_cmd('chmod a+x mce-inject_ea')
node.run_cmd('echo "CPU 0 BANK 0" > corrected')
node.run_cmd(
diff --git a/baro_tests/config_server.py b/baro_tests/config_server.py
index 3178effb..a5c8c701 100644
--- a/baro_tests/config_server.py
+++ b/baro_tests/config_server.py
@@ -19,7 +19,6 @@ import time
import os.path
import os
import re
-import subprocess
from opnfv.deployment import factory
ID_RSA_PATH = '/root/.ssh/id_rsa'
SSH_KEYS_SCRIPT = '/home/opnfv/barometer/baro_utils/get_ssh_keys.sh'
@@ -28,7 +27,7 @@ COLLECTD_CONF = '/etc/collectd.conf'
COLLECTD_CONF_DIR = '/etc/collectd/collectd.conf.d'
NOTIFICATION_FILE = '/var/log/python-notifications.dump'
COLLECTD_NOTIFICATION = '/etc/collectd_notification_dump.py'
-APEX_IP = subprocess.check_output("echo $INSTALLER_IP", shell=True)
+APEX_IP = os.getenv("INSTALLER_IP").rstrip('\n')
APEX_USER = 'root'
APEX_USER_STACK = 'stack'
APEX_PKEY = '/root/.ssh/id_rsa'
@@ -184,6 +183,8 @@ class ConfigServer(object):
if compute_name == node.get_dict()['name']:
stdout = node.run_cmd(
'cat /etc/collectd/collectd.conf.d/{}.conf'.format(plugin))
+ if stdout is None:
+ return default_interval
for line in stdout.split('\n'):
if 'Interval' in line:
return 1
@@ -205,6 +206,8 @@ class ConfigServer(object):
if compute_name == node.get_dict()['name']:
stdout = node.run_cmd(
'cat /etc/collectd/collectd.conf.d/{}.conf' .format(plugin))
+ if stdout is None:
+ return default_values
for line in stdout.split('\n'):
if 'Interfaces' in line:
return line.split(' ', 1)[1]
@@ -302,8 +305,10 @@ class ConfigServer(object):
for node in nodes:
if compute_name == node.get_dict()['name']:
stdout = node.run_cmd(
- 'yum list installed | grep mcelog')
- if 'mcelog' in stdout:
+ 'rpm -qa | grep mcelog')
+ if stdout is None:
+ return 0
+ elif 'mcelog' in stdout:
return 1
else:
return 0
@@ -337,7 +342,7 @@ class ConfigServer(object):
aodh_conf = node.run_cmd('ls /etc/collectd/collectd.conf.d')
if 'aodh.conf' not in aodh_conf:
self.__logger.info(
- "AODH Plugin not included in compute node")
+ "AODH Plugin not included in {}".format(compute_name))
return False
else:
self.__logger.info(
@@ -362,7 +367,9 @@ class ConfigServer(object):
if compute_name == node.get_dict()['name']:
gnocchi_conf = node.run_cmd('ls /etc/collectd/collectd.conf.d')
if 'collectd-ceilometer-plugin.conf' not in gnocchi_conf:
- self.__logger.info("Gnocchi Plugin not included")
+ self.__logger.info(
+ "Gnocchi Plugin not included in node {}".format(
+ compute_name))
return False
else:
self.__logger.info(
@@ -399,14 +406,13 @@ class ConfigServer(object):
Return boolean value indicating whether function was successful.
"""
+ csv_file = os.path.dirname(os.path.realpath(__file__)) + '/csv.conf'
plugins = sorted(plugins)
compute_name = compute.get_name()
nodes = get_apex_nodes()
for node in nodes:
if compute_name == node.get_dict()['name']:
- node.put_file(
- '/usr/local/lib/python2.7/dist-packages/baro_tests/'
- + 'csv.conf', 'csv.conf')
+ node.put_file(csv_file, 'csv.conf')
node.run_cmd(
'sudo cp csv.conf '
+ '/etc/collectd/collectd.conf.d/csv.conf')
@@ -472,12 +478,18 @@ class ConfigServer(object):
"source overcloudrc.v3;"
+ "aodh alarm list | grep {0} | grep {1}"
.format(criteria_list, compute))
+ if stdout is None:
+ self.__logger.info("aodh alarm list was empty")
+ return False
for line in stdout.splitlines():
line = line.replace('|', "")
metric_id = line.split()[0]
stdout = node.run_cmd(
'source overcloudrc.v3; aodh alarm show {}' .format(
metric_id))
+ if stdout is None:
+ self.__logger.info("aodh alarm list was empty")
+ return False
for line in stdout.splitlines()[3: -1]:
line = line.replace('|', "")
if line.split()[0] == 'timestamp':
@@ -488,6 +500,9 @@ class ConfigServer(object):
stdout = node.run_cmd(
"source overcloudrc.v3; aodh alarm show {}" .format(
metric_id))
+ if stdout is None:
+ self.__logger.info("aodh alarm list was empty")
+ return False
for line in stdout.splitlines()[3:-1]:
line = line.replace('|', "")
if line.split()[0] == 'timestamp':
@@ -521,12 +536,18 @@ class ConfigServer(object):
"source overcloudrc.v3;"
+ "gnocchi metric list | grep {0} | grep {1}"
.format(criteria_list, compute))
+ if stdout is None:
+ self.__logger.info("gnocchi list was empty")
+ return False
for line in stdout.splitlines():
line = line.replace('|', "")
metric_id = line.split()[0]
stdout = node.run_cmd(
'source overcloudrc.v3;gnocchi measures show {}'.format(
metric_id))
+ if stdout is None:
+ self.__logger.info("gnocchi list was empty")
+ return False
for line in stdout.splitlines()[3: -1]:
if line[0] == '+':
pass
@@ -537,6 +558,9 @@ class ConfigServer(object):
stdout = node.run_cmd(
"source overcloudrc.v3;gnocchi measures show {}".format(
metric_id))
+ if stdout is None:
+ self.__logger.info("gnocchi measures was empty")
+ return False
for line in stdout.splitlines()[3:-1]:
if line[0] == '+':
pass