Gather Metadata in main browbeat run

This commit adds logic to run Metadata at the beginning of every browbeat
run through browbeat.py. Also some imports have been fixed.

Co-Authored-By: Joe Talerico <jtaleric@redhat.com>

Change-Id: Ibc13a64710209b25a755f606ea7fddc80232cbc4
This commit is contained in:
Sai Sindhur Malleni 2016-09-07 18:41:51 -04:00
parent 6c1215960d
commit 2357ad4743
14 changed files with 54 additions and 15 deletions

View File

@ -6,7 +6,8 @@ if [ ! $# -ge 1 ]; then
fi
tripleo_ip_address=$1
ansible_inventory_file='hosts'
ssh_config_file='ssh-config'
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
ssh_config_file=${DIR}'/ssh-config'
# "Hackish" copy ssh key to self if we are on directly on the undercloud machine:
if [[ "${tripleo_ip_address}" == "localhost" ]]; then
@ -107,9 +108,9 @@ for line in $nodes; do
fi
echo "" | tee -a ${ssh_config_file}
echo "Host ${host}" | tee -a ${ssh_config_file}
echo " ProxyCommand ssh -F ssh-config -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o ConnectTimeout=60 -i ~/.ssh/id_rsa stack@${tripleo_ip_address} -W ${IP}:22" | tee -a ${ssh_config_file}
echo " ProxyCommand ssh -F ${ssh_config_file} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o ConnectTimeout=60 -i ~/.ssh/id_rsa stack@${tripleo_ip_address} -W ${IP}:22" | tee -a ${ssh_config_file}
echo " User heat-admin" | tee -a ${ssh_config_file}
echo " IdentityFile heat-admin-id_rsa" | tee -a ${ssh_config_file}
echo " IdentityFile ${DIR}/heat-admin-id_rsa" | tee -a ${ssh_config_file}
echo " StrictHostKeyChecking no" | tee -a ${ssh_config_file}
echo " UserKnownHostsFile=/dev/null" | tee -a ${ssh_config_file}
done

View File

@ -89,7 +89,6 @@
command: mv {{ home_dir }}/{{item}} {{ browbeat_path }}/ansible/{{item}}
with_items:
- hosts
- ssh-config
- heat-admin-id_rsa
- name: Install requirements.txt into browbeat-venv

View File

@ -15,6 +15,7 @@ elasticsearch:
- name: software-metadata
file: metadata/software-metadata.json
ansible:
ssh_config: ansible/ssh-config
hosts: ansible/hosts
adjust:
keystone_token: ansible/browbeat/adjustment-keystone-token.yml
@ -22,6 +23,7 @@ ansible:
nova_db: ansible/browbeat/adjustment-db.yml
workers: ansible/browbeat/adjustment-workers.yml
grafana_snapshot: ansible/browbeat/snapshot-general-performance-dashboard.yml
metadata: ansible/gather/site.yml
connmon:
enabled: false
sudo: true

View File

@ -15,6 +15,7 @@ elasticsearch:
- name: software-metadata
file: metadata/software-metadata.json
ansible:
ssh_config: ansible/ssh-config
hosts: ansible/hosts
adjust:
keystone_token: ansible/browbeat/adjustment-keystone-token.yml
@ -22,6 +23,7 @@ ansible:
nova_db: ansible/browbeat/adjustment-db.yml
workers: ansible/browbeat/adjustment-workers.yml
grafana_snapshot: ansible/browbeat/snapshot-general-performance-dashboard.yml
metadata: ansible/gather/site.yml
connmon:
enabled: false
sudo: true

View File

@ -12,10 +12,11 @@
# limitations under the License.
from lib.Elastic import browbeat_uuid
from lib import PerfKit
from lib import Rally
from lib import Shaker
from lib import WorkloadBase
import lib.PerfKit
import lib.Rally
import lib.Shaker
import lib.WorkloadBase
import lib.Tools
import argparse
import logging
import sys
@ -56,13 +57,13 @@ def validate_yaml(config, _logger):
def _run_workload_provider(provider, config):
_logger = logging.getLogger('browbeat')
if provider == "perfkit":
perfkit = PerfKit.PerfKit(config)
perfkit = lib.PerfKit.PerfKit(config)
perfkit.start_workloads()
elif provider == "rally":
rally = Rally.Rally(config)
rally = lib.Rally.Rally(config)
rally.start_workloads()
elif provider == "shaker":
shaker = Shaker.Shaker(config)
shaker = lib.Shaker.Shaker(config)
shaker.run_shaker()
else:
_logger.error("Unknown workload provider: {}".format(provider))
@ -133,8 +134,19 @@ def main():
metadata_exists = check_metadata(_config, _logger)
if not metadata_exists:
_logger.error("Elasticsearch has been enabled but"
" metadata files do not exist, exiting")
sys.exit(1)
" metadata files do not exist")
_logger.info("Gathering Metadata")
os.putenv("ANSIBLE_SSH_ARGS"," -F {}".format(_config['ansible']['ssh_config']))
tools = lib.Tools.Tools(_config)
ansible_cmd = \
'ansible-playbook -i {} {}' \
.format(_config['ansible']['hosts'], _config['ansible']['metadata'])
tools.run_cmd(ansible_cmd)
if not check_metadata(_config, _logger):
_logger.warning("Metadata could not be gathered")
exit(1)
else:
_logger.info("Metadata about cloud has been gathered")
_logger.info("Running workload(s): {}".format(','.join(_cli_args.workloads)))
for wkld_provider in _cli_args.workloads:
if wkld_provider in _config:
@ -146,10 +158,10 @@ def main():
else:
_logger.error("{} is missing in {}".format(wkld_provider, _cli_args.setup))
result_dir = _config['browbeat']['results']
WorkloadBase.WorkloadBase.print_report(result_dir, time_stamp)
lib.WorkloadBase.WorkloadBase.print_report(result_dir, time_stamp)
_logger.info("Saved browbeat result summary to {}".format(
os.path.join(result_dir,time_stamp + '.' + 'report')))
WorkloadBase.WorkloadBase.print_summary()
lib.WorkloadBase.WorkloadBase.print_summary()
_logger.info("Browbeat Finished, UUID: {}".format(browbeat_uuid))
if __name__ == '__main__':

