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)
|
# 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]
|
||||||
|
|
||||||
|
@ -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 _
|
||||||
@ -32,6 +33,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(base.Scenario):
|
class VMScenario(base.Scenario):
|
||||||
"""Base class for VM scenarios with basic atomic actions.
|
"""Base class for VM scenarios with basic atomic actions.
|
||||||
@ -131,9 +143,9 @@ class VMScenario(base.Scenario):
|
|||||||
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,
|
||||||
|
@ -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):
|
||||||
@ -92,7 +94,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)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user