8a542ef8ec
Learning the Ansible API for this migration. Very simple script that will use the browbeat checks + Added Pbench start/stop 01/11/16 + Moved ansible to config 01/11/16 + Adding ansible hosts option 01/11/16 + Connmon added (start/stop) still nothing with results 01/12/16 + New Rally YAML format... (nova example) 01/12/16 + Create results directory 01/12/16 + Created lib with classes 01/13/16 + Updated Scenarios 01/14/16 + Updated other workloads to new format 01/15/16 + Switched to dict get method 01/15/16 + Removed pyc files and updated 01/15/16 + updated genhost file 01/15/16 + Update Ansible for connmon finished pbench work 01/15/16 + Catch if user tries to run without Ansible or Ansible2 01/26/16 + Minor changes 01/26/16 + Bug fix... 01/27/16 + (akrzos) added keystone yamls and browbeat-complete.yaml + Moved BrowbeatRally to Rally and broke connmon out of Tools + (akrzos) Implemented per Rally test scenario task args. + Updated Docs, removed old browbeat.sh + (akrzos) Cleaned up lib/Rally.py and added cinder scenarios to browbeat configs. + Fix Connmon install issue + (akrzos) Added parameters to neutron task yamls + (akrzos) Changed connmon to stop logging immediately after rally task completes. Change-Id: I338c3463e25f38c2ec7667c7dfc8b5424acba8c2
94 lines
3.2 KiB
Python
94 lines
3.2 KiB
Python
import logging
|
|
import sys
|
|
sys.path.append("./")
|
|
from Tools import *
|
|
|
|
class Pbench:
|
|
|
|
def __init__(self,config,hosts):
|
|
self.logger = logging.getLogger('browbeat.Pbench')
|
|
self.tools = Tools()
|
|
self.config = config
|
|
self.hosts = hosts
|
|
return None
|
|
|
|
# PBench Start Tools
|
|
def register_tools(self):
|
|
tool="register-tool"
|
|
register_tool=self.tools.find_cmd(tool)
|
|
tool="clear-tools"
|
|
clear_tools=self.tools.find_cmd(tool)
|
|
interval = self.config['browbeat']['pbench']['interval']
|
|
as_sudo = self.config['browbeat']['sudo']
|
|
# Clear out old tools
|
|
cmd = ""
|
|
if as_sudo :
|
|
cmd +="sudo "
|
|
cmd = "%s" % clear_tools
|
|
self.logger.info('PBench Clear : Command : %s' % cmd)
|
|
self.tools.run_cmd(cmd)
|
|
# Now Register tools
|
|
self.logger.info('PBench register tools')
|
|
for tool in self.config['browbeat']['pbench']['tools'] :
|
|
cmd = ""
|
|
if as_sudo :
|
|
cmd +="sudo "
|
|
cmd += "%s " % register_tool
|
|
cmd += "--name=%s -- --interval=%s" % (tool,interval)
|
|
self.logger.debug('PBench Start : Command : %s' % cmd)
|
|
if not self.tools.run_cmd(cmd) :
|
|
self.logger.error("Issue registering tool.")
|
|
return False
|
|
return self.register_remote_tools()
|
|
|
|
def get_results_dir(self,prefix):
|
|
cmd="find /var/lib/pbench-agent/ -name \"*%s*\" -print"%prefix
|
|
return self.tools.run_cmd(cmd)
|
|
|
|
def register_remote_tools(self):
|
|
tool="register-tool"
|
|
register_tool=self.tools.find_cmd(tool)
|
|
interval = self.config['browbeat']['pbench']['interval']
|
|
if len(self.hosts.options('hosts')) > 0 :
|
|
for node in self.hosts.options('hosts'):
|
|
cmd = ""
|
|
as_sudo = self.config['browbeat']['sudo']
|
|
if as_sudo :
|
|
cmd +="sudo "
|
|
cmd = ""
|
|
for tool in self.config['browbeat']['pbench']['tools'] :
|
|
cmd = ""
|
|
if as_sudo :
|
|
cmd +="sudo "
|
|
cmd += "%s " % register_tool
|
|
cmd += "--name=%s --remote=%s -- --interval=%s" % (tool,node,interval)
|
|
self.logger.debug('PBench register-remote: Command : %s' % cmd)
|
|
if not self.tools.run_cmd(cmd) :
|
|
self.logger.error("Issue registering tool.")
|
|
return False
|
|
return True
|
|
|
|
# PBench Stop Tools
|
|
def stop_pbench(self,sudo=False):
|
|
tool="stop-tools"
|
|
stop_tool=self.tools.find_cmd(tool)
|
|
cmd = ""
|
|
if sudo :
|
|
cmd +="sudo "
|
|
cmd = "%s" % stop_tool
|
|
self.logger.info('PBench Stop : Command : %s' % cmd)
|
|
self.tools.run_cmd(cmd)
|
|
return True
|
|
|
|
# Move Results
|
|
def move_results(self,sudo=False):
|
|
tool="move-results"
|
|
move_tool=self.tools.find_cmd(tool)
|
|
cmd = ""
|
|
if sudo :
|
|
cmd +="sudo "
|
|
cmd = "%s" % move_tool
|
|
self.logger.info('PBench move-results : Command : %s' % cmd)
|
|
self.tools.run_cmd(cmd)
|
|
return True
|