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) # Server boot poll interval (floating point value)
#ec2_server_boot_poll_interval = 1.0 #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] [database]

View File

@ -17,6 +17,7 @@ import subprocess
import sys import sys
import netaddr import netaddr
from oslo_config import cfg
import six import six
from rally.common.i18n import _ from rally.common.i18n import _
@ -33,6 +34,17 @@ LOG = logging.getLogger(__name__)
ICMP_UP_STATUS = "ICMP UP" ICMP_UP_STATUS = "ICMP UP"
ICMP_DOWN_STATUS = "ICMP DOWN" 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): class VMScenario(scenario.OpenStackScenario):
"""Base class for VM scenarios with basic atomic actions. """Base class for VM scenarios with basic atomic actions.
@ -148,9 +160,9 @@ class VMScenario(scenario.OpenStackScenario):
server_ip = netaddr.IPAddress(server_ip) server_ip = netaddr.IPAddress(server_ip)
utils.wait_for( utils.wait_for(
server_ip, server_ip,
is_ready=utils.resource_is(ICMP_UP_STATUS, is_ready=utils.resource_is(ICMP_UP_STATUS, self._ping_ip_address),
self._ping_ip_address), timeout=CONF.benchmark.vm_ping_timeout,
timeout=120 check_interval=CONF.benchmark.vm_ping_poll_interval
) )
def _run_command(self, server_ip, port, username, password, command, def _run_command(self, server_ip, port, username, password, command,

View File

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