Merge "VMTasks: Make waiting for ping timing configurable"

This commit is contained in:
Jenkins 2015-07-22 15:11:09 +00:00 committed by Gerrit Code Review
commit bb9110ff98
3 changed files with 25 additions and 4 deletions

View File

@ -486,6 +486,12 @@
# Server boot poll interval (floating point value)
#ec2_server_boot_poll_interval = 1.0
# Interval between checks when waiting for a VM to become pingable
#vm_ping_poll_interval = 1.0
# Time to wait for a VM to become pingable
#vm_ping_timeout = 120.0
[database]

View File

@ -17,6 +17,7 @@ import subprocess
import sys
import netaddr
from oslo_config import cfg
import six
from rally.common.i18n import _
@ -33,6 +34,17 @@ LOG = logging.getLogger(__name__)
ICMP_UP_STATUS = "ICMP UP"
ICMP_DOWN_STATUS = "ICMP DOWN"
VM_BENCHMARK_OPTS = [
cfg.FloatOpt("vm_ping_poll_interval", default=1.0,
help="Interval between checks when waiting for a VM to "
"become pingable"),
cfg.FloatOpt("vm_ping_timeout", default=120.0,
help="Time to wait for a VM to become pingable")]
CONF = cfg.CONF
benchmark_group = cfg.OptGroup(name="benchmark", title="benchmark options")
CONF.register_opts(VM_BENCHMARK_OPTS, group=benchmark_group)
class VMScenario(scenario.OpenStackScenario):
"""Base class for VM scenarios with basic atomic actions.
@ -148,9 +160,9 @@ class VMScenario(scenario.OpenStackScenario):
server_ip = netaddr.IPAddress(server_ip)
utils.wait_for(
server_ip,
is_ready=utils.resource_is(ICMP_UP_STATUS,
self._ping_ip_address),
timeout=120
is_ready=utils.resource_is(ICMP_UP_STATUS, self._ping_ip_address),
timeout=CONF.benchmark.vm_ping_timeout,
check_interval=CONF.benchmark.vm_ping_poll_interval
)
def _run_command(self, server_ip, port, username, password, command,

View File

@ -18,11 +18,13 @@ import subprocess
import mock
import netaddr
from oslo_config import cfg
from rally.plugins.openstack.scenarios.vm import utils
from tests.unit import test
VMTASKS_UTILS = "rally.plugins.openstack.scenarios.vm.utils"
CONF = cfg.CONF
class VMScenarioTestCase(test.ScenarioTestCase):
@ -113,7 +115,8 @@ class VMScenarioTestCase(test.ScenarioTestCase):
self.mock_wait_for.mock.assert_called_once_with(
netaddr.IPAddress("1.2.3.4"),
is_ready=self.mock_resource_is.mock.return_value,
timeout=120)
timeout=CONF.benchmark.vm_ping_timeout,
check_interval=CONF.benchmark.vm_ping_poll_interval)
self.mock_resource_is.mock.assert_called_once_with(
"ICMP UP", vm_scenario._ping_ip_address)