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
This commit is contained in:
parent
cd3adce177
commit
35deeef798
@ -1,4 +1,4 @@
|
|||||||
gevent>=1.0.1
|
gevent>=1.0.1
|
||||||
marktime>=0.2.0
|
marktime>=0.2.0
|
||||||
python-zaqarclient>=0.0.2
|
python-zaqarclient>=1.1.0
|
||||||
os-client-config!=1.6.2,>=1.4.0
|
os-client-config>=1.13.1 # Apache-2.0
|
@ -30,7 +30,7 @@ from zaqar.bench import producer
|
|||||||
CONF = config.conf
|
CONF = config.conf
|
||||||
|
|
||||||
|
|
||||||
def _print_verbose_stats(name, stats):
|
def _print_debug_stats(name, stats):
|
||||||
print(name.capitalize())
|
print(name.capitalize())
|
||||||
print('=' * len(name))
|
print('=' * len(name))
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ def main():
|
|||||||
# clean them up after the performance test, in case
|
# clean them up after the performance test, in case
|
||||||
# the user wants to examine the state of the system.
|
# the user wants to examine the state of the system.
|
||||||
if not CONF.skip_queue_reset:
|
if not CONF.skip_queue_reset:
|
||||||
if CONF.verbose:
|
if CONF.debug:
|
||||||
print('Resetting queues...')
|
print('Resetting queues...')
|
||||||
|
|
||||||
_reset_queues()
|
_reset_queues()
|
||||||
@ -74,7 +74,7 @@ def main():
|
|||||||
for each_proc in procs:
|
for each_proc in procs:
|
||||||
stats.update(downstream_queue.get_nowait())
|
stats.update(downstream_queue.get_nowait())
|
||||||
|
|
||||||
if CONF.verbose:
|
if CONF.debug:
|
||||||
print()
|
print()
|
||||||
|
|
||||||
for name in ('producer', 'observer', 'consumer'):
|
for name in ('producer', 'observer', 'consumer'):
|
||||||
@ -84,7 +84,7 @@ def main():
|
|||||||
if not stats_group['duration_sec']:
|
if not stats_group['duration_sec']:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
_print_verbose_stats(name, stats_group)
|
_print_debug_stats(name, stats_group)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
stats['params'] = {
|
stats['params'] = {
|
||||||
|
@ -49,6 +49,9 @@ _CLI_OPTIONS = (
|
|||||||
default=5,
|
default=5,
|
||||||
help='Number of Observer Workers'),
|
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',
|
cfg.FloatOpt('api_version', short='api', default='2',
|
||||||
help='Zaqar API version to use'),
|
help='Zaqar API version to use'),
|
||||||
|
|
||||||
|
@ -152,7 +152,7 @@ def run(upstream_queue):
|
|||||||
procs = [mp.Process(target=load_generator, args=args)
|
procs = [mp.Process(target=load_generator, args=args)
|
||||||
for _ in range(num_procs)]
|
for _ in range(num_procs)]
|
||||||
|
|
||||||
if CONF.verbose:
|
if CONF.debug:
|
||||||
print('\nStarting consumers (cp={0}, cw={1})...'.format(
|
print('\nStarting consumers (cp={0}, cw={1})...'.format(
|
||||||
num_procs, num_workers))
|
num_procs, num_workers))
|
||||||
|
|
||||||
|
@ -17,7 +17,6 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
import os_client_config
|
import os_client_config
|
||||||
from six.moves import urllib_parse
|
|
||||||
from zaqarclient.queues import client
|
from zaqarclient.queues import client
|
||||||
|
|
||||||
from zaqar.bench import config
|
from zaqar.bench import config
|
||||||
@ -46,6 +45,10 @@ def _get_credential_args():
|
|||||||
cloud = os_cfg.get_one_cloud()
|
cloud = os_cfg.get_one_cloud()
|
||||||
cred_args = cloud.get_auth_args()
|
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']
|
required_options = ['username', 'password', 'auth_url', 'project_name']
|
||||||
if not all(arg in cred_args for arg in required_options):
|
if not all(arg in cred_args for arg in required_options):
|
||||||
try:
|
try:
|
||||||
@ -68,24 +71,20 @@ def _get_credential_args():
|
|||||||
|
|
||||||
def _generate_client_conf():
|
def _generate_client_conf():
|
||||||
auth_strategy = os.environ.get('OS_AUTH_STRATEGY', 'noauth')
|
auth_strategy = os.environ.get('OS_AUTH_STRATEGY', 'noauth')
|
||||||
|
|
||||||
if auth_strategy == 'keystone':
|
if auth_strategy == 'keystone':
|
||||||
args = _get_credential_args()
|
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 = {
|
conf = {
|
||||||
'auth_opts': {
|
'auth_opts': {
|
||||||
'backend': 'keystone',
|
'backend': 'keystone',
|
||||||
'options': {
|
'options': {
|
||||||
'os_username': args['username'],
|
'os_username': args.get('username'),
|
||||||
'os_password': args['password'],
|
'os_password': args.get('password'),
|
||||||
'os_project_name': args['project_name'],
|
'os_project_name': args['project_name'],
|
||||||
'os_auth_url': auth_url,
|
'os_auth_url': args['auth_url'],
|
||||||
'insecure': '',
|
'insecure': args.get('insecure'),
|
||||||
|
'cacert': args.get('cacert'),
|
||||||
|
'auth_token': args.get('token')
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -148,7 +148,7 @@ def run(upstream_queue):
|
|||||||
procs = [mp.Process(target=load_generator, args=args)
|
procs = [mp.Process(target=load_generator, args=args)
|
||||||
for _ in range(num_procs)]
|
for _ in range(num_procs)]
|
||||||
|
|
||||||
if CONF.verbose:
|
if CONF.debug:
|
||||||
print('\nStarting observer (op={0}, ow={1})...'.format(
|
print('\nStarting observer (op={0}, ow={1})...'.format(
|
||||||
num_procs, num_workers))
|
num_procs, num_workers))
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ def run(upstream_queue):
|
|||||||
for _ in range(num_procs)
|
for _ in range(num_procs)
|
||||||
]
|
]
|
||||||
|
|
||||||
if CONF.verbose:
|
if CONF.debug:
|
||||||
print('\nStarting producer (pp={0}, pw={1})...'.format(
|
print('\nStarting producer (pp={0}, pw={1})...'.format(
|
||||||
num_procs, num_workers))
|
num_procs, num_workers))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user