Merge "Refactor sleep_between"

This commit is contained in:
Jenkins 2016-09-12 13:47:42 +00:00 committed by Gerrit Code Review
commit c96df85c53
5 changed files with 18 additions and 42 deletions

View File

@ -139,10 +139,7 @@ class CinderScenario(scenario.OpenStackScenario):
# NOTE(msdubov): It is reasonable to wait 5 secs before starting to
# check whether the volume is ready => less API calls.
self.sleep_between(CONF.benchmark.
cinder_volume_create_prepoll_delay,
CONF.benchmark.
cinder_volume_create_prepoll_delay)
self.sleep_between(CONF.benchmark.cinder_volume_create_prepoll_delay)
volume = bench_utils.wait_for(
volume,
@ -269,8 +266,7 @@ class CinderScenario(scenario.OpenStackScenario):
client = cinder_wrapper.wrap(self._clients.cinder, self)
snapshot = client.create_snapshot(volume_id, **kwargs)
self.sleep_between(CONF.benchmark.cinder_volume_create_prepoll_delay,
CONF.benchmark.cinder_volume_create_prepoll_delay)
self.sleep_between(CONF.benchmark.cinder_volume_create_prepoll_delay)
snapshot = bench_utils.wait_for(
snapshot,
ready_statuses=["available"],

View File

@ -75,10 +75,7 @@ class EC2Scenario(scenario.OpenStackScenario):
**kwargs)
servers = [instance for instance in reservation.instances]
self.sleep_between(CONF.benchmark.
ec2_server_boot_prepoll_delay,
CONF.benchmark.
ec2_server_boot_prepoll_delay)
self.sleep_between(CONF.benchmark.ec2_server_boot_prepoll_delay)
servers = [utils.wait_for(
server,
ready_statuses=["RUNNING"],

View File

@ -142,8 +142,7 @@ class HeatScenario(scenario.OpenStackScenario):
stack_id = self.clients("heat").stacks.create(**kw)["stack"]["id"]
stack = self.clients("heat").stacks.get(stack_id)
self.sleep_between(CONF.benchmark.heat_stack_create_prepoll_delay,
CONF.benchmark.heat_stack_create_prepoll_delay)
self.sleep_between(CONF.benchmark.heat_stack_create_prepoll_delay)
stack = utils.wait_for(
stack,
@ -179,8 +178,7 @@ class HeatScenario(scenario.OpenStackScenario):
}
self.clients("heat").stacks.update(stack.id, **kw)
self.sleep_between(CONF.benchmark.heat_stack_update_prepoll_delay,
CONF.benchmark.heat_stack_update_prepoll_delay)
self.sleep_between(CONF.benchmark.heat_stack_update_prepoll_delay)
stack = utils.wait_for(
stack,

View File

@ -86,10 +86,7 @@ class ManilaScenario(scenario.OpenStackScenario):
share = self.clients("manila").shares.create(
share_proto, size, **kwargs)
self.sleep_between(CONF.benchmark.
manila_share_create_prepoll_delay,
CONF.benchmark.
manila_share_create_prepoll_delay)
self.sleep_between(CONF.benchmark.manila_share_create_prepoll_delay)
share = utils.wait_for(
share,
ready_statuses=["available"],

View File

@ -138,8 +138,7 @@ class NovaScenario(scenario.OpenStackScenario):
server = self.clients("nova").servers.create(
server_name, image_id, flavor_id, **kwargs)
self.sleep_between(CONF.benchmark.nova_server_boot_prepoll_delay,
CONF.benchmark.nova_server_boot_prepoll_delay)
self.sleep_between(CONF.benchmark.nova_server_boot_prepoll_delay)
server = utils.wait_for(
server,
ready_statuses=["ACTIVE"],
@ -151,8 +150,7 @@ class NovaScenario(scenario.OpenStackScenario):
def _do_server_reboot(self, server, reboottype):
server.reboot(reboot_type=reboottype)
self.sleep_between(CONF.benchmark.nova_server_pause_prepoll_delay,
CONF.benchmark.nova_server_pause_prepoll_delay)
self.sleep_between(CONF.benchmark.nova_server_pause_prepoll_delay)
utils.wait_for(
server,
ready_statuses=["ACTIVE"],
@ -214,8 +212,7 @@ class NovaScenario(scenario.OpenStackScenario):
:param kwargs: Optional additional arguments to pass to the rebuild
"""
server.rebuild(image, **kwargs)
self.sleep_between(CONF.benchmark.nova_server_rebuild_prepoll_delay,
CONF.benchmark.nova_server_rebuild_prepoll_delay)
self.sleep_between(CONF.benchmark.nova_server_rebuild_prepoll_delay)
utils.wait_for(
server,
ready_statuses=["ACTIVE"],
@ -270,8 +267,7 @@ class NovaScenario(scenario.OpenStackScenario):
:param server: Server object
"""
server.rescue()
self.sleep_between(CONF.benchmark.nova_server_rescue_prepoll_delay,
CONF.benchmark.nova_server_rescue_prepoll_delay)
self.sleep_between(CONF.benchmark.nova_server_rescue_prepoll_delay)
utils.wait_for(
server,
ready_statuses=["RESCUE"],
@ -289,8 +285,7 @@ class NovaScenario(scenario.OpenStackScenario):
:param server: Server object
"""
server.unrescue()
self.sleep_between(CONF.benchmark.nova_server_unrescue_prepoll_delay,
CONF.benchmark.nova_server_unrescue_prepoll_delay)
self.sleep_between(CONF.benchmark.nova_server_unrescue_prepoll_delay)
utils.wait_for(
server,
ready_statuses=["ACTIVE"],
@ -309,8 +304,7 @@ class NovaScenario(scenario.OpenStackScenario):
:param server: Server object
"""
server.suspend()
self.sleep_between(CONF.benchmark.nova_server_suspend_prepoll_delay,
CONF.benchmark.nova_server_suspend_prepoll_delay)
self.sleep_between(CONF.benchmark.nova_server_suspend_prepoll_delay)
utils.wait_for(
server,
ready_statuses=["SUSPENDED"],
@ -329,8 +323,7 @@ class NovaScenario(scenario.OpenStackScenario):
:param server: Server object
"""
server.resume()
self.sleep_between(CONF.benchmark.nova_server_resume_prepoll_delay,
CONF.benchmark.nova_server_resume_prepoll_delay)
self.sleep_between(CONF.benchmark.nova_server_resume_prepoll_delay)
utils.wait_for(
server,
ready_statuses=["ACTIVE"],
@ -349,8 +342,7 @@ class NovaScenario(scenario.OpenStackScenario):
:param server: Server object
"""
server.pause()
self.sleep_between(CONF.benchmark.nova_server_pause_prepoll_delay,
CONF.benchmark.nova_server_pause_prepoll_delay)
self.sleep_between(CONF.benchmark.nova_server_pause_prepoll_delay)
utils.wait_for(
server,
ready_statuses=["PAUSED"],
@ -369,8 +361,7 @@ class NovaScenario(scenario.OpenStackScenario):
:param server: Server object
"""
server.unpause()
self.sleep_between(CONF.benchmark.nova_server_pause_prepoll_delay,
CONF.benchmark.nova_server_pause_prepoll_delay)
self.sleep_between(CONF.benchmark.nova_server_pause_prepoll_delay)
utils.wait_for(
server,
ready_statuses=["ACTIVE"],
@ -389,8 +380,7 @@ class NovaScenario(scenario.OpenStackScenario):
:param server: Server object
"""
server.shelve()
self.sleep_between(CONF.benchmark.nova_server_pause_prepoll_delay,
CONF.benchmark.nova_server_pause_prepoll_delay)
self.sleep_between(CONF.benchmark.nova_server_pause_prepoll_delay)
utils.wait_for(
server,
ready_statuses=["SHELVED_OFFLOADED"],
@ -409,8 +399,7 @@ class NovaScenario(scenario.OpenStackScenario):
"""
server.unshelve()
self.sleep_between(CONF.benchmark. nova_server_unshelve_prepoll_delay,
CONF.benchmark. nova_server_unshelve_prepoll_delay)
self.sleep_between(CONF.benchmark. nova_server_unshelve_prepoll_delay)
utils.wait_for(
server,
ready_statuses=["ACTIVE"],
@ -581,8 +570,7 @@ class NovaScenario(scenario.OpenStackScenario):
# created servers manually.
servers = [s for s in self.clients("nova").servers.list()
if s.name.startswith(name_prefix)]
self.sleep_between(CONF.benchmark.nova_server_boot_prepoll_delay,
CONF.benchmark.nova_server_boot_prepoll_delay)
self.sleep_between(CONF.benchmark.nova_server_boot_prepoll_delay)
servers = [utils.wait_for(
server,
ready_statuses=["ACTIVE"],