summaryrefslogtreecommitdiffstats
path: root/doctor_tests/installer/mcp.py
diff options
context:
space:
mode:
Diffstat (limited to 'doctor_tests/installer/mcp.py')
-rw-r--r--doctor_tests/installer/mcp.py62
1 files changed, 53 insertions, 9 deletions
diff --git a/doctor_tests/installer/mcp.py b/doctor_tests/installer/mcp.py
index 65c8ed70..7659c9e2 100644
--- a/doctor_tests/installer/mcp.py
+++ b/doctor_tests/installer/mcp.py
@@ -7,6 +7,7 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
from os.path import isfile
+import re
import time
from doctor_tests.common.constants import is_fenix
@@ -60,6 +61,45 @@ class McpInstaller(BaseInstaller):
mcp_key = '/var/lib/opnfv/mcp.rsa'
return mcp_key if isfile(mcp_key) else ssh_key
+ def get_transport_url(self):
+ client = SSHClient(self.controllers[0], self.node_user_name,
+ key_filename=self.key_file)
+ try:
+ cmd = 'sudo grep -m1 "^transport_url" /etc/nova/nova.conf'
+ ret, url = client.ssh(cmd)
+
+ if ret:
+ raise Exception('Exec command to get transport from '
+ 'controller(%s) in MCP installer failed, '
+ 'ret=%s, output=%s'
+ % (self.controllers[0], ret, url))
+ elif self.controllers[0] not in url:
+ # need to use ip instead of hostname
+ url = (re.sub("@.*:", "@%s:" % self.controllers[0],
+ url[0].split("=", 1)[1]))
+ except Exception:
+ cmd = 'grep -i "^rabbit" /etc/nova/nova.conf'
+ ret, lines = client.ssh(cmd)
+ if ret:
+ raise Exception('Exec command to get transport from '
+ 'controller(%s) in MCP 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("=")
+ url = "rabbit://%s:%s@%s:%s/?ssl=0" % (rabbit_userid,
+ rabbit_password,
+ self.controllers[0],
+ rabbit_port)
+ self.log.info('get_transport_url %s' % url)
+ return url
+
def _copy_overcloudrc_to_controllers(self):
for ip in self.controllers:
cmd = "scp overcloudrc %s@%s:" % (self.node_user_name, ip)
@@ -89,8 +129,8 @@ class McpInstaller(BaseInstaller):
def set_apply_patches(self):
self.log.info('Set apply patches start......')
fenix_files = None
-
set_scripts = [self.cm_set_script]
+ thrs = []
restart_cmd = 'sudo systemctl restart' \
' ceilometer-agent-notification.service'
@@ -112,10 +152,10 @@ class McpInstaller(BaseInstaller):
'admin_tool/fenix',
fenix_file)
client.scp(src_file, fenix_file)
- self._run_apply_patches(client,
- restart_cmd,
- set_scripts,
- python=self.python)
+ thrs.append(self._run_apply_patches(client,
+ restart_cmd,
+ set_scripts,
+ python=self.python))
time.sleep(5)
self.log.info('Set apply patches start......')
@@ -125,11 +165,15 @@ class McpInstaller(BaseInstaller):
for node_ip in self.computes:
client = SSHClient(node_ip, self.node_user_name,
key_filename=self.key_file)
- self._run_apply_patches(client,
- restart_cmd,
- [self.nc_set_compute_script],
- python=self.python)
+ thrs.append(self._run_apply_patches(
+ client,
+ restart_cmd,
+ [self.nc_set_compute_script],
+ python=self.python))
time.sleep(5)
+ # If Fenix container ir build, it needs to be ready before continue
+ for thr in thrs:
+ thr.join()
def restore_apply_patches(self):
self.log.info('restore apply patches start......')