Skip to content

Instantly share code, notes, and snippets.

@akrzos
Created July 16, 2016 13:30
Show Gist options
  • Save akrzos/9ef7fc7831f18ec14ddf510f3926350a to your computer and use it in GitHub Desktop.
Save akrzos/9ef7fc7831f18ec14ddf510f3926350a to your computer and use it in GitHub Desktop.
2016-07-15 13:01:20,663 : MainThread : DEBUG : Keeping full_refresh_threshold at default (100). (tests/workloads/test_refresh_vms.py:69)
2016-07-15 13:01:20,664 : MainThread : DEBUG : Retrieving the list of vm ids (utils/providers.py:35)
2016-07-15 13:01:20,863 : MainThread : DEBUG : Number of VM IDs: 0 (tests/workloads/test_refresh_vms.py:74)
2016-07-15 13:01:20,943 : MainThread : ERROR : @pytest.mark.parametrize('scenario', get_refresh_vms_scenarios())
def test_refresh_vms(request, scenario):
"""Refreshes all vm's then waits for a specific amount of time. Memory Monitor creates
graphs and summary at the end of the scenario."""
from_ts = int(time.time() * 1000)
ssh_client = SSHClient()
logger.debug('Scenario: {}'.format(scenario['name']))
clean_appliance(ssh_client)
scenario_data = {'appliance_ip': cfme_performance['appliance']['ip_address'],
'appliance_name': cfme_performance['appliance']['appliance_name'],
'test_dir': 'workload-refresh-vm',
'test_name': 'Refresh VMs',
'appliance_roles': get_server_roles_workload_refresh_vms(separator=', '),
'scenario': scenario}
monitor_thread = SmemMemoryMonitor(SSHClient(), scenario_data)
def cleanup_workload(scenario, from_ts):
starttime = time.time()
to_ts = int(starttime * 1000)
g_url = get_scenario_dashboard_url(scenario, from_ts, to_ts)
logger.debug('Started cleaning up monitoring thread.')
monitor_thread.grafana_url = g_url
monitor_thread.signal = False
monitor_thread.join()
timediff = time.time() - starttime
logger.info('Finished cleaning up monitoring thread in {}'.format(timediff))
request.addfinalizer(lambda: cleanup_workload(scenario, from_ts))
monitor_thread.start()
wait_for_miq_server_workers_started(poll_interval=2)
set_server_roles_workload_refresh_vms(ssh_client)
add_providers(scenario['providers'])
logger.info('Sleeping for refresh: {}s'.format(scenario['refresh_sleep_time']))
time.sleep(scenario['refresh_sleep_time'])
full_refresh_threshold_set = False
if 'full_refresh_threshold' in scenario:
if scenario['full_refresh_threshold'] != FULL_REFRESH_THRESHOLD_DEFAULT:
set_full_refresh_threshold(ssh_client, scenario['full_refresh_threshold'])
full_refresh_threshold_set = True
if not full_refresh_threshold_set:
logger.debug('Keeping full_refresh_threshold at default ({}).'.format(
FULL_REFRESH_THRESHOLD_DEFAULT))
refresh_size = scenario['refresh_size']
vm_ids = get_all_vm_ids()
vm_ids_iter = cycle(vm_ids)
logger.debug('Number of VM IDs: {}'.format(len(vm_ids)))
# Variable amount of time for refresh workload
total_time = scenario['total_time']
starttime = time.time()
time_between_refresh = scenario['time_between_refresh']
while ((time.time() - starttime) < total_time):
start_refresh_time = time.time()
> refresh_list = [next(vm_ids_iter) for x in range(refresh_size)]
E StopIteration
cfme-performance/tests/workloads/test_refresh_vms.py:83: StopIteration (tests/workloads/test_refresh_vms.py:83)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment