From 63b55576a2290a1a9d6bb48dc72667967bbd8920 Mon Sep 17 00:00:00 2001 From: Sharada Shiddibhavi Date: Sat, 10 Mar 2018 00:22:27 +0000 Subject: Fixing the if/else logic in baro_tests/ mcelog_install() Follow on to the change #52775 Fixed the if/else logic while installing the mcelog. And added log messages to show on which node, mcelog is installed. Change-Id: If5f61b1a780abd243516699e352a55baf0db96f7 Signed-off-by: Sharada Shiddibhavi --- baro_tests/collectd.py | 54 ++++++++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/baro_tests/collectd.py b/baro_tests/collectd.py index bf310f01..2682c2a0 100644 --- a/baro_tests/collectd.py +++ b/baro_tests/collectd.py @@ -636,36 +636,38 @@ def mcelog_install(): centos_release = node.run_cmd('uname -r') if '3.10.0-514.26.2.el7.x86_64' not in centos_release: logger.info( - 'Mcelog will not be enabled on node-{}, ' + - ' unsupported CentOS relase found ({}).'.format( - node.get_dict()['name'], - centos_release)) + 'Mcelog will NOT be enabled on node-{}.' + + ' Unsupported CentOS release found ({}).'.format( + node.get_dict()['name'],centos_release)) else: logger.info( - 'Checking if mcelog is enabled' + 'Checking if mcelog is enabled' + ' on node-{}...'.format(node.get_dict()['name'])) res = node.run_cmd('ls') - if 'mce-inject_ea' and 'corrected' in res: - logger.info( - 'Mcelog seems to be already installed ' - + 'on node-{}.'.format(node.get_dict()['name'])) - node.run_cmd('sudo modprobe mce-inject') - node.run_cmd('sudo ./mce-inject_ea < corrected') - else: - logger.info( - 'Mcelog will be enabled on node-{}...'.format( - node.get_dict()['id'])) - 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( - 'echo "STATUS 0xcc00008000010090" >>' - + ' corrected') - node.run_cmd( - 'echo "ADDR 0x0010FFFFFFF" >> corrected') - node.run_cmd('sudo modprobe mce-inject') - node.run_cmd('sudo ./mce-inject_ea < corrected') - logger.info('Mcelog is installed on all compute nodes') + if 'mce-inject_ea' and 'corrected' in res: + logger.info( + 'Mcelog seems to be already installed ' + + 'on node-{}.'.format(node.get_dict()['name'])) + node.run_cmd('sudo modprobe mce-inject') + node.run_cmd('sudo ./mce-inject_ea < corrected') + else: + logger.info( + 'Mcelog will be enabled ' + + 'on node-{}...'.format(node.get_dict()['name'])) + 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( + 'echo "STATUS 0xcc00008000010090" >>' + + ' corrected') + node.run_cmd( + 'echo "ADDR 0x0010FFFFFFF" >> corrected') + node.run_cmd('sudo modprobe mce-inject') + node.run_cmd('sudo ./mce-inject_ea < corrected') + logger.info( + 'Mcelog was installed ' + + 'on node-{}.'.format(node.get_dict()['name'])) + def mcelog_delete(): -- cgit 1.2.3-korg