View File

@ -16,6 +16,7 @@ elasticsearch:
- name: software-metadata
file: metadata/software-metadata.json
ansible:
ssh_config: ansible/ssh-config
hosts: ansible/hosts
adjust:
keystone_token: ansible/browbeat/adjustment-keystone-token.yml
@ -23,6 +24,7 @@ ansible:
nova_db: ansible/browbeat/adjustment-db.yml
workers: ansible/browbeat/adjustment-workers.yml
grafana_snapshot: ansible/browbeat/snapshot-general-performance-dashboard.yml
metadata: ansible/gather/site.yml
connmon:
enabled: false
sudo: true

View File

@ -15,6 +15,7 @@ elasticsearch:
- name: software-metadata
file: metadata/software-metadata.json
ansible:
ssh_config: ansible/ssh-config
hosts: ansible/hosts
adjust:
keystone_token: ansible/browbeat/adjustment-keystone-token.yml
@ -22,6 +23,7 @@ ansible:
nova_db: ansible/browbeat/adjustment-db.yml
workers: ansible/browbeat/adjustment-workers.yml
grafana_snapshot: ansible/browbeat/snapshot-general-performance-dashboard.yml
metadata: ansible/gather/site.yml
connmon:
enabled: false
sudo: true

View File

@ -16,6 +16,7 @@ elasticsearch:
- name: software-metadata
file: metadata/software-metadata.json
ansible:
ssh_config: ansible/ssh-config
hosts: ansible/hosts
adjust:
keystone_token: ansible/browbeat/adjustment-keystone-token.yml
@ -23,6 +24,7 @@ ansible:
nova_db: ansible/browbeat/adjustment-db.yml
workers: ansible/browbeat/adjustment-workers.yml
grafana_snapshot: ansible/browbeat/snapshot-general-performance-dashboard.yml
metadata: ansible/gather/site.yml
connmon:
enabled: false
sudo: true

