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 fi
tripleo_ip_address=$1 tripleo_ip_address=$1
ansible_inventory_file='hosts' 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: # "Hackish" copy ssh key to self if we are on directly on the undercloud machine:
if [[ "${tripleo_ip_address}" == "localhost" ]]; then if [[ "${tripleo_ip_address}" == "localhost" ]]; then
@ -107,9 +108,9 @@ for line in $nodes; do
fi fi
echo "" | tee -a ${ssh_config_file} echo "" | tee -a ${ssh_config_file}
echo "Host ${host}" | 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 " 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 " StrictHostKeyChecking no" | tee -a ${ssh_config_file}
echo " UserKnownHostsFile=/dev/null" | tee -a ${ssh_config_file} echo " UserKnownHostsFile=/dev/null" | tee -a ${ssh_config_file}
done done

View File

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

View File

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

View File

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

View File

@ -12,10 +12,11 @@
# limitations under the License. # limitations under the License.
from lib.Elastic import browbeat_uuid from lib.Elastic import browbeat_uuid
from lib import PerfKit import lib.PerfKit
from lib import Rally import lib.Rally
from lib import Shaker import lib.Shaker
from lib import WorkloadBase import lib.WorkloadBase
import lib.Tools
import argparse import argparse
import logging import logging
import sys import sys
@ -56,13 +57,13 @@ def validate_yaml(config, _logger):
def _run_workload_provider(provider, config): def _run_workload_provider(provider, config):
_logger = logging.getLogger('browbeat') _logger = logging.getLogger('browbeat')
if provider == "perfkit": if provider == "perfkit":
perfkit = PerfKit.PerfKit(config) perfkit = lib.PerfKit.PerfKit(config)
perfkit.start_workloads() perfkit.start_workloads()
elif provider == "rally": elif provider == "rally":
rally = Rally.Rally(config) rally = lib.Rally.Rally(config)
rally.start_workloads() rally.start_workloads()
elif provider == "shaker": elif provider == "shaker":
shaker = Shaker.Shaker(config) shaker = lib.Shaker.Shaker(config)
shaker.run_shaker() shaker.run_shaker()
else: else:
_logger.error("Unknown workload provider: {}".format(provider)) _logger.error("Unknown workload provider: {}".format(provider))
@ -133,8 +134,19 @@ def main():
metadata_exists = check_metadata(_config, _logger) metadata_exists = check_metadata(_config, _logger)
if not metadata_exists: if not metadata_exists:
_logger.error("Elasticsearch has been enabled but" _logger.error("Elasticsearch has been enabled but"
" metadata files do not exist, exiting") " metadata files do not exist")
sys.exit(1) _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))) _logger.info("Running workload(s): {}".format(','.join(_cli_args.workloads)))
for wkld_provider in _cli_args.workloads: for wkld_provider in _cli_args.workloads:
if wkld_provider in _config: if wkld_provider in _config:
@ -146,10 +158,10 @@ def main():
else: else:
_logger.error("{} is missing in {}".format(wkld_provider, _cli_args.setup)) _logger.error("{} is missing in {}".format(wkld_provider, _cli_args.setup))
result_dir = _config['browbeat']['results'] 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( _logger.info("Saved browbeat result summary to {}".format(
os.path.join(result_dir,time_stamp + '.' + 'report'))) 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)) _logger.info("Browbeat Finished, UUID: {}".format(browbeat_uuid))
if __name__ == '__main__': if __name__ == '__main__':

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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