diff --git a/rally-jobs/rally.yaml b/rally-jobs/rally.yaml index e53520862f..ac5764fe55 100755 --- a/rally-jobs/rally.yaml +++ b/rally-jobs/rally.yaml @@ -1380,6 +1380,18 @@ failure_rate: max: 0 + NovaHypervisors.list_hypervisors: + - + args: + detailed: True + runner: + type: "constant" + times: 5 + concurrency: 2 + sla: + failure_rate: + max: 0 + VMTasks.boot_runcommand_delete: - args: diff --git a/rally/benchmark/scenarios/nova/hypervisors.py b/rally/benchmark/scenarios/nova/hypervisors.py new file mode 100644 index 0000000000..0a161e96a0 --- /dev/null +++ b/rally/benchmark/scenarios/nova/hypervisors.py @@ -0,0 +1,40 @@ +# Copyright 2015 Cisco Systems Inc. +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from rally.benchmark.scenarios import base +from rally.benchmark.scenarios.nova import utils +from rally.benchmark import validation +from rally.common import log as logging +from rally import consts + + +LOG = logging.getLogger(__name__) + + +class NovaHypervisors(utils.NovaScenario): + """Benchmark scenarios for Nova hypervisors.""" + + @validation.required_services(consts.Service.NOVA) + @validation.required_openstack(admin=True) + @base.scenario() + def list_hypervisors(self, detailed=True): + """List hypervisors. + + Measure the "nova hypervisor-list" command performance. + + :param detailed: True if the hypervisor listing should contain + detailed information about all of them + """ + self._list_hypervisors(detailed) diff --git a/rally/benchmark/scenarios/nova/utils.py b/rally/benchmark/scenarios/nova/utils.py index 2512edbe15..a3cf202b86 100644 --- a/rally/benchmark/scenarios/nova/utils.py +++ b/rally/benchmark/scenarios/nova/utils.py @@ -742,3 +742,8 @@ class NovaScenario(base.Scenario): def _delete_floating_ips_bulk(self, ip_range): """Delete floating IPs by range.""" return self.admin_clients("nova").floating_ips_bulk.delete(ip_range) + + @base.atomic_action_timer("nova.list_hypervisors") + def _list_hypervisors(self, detailed=True): + """List hypervisors.""" + return self.admin_clients("nova").hypervisors.list(detailed) diff --git a/samples/tasks/scenarios/nova/list-hypervisors.json b/samples/tasks/scenarios/nova/list-hypervisors.json new file mode 100644 index 0000000000..d4705f876d --- /dev/null +++ b/samples/tasks/scenarios/nova/list-hypervisors.json @@ -0,0 +1,14 @@ +{ + "NovaHypervisors.list_hypervisors": [ + { + "runner": { + "type": "constant", + "concurrency": 2, + "times": 10 + }, + "args": { + "detailed": true + } + } + ] +} \ No newline at end of file diff --git a/samples/tasks/scenarios/nova/list-hypervisors.yaml b/samples/tasks/scenarios/nova/list-hypervisors.yaml new file mode 100644 index 0000000000..746ce92b0e --- /dev/null +++ b/samples/tasks/scenarios/nova/list-hypervisors.yaml @@ -0,0 +1,9 @@ +--- + NovaHypervisors.list_hypervisors: + - + args: + detailed: True + runner: + type: "constant" + times: 10 + concurrency: 2 diff --git a/tests/unit/benchmark/scenarios/nova/test_hypervisors.py b/tests/unit/benchmark/scenarios/nova/test_hypervisors.py new file mode 100644 index 0000000000..7be1696472 --- /dev/null +++ b/tests/unit/benchmark/scenarios/nova/test_hypervisors.py @@ -0,0 +1,31 @@ +# Copyright 2013 Cisco Systems Inc. +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +import mock + +from rally.benchmark.scenarios.nova import hypervisors +from tests.unit import test + + +NOVA_HYPERVISORS_MODULE = "rally.benchmark.scenarios.nova.hypervisors" +NOVA_HYPERVISORS = NOVA_HYPERVISORS_MODULE + ".NovaHypervisors" + + +class NovaHypervisorsTestCase(test.TestCase): + def test_list_hypervisors(self): + scenario = hypervisors.NovaHypervisors() + scenario._list_hypervisors = mock.Mock() + scenario.list_hypervisors(detailed=False) + scenario._list_hypervisors.assert_called_once_with(False) diff --git a/tests/unit/benchmark/scenarios/nova/test_utils.py b/tests/unit/benchmark/scenarios/nova/test_utils.py index 8e8e5409d2..b167d2008c 100644 --- a/tests/unit/benchmark/scenarios/nova/test_utils.py +++ b/tests/unit/benchmark/scenarios/nova/test_utils.py @@ -749,3 +749,11 @@ class NovaScenarioTestCase(test.TestCase): fake_cidr) self._test_atomic_action_timer(nova_scenario.atomic_actions(), "nova.delete_floating_ips_bulk") + + @mock.patch(NOVA_UTILS + ".NovaScenario.admin_clients") + def test__list_hypervisors(self, mock_clients): + nova_scenario = utils.NovaScenario() + nova_scenario._list_hypervisors(detailed=False) + mock_clients("nova").hypervisors.list.assert_called_once_with(False) + self._test_atomic_action_timer(nova_scenario.atomic_actions(), + "nova.list_hypervisors")