diff options
Diffstat (limited to 'qtip')
-rw-r--r-- | qtip/ansible_library/modules/apex_generate_inventory.py | 3 | ||||
-rw-r--r-- | qtip/ansible_library/modules/fuel.py | 3 | ||||
-rw-r--r-- | qtip/cli/commands/cmd_qpi.py | 48 |
3 files changed, 25 insertions, 29 deletions
diff --git a/qtip/ansible_library/modules/apex_generate_inventory.py b/qtip/ansible_library/modules/apex_generate_inventory.py index b1cc976d..0c9500f1 100644 --- a/qtip/ansible_library/modules/apex_generate_inventory.py +++ b/qtip/ansible_library/modules/apex_generate_inventory.py @@ -79,7 +79,8 @@ def generate_inventory(baremetal_info, server_info): node_ip = re.findall('.+=(\d+.\d+.\d+.\d+)$', server['Networks'])[0] hosts[role].append(node_ip) # To match ssh.cfg.j2 template - hosts_meta[node_ip] = {'ansible_ssh_host': node_ip} + hosts_meta[node_ip] = {'ansible_ssh_host': node_ip, + 'ansible_user': 'heat-admin'} for host in hosts: hosts[host].sort() diff --git a/qtip/ansible_library/modules/fuel.py b/qtip/ansible_library/modules/fuel.py index 5ec45dd1..04154e34 100644 --- a/qtip/ansible_library/modules/fuel.py +++ b/qtip/ansible_library/modules/fuel.py @@ -98,7 +98,8 @@ def generate_inventory(nodes): 'ip': node['ip'], 'mac': node['mac'], 'cluster': cluster_id, - 'ansible_ssh_host': node['ip'] + 'ansible_ssh_host': node['ip'], + 'ansible_user': 'root' } hosts_meta[hostname] = node_meta diff --git a/qtip/cli/commands/cmd_qpi.py b/qtip/cli/commands/cmd_qpi.py index d08842a4..4865b7ae 100644 --- a/qtip/cli/commands/cmd_qpi.py +++ b/qtip/cli/commands/cmd_qpi.py @@ -9,47 +9,41 @@ import click -from colorama import Fore import os +from os import path +from prettytable import PrettyTable +import yaml -from qtip.base.error import InvalidContentError -from qtip.base.error import NotFoundError -from qtip.cli import utils -from qtip.loader.qpi import QPISpec +QPI_PATH = path.join(path.dirname(__file__), '..', '..', '..', + 'resources', 'QPI') @click.group() def cli(): - ''' Collection of performance tests ''' + """ Collection of performance tests """ pass @cli.command('list', help='List all the QPI specs') def cmd_list(): - qpis = QPISpec.list_all() - table = utils.table('QPIs', qpis) + table = PrettyTable(['QPI', 'Description']) + table.align = 'l' + for qpi in os.listdir(QPI_PATH): + if qpi.endswith('yaml'): + with open('{}/{}'.format(QPI_PATH, qpi)) as conf: + details = yaml.safe_load(conf) + table.add_row([details['name'], details['description']]) click.echo(table) @cli.command('show', help='View details of a QPI') @click.argument('name') def show(name): - try: - qpi = QPISpec('{}.yaml'.format(name)) - except NotFoundError as nf: - click.echo(Fore.RED + "ERROR: qpi spec: " + nf.message) - except InvalidContentError as ice: - click.echo(Fore.RED + "ERROR: qpi spec: " + ice.message) - else: - cnt = qpi.content - output = utils.render('qpi', cnt) - click.echo(output) - - -@cli.command('run', help='Run performance tests for the specified QPI') -@click.argument('name') -@click.option('-p', '--path', help='Path to store results') -def run(name, path): - runner_path = path.join(os.path.dirname(__file__), os.path.pardir, os.path.pardir, - 'runner/runner.py') - os.system('python {0} -b all -d {1}'.format(runner_path, path)) + table = PrettyTable(['QPI', 'Description', 'Formula']) + table.align = 'l' + with open('{}/{}.yaml'.format(QPI_PATH, name)) as conf: + qpi = yaml.safe_load(conf) + for section in qpi['sections']: + table.add_row([section['name'], section['description'], + section['formula']]) + click.echo(table) |