summaryrefslogtreecommitdiffstats
path: root/doctor_tests/installer/base.py
diff options
context:
space:
mode:
authorTomi Juvonen <tomi.juvonen@nokia.com>2018-11-28 11:48:27 +0200
committerTomi Juvonen <tomi.juvonen@nokia.com>2018-12-18 12:40:53 +0200
commite6708c869855ab69f9b53959befd82bb2f32f9ad (patch)
tree549f91d138d0dc796047fbefa70ceef1d467b5f8 /doctor_tests/installer/base.py
parente1c5dd0158d5168738fcc9918d24c04ca724b056 (diff)
Bug - Testing in Apex with OpenStack master fails
Support yet another path to find config files. Tune config changes to take effect properly for maintenance. transport_url parcing enhanced. Nova reset state to error takes well over 1 second these days and at the end it then sends notification that we use. Only reasonable thing is to send notification straight from the Inspector as it should have been done in the first place. Now we can do 200ms as total time, with just a few millisends actuallly spent on sending the notification. Further one could improve this by having node specific Inspector agent to react even in more Telco grade speed. Change-Id: I787f8e9dd6484842c6c568b15767018d11b36862 Signed-off-by: Tomi Juvonen <tomi.juvonen@nokia.com>
Diffstat (limited to 'doctor_tests/installer/base.py')
-rw-r--r--doctor_tests/installer/base.py58
1 files changed, 54 insertions, 4 deletions
diff --git a/doctor_tests/installer/base.py b/doctor_tests/installer/base.py
index 124b1910..df781ee1 100644
--- a/doctor_tests/installer/base.py
+++ b/doctor_tests/installer/base.py
@@ -11,6 +11,7 @@ import getpass
import grp
import os
import pwd
+import re
import six
import stat
import subprocess
@@ -126,6 +127,48 @@ class BaseInstaller(object):
os.chmod(ssh_key, stat.S_IREAD)
return ssh_key
+ def get_transport_url(self):
+ client = utils.SSHClient(self.controllers[0], self.node_user_name,
+ key_filename=self.key_file)
+ if self.use_containers:
+ ncbase = "/var/lib/config-data/puppet-generated/nova"
+ else:
+ ncbase = ""
+ try:
+ cmd = 'sudo grep "^transport_url" %s/etc/nova/nova.conf' % ncbase
+ ret, url = client.ssh(cmd)
+ if ret:
+ raise Exception('Exec command to get transport from '
+ 'controller(%s) in Apex installer failed, '
+ 'ret=%s, output=%s'
+ % (self.controllers[0], ret, url))
+ else:
+ # need to use ip instead of hostname
+ ret = (re.sub("@.*:", "@%s:" % self.controllers[0],
+ url[0].split("=", 1)[1]))
+ except:
+ cmd = 'grep -i "^rabbit" %s/etc/nova/nova.conf' % ncbase
+ ret, lines = client.ssh(cmd)
+ if ret:
+ raise Exception('Exec command to get transport from '
+ 'controller(%s) in Apex installer failed, '
+ 'ret=%s, output=%s'
+ % (self.controllers[0], ret, url))
+ else:
+ for line in lines.split('\n'):
+ if line.startswith("rabbit_userid"):
+ rabbit_userid = line.split("=")
+ if line.startswith("rabbit_port"):
+ rabbit_port = line.split("=")
+ if line.startswith("rabbit_password"):
+ rabbit_password = line.split("=")
+ ret = "rabbit://%s:%s@%s:%s/?ssl=0" % (rabbit_userid,
+ rabbit_password,
+ self.controllers[0],
+ rabbit_port)
+ self.log.debug('get_transport_url %s' % ret)
+ return ret
+
def _run_cmd_remote(self, client, command):
self.log.info('Run command=%s in %s installer......'
% (command, self.conf.installer.type))
@@ -161,14 +204,21 @@ class BaseInstaller(object):
for script_name in script_names:
script_abs_path = '{0}/{1}/{2}'.format(installer_dir,
'common', script_name)
- client.scp(script_abs_path, script_name)
- cmd = 'sudo %s %s' % (python, script_name)
- ret, output = client.ssh(cmd)
+ try:
+ client.scp(script_abs_path, script_name)
+ except:
+ client.scp(script_abs_path, script_name)
+ try:
+ cmd = 'sudo %s %s' % (python, script_name)
+ ret, output = client.ssh(cmd)
+ except:
+ ret, output = client.ssh(cmd)
+
if ret:
raise Exception('Do the command in remote'
' node failed, ret=%s, cmd=%s, output=%s'
% (ret, cmd, output))
- if 'nova-scheduler' in restart_cmd:
+ if 'nova' in restart_cmd:
# Make sure scheduler has proper cpu_allocation_ratio
time.sleep(5)
client.ssh(restart_cmd)