Remove the dest_path from the config file

1. Remove the dest_path from the config file;
2. Fix the resource logging bug of keypairs;

Change-Id: I00aff0708e4d2ee69dadc65afbfe038422f70350
This commit is contained in:
Yichen Wang 2015-09-03 11:22:25 -07:00
parent d7d9575dda
commit 0db7bc9d0e
6 changed files with 12 additions and 52 deletions

View File

@ -117,11 +117,6 @@ client:
# Interval for polling status from all VMs in seconds
polling_interval: 5
# Tooling
http_tool:
name: 'wrk'
dest_path: '/usr/local/bin/wrk2'
# HTTP tool specific configs (per VM)
# Every HTTP server VM is paired to 1 HTTP traffic generator VM
# KloudBuster will take care of setting up the proper static routes

View File

@ -25,8 +25,8 @@ class KBResLogger(object):
def __init__(self):
self.resource_list = {}
for key in ['tenants', 'users', 'flavors', 'routers', 'networks',
'sec_groups', 'instances', 'floating_ips']:
for key in ['tenants', 'users', 'flavors', 'keypairs', 'routers',
'networks', 'sec_groups', 'instances', 'floating_ips']:
self.resource_list[key] = []
def log(self, res_type, name, id):

View File

@ -333,7 +333,8 @@ class KloudBuster(object):
ins.user_data['redis_server_port'] = 6379
ins.user_data['target_subnet_ip'] = svr_list[idx].subnet_ip
ins.user_data['target_shared_interface_ip'] = svr_list[idx].shared_interface_ip
ins.user_data['http_tool'] = ins.config['http_tool']
# @TODO(Move this hard coded part to kb_vm_agent.py)
ins.user_data['http_tool'] = {'dest_path': '/usr/local/bin/wrk2'}
ins.user_data['http_tool_configs'] = ins.config['http_tool_configs']
ins.boot_info['flavor_type'] = 'kb.client' if \
not self.tenants_list['client'] else self.testing_kloud.flavor_to_use

View File

@ -22,11 +22,10 @@ LOG = logging.getLogger(__name__)
# An openstack instance (can be a VM or a LXC)
class PerfInstance(BaseCompute):
def __init__(self, vm_name, network, config, is_server=False):
def __init__(self, vm_name, network, config):
BaseCompute.__init__(self, vm_name, network)
self.config = config
self.is_server = is_server
self.boot_info = {}
self.user_data = {}
self.up_flag = False
@ -34,25 +33,10 @@ class PerfInstance(BaseCompute):
# SSH Configuration
self.ssh_access = None
self.ssh = None
self.port = None
self.az = None
if 'tp_tool' not in config:
self.tp_tool = None
# elif config.tp_tool.lower() == 'nuttcp':
# self.tp_tool = nuttcp_tool.NuttcpTool
# elif opts.tp_tool.lower() == 'iperf':
# self.tp_tool = iperf_tool.IperfTool
# else:
# self.tp_tool = None
if 'http_tool' not in config:
self.http_tool = None
elif config.http_tool.name.lower() == 'wrk':
self.http_tool = WrkTool(self, config.http_tool)
self.target_url = None
else:
self.http_tool = None
# self.tp_tool = nuttcp_tool.NuttcpTool(self)
self.http_tool = WrkTool(self)
def run_tp_client(self, label, dest_ip, target_instance,
mss=None, bandwidth=0, bidirectional=False, az_to=None):

View File

@ -24,16 +24,15 @@ LOG = logging.getLogger(__name__)
class PerfTool(object):
__metaclass__ = abc.ABCMeta
def __init__(self, instance, tool_cfg):
self.name = tool_cfg.name
def __init__(self, instance, tool_name):
self.instance = instance
self.dest_path = tool_cfg.dest_path
self.name = tool_name
self.pid = None
# Terminate pid if started
def dispose(self):
if self.pid:
# Terminate the iperf server
# Terminate the server
LOG.kbdebug("[%s] Terminating %s" % (self.instance.vm_name,
self.name))
self.instance.ssh.kill_proc(self.pid)
@ -82,11 +81,6 @@ class PerfTool(object):
res['latency_stats'] = latency_stats
return res
@abc.abstractmethod
def cmd_run_client(**kwargs):
# must be implemented by sub classes
return None
@abc.abstractmethod
def cmd_parser_run_client(self, status, stdout, stderr):
# must be implemented by sub classes

View File

@ -25,22 +25,8 @@ LOG = logging.getLogger(__name__)
class WrkTool(PerfTool):
def __init__(self, instance, cfg_http_tool):
PerfTool.__init__(self, instance, cfg_http_tool)
def cmd_run_client(self, target_url, threads, connections,
rate_limit=0, timeout=5, connetion_type='Keep-alive'):
'''
Return the command for running the benchmarking tool
'''
duration_sec = self.instance.config.http_tool_configs.duration
if not rate_limit:
rate_limit = 65535
cmd = '%s -t%d -c%d -R%d -d%ds --timeout %ds -D2 -e %s' % \
(self.dest_path, threads, connections, rate_limit,
duration_sec, timeout, target_url)
LOG.kbdebug("[%s] %s" % (self.instance.vm_name, cmd))
return cmd
def __init__(self, instance):
PerfTool.__init__(self, instance, 'wrk2')
def cmd_parser_run_client(self, status, stdout, stderr):
if status: