VMTasks: Make waiting for ping timing configurable
Poll interval and timeout can now be set in rally.conf Closes-Bug: #1443035 Change-Id: Ia6d297f2fb8202ac7c00917b05a8db3480dcc5b6
This commit is contained in:
parent
434e8173fa
commit
1a2bf7168e
@ -479,6 +479,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]
|
||||
|
||||
|
@ -17,6 +17,7 @@ import subprocess
|
||||
import sys
|
||||
|
||||
import netaddr
|
||||
from oslo_config import cfg
|
||||
import six
|
||||
|
||||
from rally.common.i18n import _
|
||||
@ -32,6 +33,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(base.Scenario):
|
||||
"""Base class for VM scenarios with basic atomic actions.
|
||||
@ -131,9 +143,9 @@ class VMScenario(base.Scenario):
|
||||
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,
|
||||
|
@ -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):
|
||||
@ -92,7 +94,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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user