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
52 lines
1.7 KiB
Python
52 lines
1.7 KiB
Python
import logging
|
|
import os
|
|
import shutil
|
|
from subprocess import Popen, PIPE
|
|
|
|
class Tools:
|
|
|
|
def __init__(self,config=None):
|
|
self.logger = logging.getLogger('browbeat.Tools')
|
|
self.config = config
|
|
return None
|
|
|
|
# Run command, return stdout as result
|
|
def run_cmd(self,cmd):
|
|
self.logger.debug("Running command : %s" % cmd)
|
|
process = Popen(cmd,shell=True, stdout=PIPE, stderr=PIPE)
|
|
stdout, stderr = process.communicate()
|
|
if len(stderr) > 0 :
|
|
return None
|
|
else :
|
|
return stdout.strip()
|
|
|
|
# Find Command on host
|
|
def find_cmd(self,cmd):
|
|
_cmd = "which %s" % cmd
|
|
self.logger.debug('Find Command : Command : %s' % _cmd)
|
|
command = self.run_cmd(_cmd)
|
|
if command is None:
|
|
self.logger.error("Unable to find %s"%cmd)
|
|
raise Exception("Unable to find command : '%s'"%cmd)
|
|
return False
|
|
else:
|
|
return command.strip()
|
|
|
|
def create_run_dir(self,results_dir,run):
|
|
try :
|
|
os.makedirs("%s/run-%s" %(results_dir,run))
|
|
return "%s/run-%s" % (results_dir,run)
|
|
except OSError as e:
|
|
return False
|
|
|
|
|
|
# Create directory for results
|
|
def create_results_dir(self, results_dir, timestamp, service, scenario):
|
|
try :
|
|
os.makedirs("{}/{}/{}/{}".format(results_dir, timestamp, service, scenario))
|
|
self.logger.debug("{}/{}/{}/{}".format(os.path.dirname(results_dir), timestamp, service,
|
|
scenario))
|
|
return "{}/{}/{}/{}".format(os.path.dirname(results_dir), timestamp, service, scenario)
|
|
except OSError as e:
|
|
return False
|