View File

@ -17,6 +17,7 @@ elasticsearch:
file: metadata/software-metadata.json
ansible:
ssh_config: ansible/ssh-config
hosts: ansible/hosts
adjust:
keystone_token: ansible/browbeat/adjustment-keystone-token.yml
@ -24,6 +25,7 @@ ansible:
nova_db: ansible/browbeat/adjustment-db.yml
workers: ansible/browbeat/adjustment-workers.yml
grafana_snapshot: ansible/browbeat/snapshot-general-performance-dashboard.yml
metadata: ansible/gather/site.yml
connmon:
enabled: false
sudo: true

View File

@ -15,6 +15,7 @@ elasticsearch:
- name: software-metadata
file: metadata/software-metadata.json
ansible:
ssh_config: ansible/ssh-config
hosts: ansible/hosts
adjust:
keystone_token: ansible/browbeat/adjustment-keystone-token.yml
@ -22,6 +23,7 @@ ansible:
nova_db: ansible/browbeat/adjustment-db.yml
workers: ansible/browbeat/adjustment-workers.yml
grafana_snapshot: ansible/browbeat/snapshot-general-performance-dashboard.yml
metadata: ansible/gather/site.yml
connmon:
enabled: false
sudo: true

View File

@ -15,6 +15,7 @@ elasticsearch:
- name: software-metadata
file: metadata/software-metadata.json
ansible:
ssh_config: ansible/ssh-config
hosts: ansible/hosts
adjust:
keystone_token: ansible/browbeat/adjustment-keystone-token.yml
@ -22,6 +23,7 @@ ansible:
nova_db: ansible/browbeat/adjustment-db.yml
workers: ansible/browbeat/adjustment-workers.yml
grafana_snapshot: ansible/browbeat/snapshot-general-performance-dashboard.yml
metadata: ansible/gather/site.yml
connmon:
enabled: false
sudo: true

View File

@ -18,6 +18,7 @@ elasticsearch:
- name: software-metadata
file: metadata/software-metadata.json
ansible:
ssh_config: ansible/ssh-config
hosts: ansible/hosts
adjust:
keystone_token: ansible/browbeat/adjustment-keystone-token.yml
@ -25,6 +26,7 @@ ansible:
nova_db: ansible/browbeat/adjustment-db.yml
workers: ansible/browbeat/adjustment-workers.yml
grafana_snapshot: ansible/browbeat/snapshot-general-performance-dashboard.yml
metadata: ansible/gather/site.yml
connmon:
enabled: false
sudo: true

View File

@ -18,6 +18,7 @@ elasticsearch:
- name: software-metadata
file: metadata/software-metadata.json
ansible:
ssh_config: ansible/ssh-config
hosts: ansible/hosts
adjust:
keystone_token: ansible/browbeat/adjustment-keystone-token.yml
@ -25,6 +26,7 @@ ansible:
nova_db: ansible/browbeat/adjustment-db.yml
workers: ansible/browbeat/adjustment-workers.yml
grafana_snapshot: ansible/browbeat/snapshot-general-performance-dashboard.yml
metadata: ansible/gather/site.yml
connmon:
enabled: false
sudo: true

View File

@ -50,8 +50,12 @@ mapping:
type: map
allowempty: True
mapping:
ssh_config:
type: str
required: True
hosts:
type: str
required: True
adjust:
type: map
mapping:
@ -68,6 +72,9 @@ mapping:
required: True
shaker_build:
type: str
metadata:
type: str
required: True
connmon:
type: map