Browse Source

Fix SSL and verbose issue of zaqar bench

Currently, Zaqar bench doesn't pass insecure or cert when build
Zaqar client which cause it doesn't work with SSL. This patch
fix it and also deprecates the 'verbose' option which is replaced
with 'debug'.

Closes-Bug: #1607124

Change-Id: I7411b9a310abb5e51f91bac0766a6fe7d684741c
changes/07/348107/4
Fei Long Wang 6 years ago
committed by wangxiyuan
parent
commit
35deeef798
  1. 4
      bench-requirements.txt
  2. 8
      zaqar/bench/conductor.py
  3. 3
      zaqar/bench/config.py
  4. 2
      zaqar/bench/consumer.py
  5. 23
      zaqar/bench/helpers.py
  6. 2
      zaqar/bench/observer.py
  7. 2
      zaqar/bench/producer.py

4
bench-requirements.txt

@ -1,4 +1,4 @@
gevent>=1.0.1
marktime>=0.2.0
python-zaqarclient>=0.0.2
os-client-config!=1.6.2,>=1.4.0
python-zaqarclient>=1.1.0
os-client-config>=1.13.1 # Apache-2.0

8
zaqar/bench/conductor.py

@ -30,7 +30,7 @@ from zaqar.bench import producer
CONF = config.conf
def _print_verbose_stats(name, stats):
def _print_debug_stats(name, stats):
print(name.capitalize())
print('=' * len(name))
@ -55,7 +55,7 @@ def main():
# clean them up after the performance test, in case
# the user wants to examine the state of the system.
if not CONF.skip_queue_reset:
if CONF.verbose:
if CONF.debug:
print('Resetting queues...')
_reset_queues()
@ -74,7 +74,7 @@ def main():
for each_proc in procs:
stats.update(downstream_queue.get_nowait())
if CONF.verbose:
if CONF.debug:
print()
for name in ('producer', 'observer', 'consumer'):
@ -84,7 +84,7 @@ def main():
if not stats_group['duration_sec']:
continue
_print_verbose_stats(name, stats_group)
_print_debug_stats(name, stats_group)
else:
stats['params'] = {

3
zaqar/bench/config.py

@ -49,6 +49,9 @@ _CLI_OPTIONS = (
default=5,
help='Number of Observer Workers'),
cfg.BoolOpt('debug', default=True,
help=('Tag to indicate if print the details of running.')),
cfg.FloatOpt('api_version', short='api', default='2',
help='Zaqar API version to use'),

2
zaqar/bench/consumer.py

@ -152,7 +152,7 @@ def run(upstream_queue):
procs = [mp.Process(target=load_generator, args=args)
for _ in range(num_procs)]
if CONF.verbose:
if CONF.debug:
print('\nStarting consumers (cp={0}, cw={1})...'.format(
num_procs, num_workers))

23
zaqar/bench/helpers.py

@ -17,7 +17,6 @@ import os
import sys
import os_client_config
from six.moves import urllib_parse
from zaqarclient.queues import client
from zaqar.bench import config
@ -46,6 +45,10 @@ def _get_credential_args():
cloud = os_cfg.get_one_cloud()
cred_args = cloud.get_auth_args()
cred_args['insecure'] = cloud.auth.get('insecure')
cred_args['cacert'] = cloud.auth.get('cacert')
cred_args['token'] = cloud.auth.get('token')
required_options = ['username', 'password', 'auth_url', 'project_name']
if not all(arg in cred_args for arg in required_options):
try:
@ -68,24 +71,20 @@ def _get_credential_args():
def _generate_client_conf():
auth_strategy = os.environ.get('OS_AUTH_STRATEGY', 'noauth')
if auth_strategy == 'keystone':
args = _get_credential_args()
# FIXME(flwang): Now we're hardcode the keystone auth version, since
# there is a 'bug' with the osc-config which is returning the auth_url
# without version. This should be fixed as long as the bug is fixed.
parsed_url = urllib_parse.urlparse(args['auth_url'])
auth_url = args['auth_url']
if not parsed_url.path or parsed_url.path == '/':
auth_url = urllib_parse.urljoin(args['auth_url'], 'v2.0')
conf = {
'auth_opts': {
'backend': 'keystone',
'options': {
'os_username': args['username'],
'os_password': args['password'],
'os_username': args.get('username'),
'os_password': args.get('password'),
'os_project_name': args['project_name'],
'os_auth_url': auth_url,
'insecure': '',
'os_auth_url': args['auth_url'],
'insecure': args.get('insecure'),
'cacert': args.get('cacert'),
'auth_token': args.get('token')
},
},
}

2
zaqar/bench/observer.py

@ -148,7 +148,7 @@ def run(upstream_queue):
procs = [mp.Process(target=load_generator, args=args)
for _ in range(num_procs)]
if CONF.verbose:
if CONF.debug:
print('\nStarting observer (op={0}, ow={1})...'.format(
num_procs, num_workers))

2
zaqar/bench/producer.py

@ -158,7 +158,7 @@ def run(upstream_queue):
for _ in range(num_procs)
]
if CONF.verbose:
if CONF.debug:
print('\nStarting producer (pp={0}, pw={1})...'.format(
num_procs, num_workers))

Loading…
Cancel
Save