Multiple enhancements
1. Show server VMs count in consolidated results; 2. Show total connections in consolidated results; 3. Show hypervisors for each VM; 4. Truncate data to decimals in consolidated results; 5. Support to save results to JSON file; 6. Check before applying static route; Change-Id: I813b59c03509e5878e0e9752a8a49cdb4856e988
This commit is contained in:
parent
e1993aada6
commit
21d2822a44
@ -31,6 +31,7 @@ class BaseCompute(object):
|
||||
self.novaclient = network.router.user.nova_client
|
||||
self.vm_name = vm_name
|
||||
self.instance = None
|
||||
self.host = None
|
||||
self.fip = None
|
||||
self.fip_ip = None
|
||||
self.subnet_ip = None
|
||||
@ -82,6 +83,7 @@ class BaseCompute(object):
|
||||
servers_list = self.get_server_list()
|
||||
for server in servers_list:
|
||||
if server.name == vmname and server.status == "ACTIVE":
|
||||
self.host = server.__dict__['OS-EXT-SRV-ATTR:hypervisor_hostname']
|
||||
return True
|
||||
time.sleep(2)
|
||||
LOG.error("[%s] VM not found, after %d attempts" % (vmname,
|
||||
|
@ -6,15 +6,15 @@ server:
|
||||
# Number of Users to be created inside the tenant
|
||||
users_per_tenant: 1
|
||||
|
||||
# Number of networks to be created within the context of each Router
|
||||
# Assumes 1 subnet per network
|
||||
networks_per_router: 1
|
||||
|
||||
# Number of routers to be created within the context of each User
|
||||
# For now support only 1 router per user
|
||||
routers_per_user: 1
|
||||
|
||||
# Number of VM instances to be created within the context of each User
|
||||
# Number of networks to be created within the context of each Router
|
||||
# Assumes 1 subnet per network
|
||||
networks_per_router: 1
|
||||
|
||||
# Number of VM instances to be created within the context of each Network
|
||||
vms_per_network: 1
|
||||
|
||||
# Number of security groups per network
|
||||
@ -45,15 +45,15 @@ client:
|
||||
# Number of Users to be created inside the tenant
|
||||
users_per_tenant: 1
|
||||
|
||||
# Number of networks to be created within the context of each Router
|
||||
# Assumes 1 subnet per network
|
||||
networks_per_router: 1
|
||||
|
||||
# Number of routers to be created within the context of each User
|
||||
# For now support only 1 router per user
|
||||
routers_per_user: 1
|
||||
|
||||
# Number of VM instances to be created within the context of each User
|
||||
# Number of networks to be created within the context of each Router
|
||||
# Assumes 1 subnet per network
|
||||
networks_per_router: 1
|
||||
|
||||
# Number of VM instances to be created within the context of each Network
|
||||
vms_per_network: 2
|
||||
|
||||
# Number of security groups per network
|
||||
@ -77,7 +77,7 @@ client:
|
||||
redis_server: '172.29.172.180'
|
||||
redis_server_port: 6379
|
||||
redis_retry_count: 50
|
||||
polling_interval: 5
|
||||
polling_interval: 5
|
||||
|
||||
# Tooling
|
||||
tp_tool:
|
||||
@ -101,7 +101,7 @@ client:
|
||||
duration: 30
|
||||
|
||||
# Prompt before running benchmarking tools
|
||||
prompt_before_run: False
|
||||
prompt_before_run: True
|
||||
|
||||
# Configs that remain constant
|
||||
keystone_admin_role: "admin"
|
||||
|
@ -40,6 +40,7 @@ class KBScheduler(object):
|
||||
self.client_dict = dict(zip([x.vm_name.lower() for x in client_list], client_list))
|
||||
self.config = config
|
||||
self.result = {}
|
||||
self.tool_result = None
|
||||
|
||||
# Redis
|
||||
self.connection_pool = None
|
||||
@ -180,9 +181,7 @@ class KBScheduler(object):
|
||||
# Call the method in corresponding tools to consolidate results
|
||||
http_tool = self.client_dict.values()[0].http_tool
|
||||
LOG.kbdebug(self.result.values())
|
||||
final_results = http_tool.consolidate_results(self.result.values())
|
||||
LOG.info(final_results)
|
||||
|
||||
self.tool_result = http_tool.consolidate_results(self.result.values())
|
||||
except (KBSetStaticRouteException):
|
||||
LOG.error("Could not set static route.")
|
||||
return
|
||||
|
@ -155,9 +155,14 @@ class KB_VM_Agent(object):
|
||||
self.process_cmd(msg)
|
||||
|
||||
def exec_setup_static_route(self):
|
||||
cmd = KB_Instance.add_static_route(self.user_data['target_subnet_ip'],
|
||||
self.user_data['target_shared_interface_ip'])
|
||||
return self.exec_command(cmd)
|
||||
cmd = KB_Instance.get_static_route(self.user_data['target_subnet_ip'])
|
||||
result = self.exec_command(cmd)
|
||||
if (self.user_data['target_subnet_ip'] not in result[1]):
|
||||
cmd = KB_Instance.add_static_route(self.user_data['target_subnet_ip'],
|
||||
self.user_data['target_shared_interface_ip'])
|
||||
return self.exec_command(cmd)
|
||||
else:
|
||||
return (0, '', '')
|
||||
|
||||
def exec_check_http_service(self):
|
||||
cmd = KB_Instance.check_http_service(self.user_data['target_url'])
|
||||
|
@ -12,6 +12,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import json
|
||||
from multiprocessing.pool import ThreadPool
|
||||
import os
|
||||
import sys
|
||||
@ -145,25 +146,27 @@ class KloudBuster(object):
|
||||
self.single_cloud = False
|
||||
self.kloud = Kloud(config_scale.server, cred)
|
||||
self.testing_kloud = Kloud(config_scale.client, testing_cred, testing_side=True)
|
||||
self.final_result = None
|
||||
|
||||
def print_provision_info(self):
|
||||
"""
|
||||
Function that iterates and prints all VM info
|
||||
for tested and testing cloud
|
||||
"""
|
||||
table = [["VM Name", "Internal IP", "Floating IP", "Subnet", "Shared Interface IP"]]
|
||||
table = [["VM Name", "Host", "Internal IP", "Floating IP", "Subnet", "Shared Interface IP"]]
|
||||
client_list = self.kloud.get_all_instances()
|
||||
for instance in client_list:
|
||||
row = [instance.vm_name, instance.fixed_ip, instance.fip_ip, instance.subnet_ip,
|
||||
instance.shared_interface_ip]
|
||||
row = [instance.vm_name, instance.host, instance.fixed_ip,
|
||||
instance.fip_ip, instance.subnet_ip, instance.shared_interface_ip]
|
||||
table.append(row)
|
||||
LOG.info('Provision Details (Tested Kloud)\n' +
|
||||
tabulate(table, headers="firstrow", tablefmt="psql"))
|
||||
|
||||
table = [["VM Name", "Internal IP", "Floating IP", "Subnet"]]
|
||||
table = [["VM Name", "Host", "Internal IP", "Floating IP", "Subnet"]]
|
||||
client_list = self.testing_kloud.get_all_instances()
|
||||
for instance in client_list:
|
||||
row = [instance.vm_name, instance.fixed_ip, instance.fip_ip, instance.subnet_ip]
|
||||
row = [instance.vm_name, instance.host, instance.fixed_ip,
|
||||
instance.fip_ip, instance.subnet_ip]
|
||||
table.append(row)
|
||||
LOG.info('Provision Details (Testing Kloud)\n' +
|
||||
tabulate(table, headers="firstrow", tablefmt="psql"))
|
||||
@ -211,8 +214,15 @@ class KloudBuster(object):
|
||||
self.print_provision_info()
|
||||
|
||||
client_list = self.testing_kloud.get_all_instances()
|
||||
server_list = self.kloud.get_all_instances()
|
||||
kbscheduler = kb_scheduler.KBScheduler(client_list, config_scale.client)
|
||||
kbscheduler.run()
|
||||
self.final_result = kbscheduler.tool_result
|
||||
self.final_result['total_server_vms'] = len(server_list)
|
||||
self.final_result['total_client_vms'] = len(client_list)
|
||||
self.final_result['total_connetcions'] =\
|
||||
len(client_list) * config_scale.client.http_tool_configs.connections
|
||||
LOG.info(self.final_result)
|
||||
except KeyboardInterrupt:
|
||||
traceback.format_exc()
|
||||
except (sshutils.SSHError, ClientException, Exception):
|
||||
@ -253,6 +263,9 @@ if __name__ == '__main__':
|
||||
cfg.StrOpt("passwd_testing",
|
||||
default=None,
|
||||
help="OpenStack password testing cloud"),
|
||||
cfg.StrOpt("json",
|
||||
default=None,
|
||||
help='store results in JSON format file'),
|
||||
cfg.BoolOpt("no-env",
|
||||
default=False,
|
||||
help="Do not read env variables")
|
||||
@ -286,3 +299,9 @@ if __name__ == '__main__':
|
||||
# deletion
|
||||
kloudbuster = KloudBuster(cred, cred_testing)
|
||||
kloudbuster.run()
|
||||
|
||||
if CONF.json:
|
||||
'''Save results in JSON format file.'''
|
||||
LOG.info('Saving results in json file: ' + CONF.json + "...")
|
||||
with open(CONF.json, 'w') as jfp:
|
||||
json.dump(kloudbuster.final_result, jfp, indent=4, sort_keys=True)
|
||||
|
@ -60,10 +60,10 @@ class WrkTool(PerfTool):
|
||||
# Transfer/sec: 282.53MB
|
||||
try:
|
||||
total_req_str = r'(\d+)\srequests\sin'
|
||||
http_total_req = re.search(total_req_str, stdout).group(1)
|
||||
http_total_req = int(re.search(total_req_str, stdout).group(1))
|
||||
|
||||
re_str = r'Requests/sec:\s+(\d+\.\d+)'
|
||||
http_rps = re.search(re_str, stdout).group(1)
|
||||
http_rps = float(re.search(re_str, stdout).group(1))
|
||||
|
||||
re_str = r'Transfer/sec:\s+(\d+\.\d+.B)'
|
||||
http_rates_kbytes = re.search(re_str, stdout).group(1)
|
||||
@ -102,10 +102,10 @@ class WrkTool(PerfTool):
|
||||
|
||||
@staticmethod
|
||||
def consolidate_results(results):
|
||||
all_res = {'total_vms': len(results), 'tool': 'wrk'}
|
||||
all_res = {'tool': 'wrk'}
|
||||
for key in ['http_rps', 'http_total_req', 'http_sock_err', 'http_rates_kbytes']:
|
||||
all_res[key] = 0
|
||||
for item in results:
|
||||
all_res[key] += float(item['results'][key])
|
||||
|
||||
all_res[key] += item['results'][key]
|
||||
all_res[key] = int(all_res[key])
|
||||
return all_res
|
||||
|
Loading…
x
Reference in New Issue
Block a user