From d8eb12f4200c21f569df5bc01d378a846b4c0db0 Mon Sep 17 00:00:00 2001 From: Tomi Juvonen Date: Thu, 28 Nov 2019 12:31:51 +0200 Subject: DevStack support Support running Doctor testing is DevStack multi-node controller JIRA: DOCTOR-136 Signed-off-by: Tomi Juvonen Change-Id: I1569f3f77d889420b3b8f3c2724c10253e509c28 --- doctor_tests/installer/mcp.py | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'doctor_tests/installer/mcp.py') diff --git a/doctor_tests/installer/mcp.py b/doctor_tests/installer/mcp.py index 65c8ed70..f8f33c83 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) -- cgit 1.2.3-korg