diff options
author | 2018-06-19 14:21:14 -0400 | |
---|---|---|
committer | 2018-06-28 16:32:39 +0000 | |
commit | 0f3e771434ba7cf3270fda83c8943e700c026354 (patch) | |
tree | bf17b135ce4a899cbe60102a2de20f15acb77426 /docker/storperf-master | |
parent | cd0cefd880688bd3b31e355d893a46e4713a5608 (diff) |
Use MultiThreaded SNAPS
Take advantage of multiple threads in SNAPS to get info on the
stack more quickly.
Change-Id: Ifbfaec4fb6f1a4a322c327176c82200b5f69d874
JIRA: STORPERF-245
Signed-off-by: mbeierl <mark.beierl@dell.com>
(cherry picked from commit fa0e1935f3f0b6da79666963e5937c8402100287)
Diffstat (limited to 'docker/storperf-master')
-rw-r--r-- | docker/storperf-master/storperf/storperf_master.py | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/docker/storperf-master/storperf/storperf_master.py b/docker/storperf-master/storperf/storperf_master.py index 044cbb2..255bfa4 100644 --- a/docker/storperf-master/storperf/storperf_master.py +++ b/docker/storperf-master/storperf/storperf_master.py @@ -21,6 +21,7 @@ from snaps.config.stack import StackConfig from snaps.openstack.create_stack import OpenStackHeatStack from snaps.openstack.os_credentials import OSCreds from snaps.openstack.utils import heat_utils, cinder_utils, glance_utils +from snaps.thread_utils import worker_pool from storperf.db.job_db import JobDB from storperf.test_executor import TestExecutor @@ -69,6 +70,7 @@ class StorPerfMaster(object): self._cached_stack_id = None self._last_snaps_check_time = None self._slave_addresses = [] + self._thread_pool = worker_pool(20) @property def volume_count(self): @@ -158,14 +160,16 @@ class StorPerfMaster(object): return self._cached_stack_id self.heat_stack.initialize() + if self.heat_stack.get_stack() is not None: - self._last_snaps_check_time = datetime.now() self._cached_stack_id = self.heat_stack.get_stack().id cinder_cli = cinder_utils.cinder_client(self.os_creds) glance_cli = glance_utils.glance_client(self.os_creds) - vm_inst_creators = self.heat_stack.get_vm_inst_creators() + router_worker = self._thread_pool.apply_async( + self.heat_stack.get_router_creators) + vm_inst_creators = self.heat_stack.get_vm_inst_creators() self._agent_count = len(vm_inst_creators) vm1 = vm_inst_creators[0] self._availability_zone = \ @@ -180,9 +184,8 @@ class StorPerfMaster(object): server = vm1.get_vm_inst() - image_id = server.image_id - image = glance_utils.get_image_by_id(glance_cli, image_id) - self._agent_image = image.name + image_worker = self._thread_pool.apply_async( + glance_utils.get_image_by_id, (glance_cli, server.image_id)) self._volume_count = len(server.volume_ids) if self._volume_count > 0: @@ -192,11 +195,16 @@ class StorPerfMaster(object): self.logger.debug("Volume id %s, size=%s" % (volume.id, volume.size)) self._volume_size = volume.size - router_creators = self.heat_stack.get_router_creators() - router1 = router_creators[0] + image = image_worker.get() + self._agent_image = image.name + + router_creators = router_worker.get() + router1 = router_creators[0] self._public_network = \ router1.router_settings.external_gateway + + self._last_snaps_check_time = datetime.now() else: self._cached_stack_id = None |