summaryrefslogtreecommitdiffstats
path: root/qtip
diff options
context:
space:
mode:
Diffstat (limited to 'qtip')
-rw-r--r--qtip/api/__main__.py3
-rw-r--r--qtip/api/controllers/metric.py23
-rw-r--r--qtip/api/controllers/plan.py23
-rw-r--r--qtip/api/controllers/qpi.py23
-rw-r--r--qtip/api/swagger/swagger.yaml132
-rw-r--r--qtip/cli/commands/cmd_metric.py8
-rw-r--r--qtip/cli/commands/cmd_plan.py8
-rw-r--r--qtip/cli/commands/cmd_qpi.py8
-rw-r--r--qtip/cli/utils.py18
-rw-r--r--qtip/collector/calculator.py38
-rw-r--r--qtip/collector/parser/grep.py74
-rw-r--r--qtip/collector/parser/regex.yaml85
-rw-r--r--qtip/driver/playbook/ramspeed/run.yaml2
-rw-r--r--qtip/driver/playbook/unixbench/dhrystone.yaml8
-rw-r--r--qtip/driver/playbook/unixbench/whetstone.yaml8
-rwxr-xr-xqtip/scripts/cleanup_creds.sh11
-rw-r--r--qtip/util/env.py17
17 files changed, 445 insertions, 44 deletions
diff --git a/qtip/api/__main__.py b/qtip/api/__main__.py
index 7b9cdaf5..05d92315 100644
--- a/qtip/api/__main__.py
+++ b/qtip/api/__main__.py
@@ -10,13 +10,14 @@
import connexion
import os
+
swagger_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), 'swagger/'))
def main():
app = connexion.App(__name__, specification_dir=swagger_dir)
app.add_api('swagger.yaml', base_path='/v1.0')
- app.run(host='0.0.0.0', port='5000')
+ app.run(host="0.0.0.0", port=5000)
if __name__ == '__main__':
diff --git a/qtip/api/controllers/metric.py b/qtip/api/controllers/metric.py
index a026b5fc..86bf70f9 100644
--- a/qtip/api/controllers/metric.py
+++ b/qtip/api/controllers/metric.py
@@ -7,17 +7,26 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
-import connexion
import httplib
+import connexion
+
+from qtip.base import error
+from qtip.loader import metric
+
def list_metrics():
- return connexion.problem(httplib.NOT_IMPLEMENTED,
- 'List metrics',
- 'Metrics listing not implemented')
+ metric_list = list(metric.MetricSpec.list_all())
+ return metric_list, httplib.OK
def get_metric(name):
- return connexion.problem(httplib.NOT_IMPLEMENTED,
- 'Get a metric',
- 'metric retrieval not implemented')
+ try:
+ metric_spec = metric.MetricSpec(name)
+ return {'name': metric_spec.name,
+ 'abspath': metric_spec.abspath,
+ 'content': metric_spec.content}, httplib.OK
+ except error.NotFoundError:
+ return connexion.problem(httplib.NOT_FOUND,
+ 'Metric Not Found',
+ 'Requested metric `' + name + '` not found.')
diff --git a/qtip/api/controllers/plan.py b/qtip/api/controllers/plan.py
index e202b413..93836a32 100644
--- a/qtip/api/controllers/plan.py
+++ b/qtip/api/controllers/plan.py
@@ -7,20 +7,29 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
-import connexion
import httplib
+import connexion
+
+from qtip.base import error
+from qtip.loader import plan
+
def list_plans():
- return connexion.problem(httplib.NOT_IMPLEMENTED,
- 'List plans',
- 'Plans listing not implemented')
+ plan_list = list(plan.Plan.list_all())
+ return plan_list, httplib.OK
def get_plan(name):
- return connexion.problem(httplib.NOT_IMPLEMENTED,
- 'Get a plan',
- 'Plan retrieval not implemented')
+ try:
+ plan_spec = plan.Plan(name)
+ return {'name': plan_spec.name,
+ 'abspath': plan_spec.abspath,
+ 'content': plan_spec.content}, httplib.OK
+ except error.NotFoundError:
+ return connexion.problem(httplib.NOT_FOUND,
+ 'Plan Not Found',
+ 'requested plan `' + name + '` not found.')
def run_plan(name, action="run"):
diff --git a/qtip/api/controllers/qpi.py b/qtip/api/controllers/qpi.py
index 0b5c5b09..3c4dd718 100644
--- a/qtip/api/controllers/qpi.py
+++ b/qtip/api/controllers/qpi.py
@@ -7,17 +7,26 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
-import connexion
import httplib
+import connexion
+
+from qtip.base import error
+from qtip.loader import qpi
+
def list_qpis():
- return connexion.problem(httplib.NOT_IMPLEMENTED,
- 'List QPIs',
- 'QPIs listing not implemented')
+ qpi_spec_list = list(qpi.QPISpec.list_all())
+ return qpi_spec_list, httplib.OK
def get_qpi(name):
- return connexion.problem(httplib.NOT_IMPLEMENTED,
- 'Get a QPI',
- 'QPI retrieval not implemented')
+ try:
+ qpi_spec = qpi.QPISpec(name)
+ return {'name': qpi_spec.name,
+ 'abspath': qpi_spec.abspath,
+ 'content': qpi_spec.content}, httplib.OK
+ except error.NotFoundError:
+ return connexion.problem(httplib.NOT_FOUND,
+ 'QPI Not Found',
+ 'Requested QPI Spec `' + name + '` not found.')
diff --git a/qtip/api/swagger/swagger.yaml b/qtip/api/swagger/swagger.yaml
index 96d34681..fb10317f 100644
--- a/qtip/api/swagger/swagger.yaml
+++ b/qtip/api/swagger/swagger.yaml
@@ -4,7 +4,7 @@
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
+# http://www.apache.org/licenses/LICENSE -2.0
##############################################################################
swagger: '2.0'
@@ -22,11 +22,14 @@ paths:
operationId: qtip.api.controllers.plan.list_plans
tags:
- Plan
- - standalone
+ - Standalone
responses:
200:
description: A list of plans
- #TODO (akhil) add item with properties and parameters
+ schema:
+ type: array
+ items:
+ $ref: '#/definitions/Plans'
501:
description: Resource not implemented
schema:
@@ -41,7 +44,7 @@ paths:
operationId: qtip.api.controllers.plan.get_plan
tags:
- Plan
- - standalone
+ - Standalone
parameters:
- name: name
in: path
@@ -51,7 +54,8 @@ paths:
responses:
200:
description: Plan information
- #TODO (akhil) define schema
+ schema:
+ $ref: '#/definitions/Plan'
404:
description: Plan not found
schema:
@@ -112,7 +116,9 @@ paths:
responses:
200:
description: A list of QPIs
- #TODO (akhil) add item with properties and parameters
+ schema:
+ items:
+ $ref: '#/definitions/QPIs'
501:
description: Resource not implemented
schema:
@@ -138,7 +144,8 @@ paths:
responses:
200:
description: QPI information
- #TODO (akhil) define schema
+ schema:
+ $ref: '#/definitions/QPI'
404:
description: QPI not found
schema:
@@ -162,7 +169,9 @@ paths:
responses:
200:
description: A list of metrics
- #TODO (akhil) add item with properties and parameters
+ schema:
+ items:
+ $ref: '#/definitions/Metrics'
501:
description: Resource not implemented
schema:
@@ -188,7 +197,8 @@ paths:
responses:
200:
description: Metric information
- #TODO (akhil) define schema
+ schema:
+ $ref: '#/definitions/Metric'
404:
description: Metric not found
schema:
@@ -202,6 +212,110 @@ paths:
schema:
$ref: '#/definitions/Error'
definitions:
+ PlanContent:
+ type: object
+ required:
+ - name
+ properties:
+ name:
+ type: string
+ description:
+ type: string
+ info:
+ type: object
+ config:
+ type: object
+ QPIs:
+ type: array
+ items:
+ type: object
+ Plans:
+ type: object
+ required:
+ - name
+ - abspath
+ properties:
+ name:
+ type: string
+ abspath:
+ type: string
+ Plan:
+ allOf:
+ - $ref: '#/definitions/Plans'
+ - type: object
+ - required:
+ - content
+ properties:
+ content:
+ $ref: '#/definitions/PlanContent'
+ MetricContent:
+ type: object
+ required:
+ - name
+ properties:
+ name:
+ type: string
+ description:
+ type: string
+ links:
+ type: array
+ items:
+ type: string
+ workloads:
+ type: array
+ items:
+ type: string
+ Metrics:
+ type: object
+ required:
+ - name
+ - abspath
+ properties:
+ name:
+ type: string
+ abspath:
+ type: string
+ Metric:
+ allOf:
+ - $ref: '#/definitions/Metrics'
+ - required:
+ - content
+ properties:
+ content:
+ $ref: '#/definitions/MetricContent'
+ QPIContent:
+ type: object
+ required:
+ - name
+ properties:
+ name:
+ type: string
+ description:
+ type: string
+ formula:
+ type: string
+ sections:
+ type: array
+ items:
+ type: object
+ QPIs:
+ type: object
+ required:
+ - name
+ - abspath
+ properties:
+ name:
+ type: string
+ abspath:
+ type: string
+ QPI:
+ allOf:
+ - $ref: '#/definitions/QPIs'
+ - required:
+ - content
+ properties:
+ content:
+ $ref: '#/definitions/QPIContent'
Error:
type: object
properties:
diff --git a/qtip/cli/commands/cmd_metric.py b/qtip/cli/commands/cmd_metric.py
index b6035e2d..e8d86972 100644
--- a/qtip/cli/commands/cmd_metric.py
+++ b/qtip/cli/commands/cmd_metric.py
@@ -1,5 +1,5 @@
##############################################################################
-# Copyright (c) 2016 ZTE Corp and others.
+# Copyright (c) 2017 taseer94@gmail.com and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
@@ -9,7 +9,9 @@
import click
+from qtip.cli import utils
from qtip.cli.entry import Context
+from qtip.loader.metric import MetricSpec
pass_context = click.make_pass_decorator(Context, ensure=False)
@@ -24,7 +26,9 @@ def cli(ctx):
@cli.command('list', help='List all the Metric Groups')
@pass_context
def cmd_list(ctx):
- pass
+ metrics = MetricSpec.list_all()
+ table = utils.table('Metrics', metrics)
+ click.echo(table)
@cli.command('show', help='View details of a Metric')
diff --git a/qtip/cli/commands/cmd_plan.py b/qtip/cli/commands/cmd_plan.py
index 64c702d3..2f07965d 100644
--- a/qtip/cli/commands/cmd_plan.py
+++ b/qtip/cli/commands/cmd_plan.py
@@ -1,5 +1,5 @@
##############################################################################
-# Copyright (c) 2016 ZTE Corp and others.
+# Copyright (c) 2016 taseer94@gmail.com and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
@@ -10,7 +10,9 @@
import click
+from qtip.cli import utils
from qtip.cli.entry import Context
+from qtip.loader.plan import Plan
pass_context = click.make_pass_decorator(Context, ensure=False)
@@ -32,7 +34,9 @@ def init(ctx):
@cli.command('list', help='List the Plans')
@pass_context
def list(ctx):
- pass
+ plans = Plan.list_all()
+ table = utils.table('Plans', plans)
+ click.echo(table)
@cli.command('show', help='View details of a Plan')
diff --git a/qtip/cli/commands/cmd_qpi.py b/qtip/cli/commands/cmd_qpi.py
index 5fc9bec8..a12fa983 100644
--- a/qtip/cli/commands/cmd_qpi.py
+++ b/qtip/cli/commands/cmd_qpi.py
@@ -1,5 +1,5 @@
##############################################################################
-# Copyright (c) 2016 ZTE Corp and others.
+# Copyright (c) 2017 taseer94@gmail.com and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
@@ -10,7 +10,9 @@
import click
+from qtip.cli import utils
from qtip.cli.entry import Context
+from qtip.loader.qpi import QPISpec
pass_context = click.make_pass_decorator(Context, ensure=False)
@@ -25,7 +27,9 @@ def cli(ctx):
@cli.command('list', help='List all the QPI specs')
@pass_context
def cmd_list(ctx):
- pass
+ qpis = QPISpec.list_all()
+ table = utils.table('QPIs', qpis)
+ click.echo(table)
@cli.command('show', help='View details of a QPI')
diff --git a/qtip/cli/utils.py b/qtip/cli/utils.py
new file mode 100644
index 00000000..844d4f34
--- /dev/null
+++ b/qtip/cli/utils.py
@@ -0,0 +1,18 @@
+##############################################################################
+# Copyright (c) 2017 taseer94@gmail.com and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+from prettytable import PrettyTable
+
+
+def table(name, components):
+ """ Return a PrettyTable for component listing """
+ table = PrettyTable([name])
+ table.align[name] = 'l'
+ [table.add_row([component['name'][0:-5]]) for component in components]
+ return table
diff --git a/qtip/collector/calculator.py b/qtip/collector/calculator.py
new file mode 100644
index 00000000..c3d961b3
--- /dev/null
+++ b/qtip/collector/calculator.py
@@ -0,0 +1,38 @@
+##############################################################################
+# Copyright (c) 2017 ZTE Corp and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+from operator import add
+
+from qtip.util.logger import QtipLogger
+
+logger = QtipLogger('calculator').get
+
+
+def dpi_calculator(samples):
+ try:
+ float_pps = map(lambda x: float(x), samples['pps'])
+ float_bps = map(lambda x: float(x), samples['bps'])
+ sum_dpi_pps = reduce(add,
+ map(lambda x: x / 1000 if x > 100 else x, float_pps))
+ sum_dpi_bps = reduce(add,
+ map(lambda x: x / 1000 if x > 100 else x, float_bps))
+
+ return {'pps': round(sum_dpi_pps / 10, 3), 'bps': round(sum_dpi_bps / 10, 3)}
+ except Exception as error:
+ logger.error(error)
+ return {'pps': None, 'bps': None}
+
+
+def calculate_cpu_usage(cpu_idle):
+ try:
+ cpu_usage = round((100.0 - float(cpu_idle)), 3)
+ return '{0}%'.format(str(cpu_usage))
+ except Exception, error:
+ logger.error(error)
+ return None
diff --git a/qtip/collector/parser/grep.py b/qtip/collector/parser/grep.py
index f74ce403..44edb5a1 100644
--- a/qtip/collector/parser/grep.py
+++ b/qtip/collector/parser/grep.py
@@ -7,12 +7,20 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
-
+from collections import defaultdict
+from os import path
import re
+import yaml
-from qtip.base.constant import BaseProp
from qtip.base import BaseActor
+from qtip.base.constant import BaseProp
+from qtip.collector import calculator
+from qtip.util.logger import QtipLogger
+
+logger = QtipLogger('grep').get
+
+REGEX_FILE = path.join(path.dirname(__file__), 'regex.yaml')
class GrepProp(BaseProp):
@@ -32,3 +40,65 @@ def grep_in_file(filename, regex):
with open(filename, 'r') as f:
return filter(lambda x: x is not None,
re.finditer(regex, f.read(), re.MULTILINE))
+
+
+def _parse_logfile(config, paths):
+ captured = {}
+ for regex_rules_by_file in config:
+ filename = \
+ '{0}/{1}'.format(paths, regex_rules_by_file[GrepProp.FILENAME])
+ for regex in regex_rules_by_file['grep']:
+ matches = grep_in_file(filename, regex)
+ for item in matches:
+ print item.groupdict()
+ if len(matches) > 1:
+ temp_dict = defaultdict(list)
+ for item in [match.groupdict() for match in matches]:
+ for key in item:
+ temp_dict[key].append(item[key])
+ captured.update(temp_dict)
+ elif len(matches) == 1:
+ captured.update(matches[0].groupdict())
+ else:
+ logger.error("Nothing is matched from {0}".format(filename))
+ return captured
+
+
+# TODO: Hardcord in Danube, it will be removed in the future.
+def parse_sysinfo(config, result_dir):
+ sysinfo = _parse_logfile(config, result_dir)
+ if "cpu_idle" in sysinfo:
+ sysinfo['cpu_usage'] = \
+ calculator.calculate_cpu_usage(sysinfo['cpu_idle'])
+ sysinfo.pop('cpu_idle')
+ return sysinfo
+
+
+# TODO: Hardcord in Danube, it will be removed in the future.
+def parse_test_result(benchmark, config, result_dir):
+ test_result = _parse_logfile(config, result_dir)
+ if benchmark == 'dpi':
+ return calculator.dpi_calculator(test_result)
+ if benchmark == 'dhrystone' or benchmark == 'whetstone':
+ return {'total_cpus': test_result['total_cpus'],
+ 'single_cpu': {'num': test_result['single_cpu'],
+ 'score': test_result['score'][0]},
+ 'multi_cpus': {'num': test_result['multi_cpus'],
+ 'score': test_result['score'][1]}}
+ return test_result
+
+
+# TODO: Hardcord in Danube, it will be removed in the future.
+def parse_benchmark_result(result_dir):
+ regex_config = yaml.safe_load(file(REGEX_FILE))
+ benchmark = result_dir.split('/')[-1]
+ result = {'name': benchmark}
+
+ test_result = \
+ parse_test_result(benchmark, regex_config[benchmark], result_dir)
+ result['results'] = test_result.copy()
+
+ sysinfo = parse_sysinfo(regex_config['sysinfo'], result_dir)
+ result['sysinfo'] = sysinfo.copy()
+
+ return result
diff --git a/qtip/collector/parser/regex.yaml b/qtip/collector/parser/regex.yaml
new file mode 100644
index 00000000..397f8973
--- /dev/null
+++ b/qtip/collector/parser/regex.yaml
@@ -0,0 +1,85 @@
+##############################################################################
+# Copyright (c) 2017 ZTE Corporation and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+dhrystone:
+ - filename: dhrystone
+ grep:
+ - '^(?P<total_cpus>\d+)\sCPUs in system; running 1 parallel copy of tests$'
+ - '.+\srunning (?P<single_cpu>\d+) parallel copy of tests$'
+ - '.+\srunning (?P<multi_cpus>\d+) parallel copies of tests$'
+ - '^System Benchmarks Index Score \(Partial Only\)\s+(?P<score>\d+\.\d)$'
+whetstone:
+ - filename: whetstone
+ grep:
+ - '^(?P<total_cpus>\d+)\sCPUs in system; running 1 parallel copy of tests$'
+ - '.+\srunning (?P<single_cpu>\d+) parallel copy of tests$'
+ - '.+\srunning (?P<multi_cpus>\d+) parallel copies of tests$'
+ - '^System Benchmarks Index Score \(Partial Only\)\s+(?P<score>\d+\.\d)$'
+dpi:
+ - filename: dpi_dump.txt
+ grep:
+ - |-
+ ^\s+nDPI throughput:.+?(?P<pps>\d+.\d+)\sM\spps.+
+ ?(?P<bps>\d+.\d+)\sGb\/sec
+ramspeed:
+ - filename: Intmem
+ grep:
+ - '^INTEGER\s+BatchRun\s+Copy:\s+?(?P<integer_copy>\d+\.\d+)\sMB/s$'
+ - '^INTEGER\s+BatchRun\s+Scale:\s+?(?P<integer_scale>\d+\.\d+)\sMB/s$'
+ - '^INTEGER\s+BatchRun\s+Add:\s+?(?P<integer_add>\d+\.\d+)\sMB/s$'
+ - '^INTEGER\s+BatchRun\s+Triad:\s+?(?P<integer_triad>\d+\.\d+)\sMB/s$'
+ - '^INTEGER\s+BatchRun\s+AVERAGE:\s+?(?P<integer_average>\d+\.\d+)\sMB/s$'
+ - filename: Floatmem
+ grep:
+ - '^FL-POINT\s+BatchRun\s+Copy:\s+?(?P<float_copy>\d+\.\d+)\sMB/s$'
+ - '^FL-POINT\s+BatchRun\s+Scale:\s+?(?P<float_scale>\d+\.\d+)\sMB/s$'
+ - '^FL-POINT\s+BatchRun\s+Add:\s+?(?P<float_add>\d+\.\d+)\sMB/s$'
+ - '^FL-POINT\s+BatchRun\s+Triad:\s+?(?P<float_triad>\d+\.\d+)\sMB/s$'
+ - '^FL-POINT\s+BatchRun\s+AVERAGE:\s+?(?P<float_average>\d+\.\d+)\sMB/s$'
+ssl:
+ - filename: RSA_dump
+ grep:
+ - |-
+ ^rsa\s+512\sbits\s.+
+ ?(?P<rsa_sign_512>\d+\.\d)\s+
+ ?(?P<rsa_verify_512>\d+\.\d)$
+ - |-
+ ^rsa\s+1024\sbits\s.+
+ ?(?P<rsa_sign_1024>\d+\.\d)\s+
+ ?(?P<rsa_verify_1024>\d+\.\d)$
+ - |-
+ ^rsa\s+2048\sbits\s.+
+ ?(?P<rsa_sign_2048>\d+\.\d)\s+
+ ?(?P<rsa_verify_2048>\d+\.\d)$
+ - |-
+ ^rsa\s+4096\sbits\s.+
+ ?(?P<rsa_sign_4096>\d+\.\d)\s+
+ ?(?P<rsa_verify_4096>\d+\.\d)$
+ - filename: AES-128-CBC_dump
+ grep:
+ - |-
+ ^aes-128-cbc\s+
+ ?(?P<aes_128_cbc_16_bytes>\d+\.\w+)\s+
+ ?(?P<aes_128_cbc_64_bytes>\d+\.\w+)\s+
+ ?(?P<aes_128_cbc_256_bytes>\d+\.\w+)\s+
+ ?(?P<aes_128_cbc_1024_bytes>\d+\.\w+)\s+
+ ?(?P<aes_128_cbc_8192_bytes>\d+\.\w+)$
+sysinfo:
+ - filename: top.log
+ grep:
+ - 'Cpu\(s\):.+?(?P<cpu_idle>\d+\.\d)\sid'
+ - filename: inxi.log
+ grep:
+ - '.+\s+Host:\s+(?P<hostname>.+)\sKernel'
+ - '.+\sMemory:\s+(?P<memory>.+MB)\s'
+ - '^CPU\(s\):\s+(?P<cpu>.+)'
+ - '.+\sDistro:\s+(?P<os>.+)'
+ - '.+\sKernel:\s+(?P<kernel>.+)\sConsole'
+ - '.+\s+HDD Total Size:\s+(?P<disk>.+)\s'
+ - '.+\sproduct:\s+(?P<product>.+)\sv' \ No newline at end of file
diff --git a/qtip/driver/playbook/ramspeed/run.yaml b/qtip/driver/playbook/ramspeed/run.yaml
index 94becb55..496cd5db 100644
--- a/qtip/driver/playbook/ramspeed/run.yaml
+++ b/qtip/driver/playbook/ramspeed/run.yaml
@@ -31,7 +31,7 @@
- ~/ramspeed/ramsmp-3.5.0/ramsmp -b 3 -l 5 -p 1 >> Intmem
- ~/ramspeed/ramsmp-3.5.0/ramsmp -b 6 -l 5 -p 1 >> Floatmem
args:
- chdir: '{{ ansible_env.HOME }}/qtip_result/{{ ansible_hostname }}/whetstone/'
+ chdir: '{{ ansible_env.HOME }}/qtip_result/{{ ansible_hostname }}/ramspeed/'
- name: Fetch result files to local manchine
synchronize:
diff --git a/qtip/driver/playbook/unixbench/dhrystone.yaml b/qtip/driver/playbook/unixbench/dhrystone.yaml
index caa97f44..a0ee89a3 100644
--- a/qtip/driver/playbook/unixbench/dhrystone.yaml
+++ b/qtip/driver/playbook/unixbench/dhrystone.yaml
@@ -25,8 +25,12 @@
args:
chdir: '{{ ansible_env.HOME }}/tempT/UnixBench/'
-- name: Copying result and system info to qtip result directory
- shell: mv ~/tempT/UnixBench/results/* ./
+- name: Copying result to qtip result directory
+ shell: '{{ item }}'
+ with_items:
+ - mv ~/tempT/UnixBench/results/*.log ./
+ - mv ~/tempT/UnixBench/results/*.html ./
+ - mv ~/tempT/UnixBench/results/* ./dhrystone
args:
chdir: '{{ ansible_env.HOME }}/qtip_result/{{ ansible_hostname }}/dhrystone/'
diff --git a/qtip/driver/playbook/unixbench/whetstone.yaml b/qtip/driver/playbook/unixbench/whetstone.yaml
index 723fb3a6..c753779f 100644
--- a/qtip/driver/playbook/unixbench/whetstone.yaml
+++ b/qtip/driver/playbook/unixbench/whetstone.yaml
@@ -25,8 +25,12 @@
args:
chdir: '{{ ansible_env.HOME }}/tempT/UnixBench/'
-- name: Copying result and system info to qtip result directory
- shell: mv ~/tempT/UnixBench/results/* ./
+- name: Copying result to qtip result directory
+ shell: '{{ item }}'
+ with_items:
+ - mv ~/tempT/UnixBench/results/*.log ./
+ - mv ~/tempT/UnixBench/results/*.html ./
+ - mv ~/tempT/UnixBench/results/* ./whetstone
args:
chdir: '{{ ansible_env.HOME }}/qtip_result/{{ ansible_hostname }}/whetstone/'
diff --git a/qtip/scripts/cleanup_creds.sh b/qtip/scripts/cleanup_creds.sh
new file mode 100755
index 00000000..b4eee924
--- /dev/null
+++ b/qtip/scripts/cleanup_creds.sh
@@ -0,0 +1,11 @@
+#! /bin/bash
+
+DEST_IP=$1
+HOSTNAME=$(hostname)
+sshoptions="-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
+
+case "$INSTALLER_TYPE" in
+ fuel)
+ ssh $sshoptions -i ./config/QtipKey root@$DEST_IP "sed -i '/root@$HOSTNAME/d' /root/.ssh/authorized_keys"
+ ;;
+esac
diff --git a/qtip/util/env.py b/qtip/util/env.py
index 24e08658..830c9b38 100644
--- a/qtip/util/env.py
+++ b/qtip/util/env.py
@@ -16,6 +16,10 @@ import time
import paramiko
+from qtip.util.logger import QtipLogger
+
+logger = QtipLogger('ansible_driver').get
+
SCRIPT_DIR = path.join(path.dirname(__file__), path.pardir, 'scripts')
KEYNAME = 'QtipKey'
PRIVATE_KEY = '{0}/qtip/{1}'.format(os.environ['HOME'], KEYNAME)
@@ -185,3 +189,16 @@ class AnsibleEnvSetup(object):
return False
time.sleep(2)
return False
+
+ def cleanup(self):
+ IF_DEBUG = os.getenv('IF_DEBUG')
+
+ if IF_DEBUG:
+ logger.info("DEBUG Mode: please do cleanup by manual.")
+ else:
+ logger.info("Cleanup hostfile and keypair.")
+ clean_file(self.hostfile, self.keypair, self.keypair + '.pub')
+
+ for ip in self.host_ip_list:
+ logger.info("Cleanup authorized_keys from {0}...".format(ip))
+ os.system('bash %s/cleanup_creds.sh {0}'.format(ip))