Fixes bug where failed scenarios are marked as passed

+ Agent loss timeout is now confugarable for scale tests
+ Time for each test is also configurable
+ Check if directory passed is valid in graphing
+ Fix to shaker_build.yml to source the venv correctly

Change-Id: I4b45f8bedcbf579604469468dada84456d6516a9
Signed-off-by: Sindhur <smalleni@redhat.com>
This commit is contained in:
Sindhur 2016-03-03 12:28:42 -05:00 committed by Alex Krzos
parent 28274a9264
commit 0fa2c1e1c8
5 changed files with 48 additions and 17 deletions

View File

@ -11,10 +11,6 @@ local_remote_user: stack
# The Overcloud RC file
overcloudrc: /home/stack/overcloudrc
# The default Shaker
shaker_venv: /home/stack/shakershaker-venv-venv/bin/activate
shaker_centos: /home/stack/shaker-venv/lib/python2.7/site-packages/shaker/resources/image_builder_templates/centos.yaml
# The default Browbeat
browbeat_venv: /home/stack/browbeat-venv
@ -27,6 +23,9 @@ shaker_venv: /home/stack/shaker-venv
# The default PerfKit venv:
perfkit_venv: /home/stack/perfkit-venv
# Shaker centos image builder template
shaker_centos: "{{shaker_venv}}/lib/python2.7/site-packages/shaker/resources/image_builder_templates/centos.yaml"
# Guest images for the Over cloud
centos_image_url: http://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2
cirros_image_url: http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img

View File

@ -8,9 +8,9 @@
tasks:
- name: build shaker image
shell: >
source "{{ overcloudrc }}"; source "{{ shaker_venv }}";
source {{ overcloudrc }}; source {{ shaker_venv }}/bin/activate;
shaker-image-builder --flavor-name {{ shaker_flavor }} --image-builder-template
"{{ shaker_centos }}"
{{ shaker_centos }}
--os-region-name regionOne
become: true
register: image_result

View File

@ -50,6 +50,7 @@ shaker:
server: (Address of machine running browbeat)
port: 5555
flavor: m1.small
join_timeout: 600
venv: /home/stack/shaker-venv
scenarios:
l2:
@ -57,6 +58,7 @@ shaker:
density: 1
compute: 1
progression: linear
time: 60
file: /home/stack/shaker-venv/lib/python2.7/site-packages/shaker/scenarios/networking/dense_l2.yaml
l3-north-south:
enabled: false
@ -64,11 +66,13 @@ shaker:
density: 1
compute: 1
progression: null
time: 60
file: /home/stack/shaker-venv/lib/python2.7/site-packages/shaker/scenarios/networking/dense_l3_north_south.yaml
l3-east-west:
enabled: false
density: 1
compute: 1
time: 60
file: /home/stack/shaker-venv/lib/python2.7/site-packages/shaker/scenarios/networking/dense_l3_east_west.yaml
rally:
enabled: true

View File

@ -125,6 +125,9 @@ def main():
shakerplot_path = os.path.dirname(os.path.realpath(__file__))
results_path = os.path.join(shakerplot_path.replace('graphing',
'results'), args.result_dir)
if not os.path.isdir(results_path):
print "ERROR Directory doesn't exist"
exit(1)
for root, dirs, files in os.walk(results_path, topdown=False):
for name in files:
if name.endswith('.json'):

View File

@ -3,6 +3,7 @@ import yaml
import logging
import datetime
import os
import json
class Shaker:
def __init__(self, config):
@ -42,6 +43,7 @@ class Shaker:
default_density = 1
default_compute = 1
default_progression = "linear"
default_time = 60
if "placement" in config['shaker']['scenarios'][scenario]:
data['deployment']['accommodation'][1] = config['shaker']['scenarios'][scenario]['placement']
else:
@ -59,33 +61,56 @@ class Shaker:
else:
data['execution']['progression'] = default_progression
data['execution']['tests']=[d for d in data['execution']['tests'] if d.get('class') == "iperf_graph"]
if "time" in config['shaker']['scenarios'][scenario]:
data['execution']['tests'][0]['time'] = config['shaker']['scenarios'][scenario]['time']
else:
data['execution']['tests'][0]['time'] = default_time
with open(fname, 'w') as yaml_file:
yaml_file.write( yaml.dump(data, default_flow_style=False))
def get_uuidlist(self,data):
uuidlist = []
for key in data['records'].iterkeys():
uuidlist.append(key)
return uuidlist
def result_check(self, result_dir, test_name, scenario):
outputfile = os.path.join(result_dir,test_name + "." + "json")
error = False
with open (outputfile) as data_file:
data = json.load(data_file)
uuidlist=self.get_uuidlist(data)
for uuid in uuidlist:
if data['records'][uuid]['status'] != "ok":
error = True
if error:
self.logger.error("Failed scenario: {}".format(scenario))
self.logger.error("saved log to: {}.log".format(os.path.join(result_dir, test_name)))
self.fail_scenarios += 1
else:
self.logger.info("Completed Scenario: {}".format(scenario))
self.logger.info("Saved report to: {}".format(os.path.join(result_dir, test_name + "." + "html")))
self.logger.info("saved log to: {}.log".format(os.path.join(result_dir, test_name)))
self.pass_scenarios += 1
def run_scenario(self, filename, result_dir, test_name, scenario):
server_endpoint = self.config['shaker']['server']
port_no = self.config['shaker']['port']
flavor = self.config['shaker']['flavor']
venv = self.config['shaker']['venv']
timeout = self.config['shaker']['join_timeout']
cmd_1 = ("source {}/bin/activate; source /home/stack/overcloudrc").format(venv)
cmd_2=("shaker --server-endpoint {0}:{1} --flavor-name {2} --scenario {3}"
" --os-region-name regionOne --no-report-on-error"
" --os-region-name regionOne --agent-join-timeout {6}"
" --report {4}/{5}.html --output {4}/{5}.json"
" --debug > {4}/{5}.log 2>&1").format(server_endpoint,
port_no, flavor, filename, result_dir, test_name)
port_no, flavor, filename, result_dir, test_name, timeout)
cmd = ("{}; {}").format(cmd_1, cmd_2)
self.tools.run_cmd(cmd)
self.scenarios_count += 1
if os.path.isfile(os.path.join(result_dir,test_name + "." + "html")):
self.logger.info("Completed Scenario: {}".format(scenario))
self.logger.info("Saved report to: {}".format(os.path.join(result_dir, test_name + "." + "html")))
self.logger.info("saved log to: {}.log".format(os.path.join(result_dir, test_name)))
self.pass_scenarios += 1
self.result_check(result_dir, test_name, scenario)
else:
self.logger.error("Failed scenario: {}".format(scenario))
self.logger.error("saved log to: {}.log".format(os.path.join(result_dir, test_name)))
self.fail_scenarios += 1
def run_shaker(self):
self.logger.info("Starting Shaker workloads")