diff --git a/rally-jobs/nova.yaml b/rally-jobs/nova.yaml index 6419626f..ad0d43e2 100644 --- a/rally-jobs/nova.yaml +++ b/rally-jobs/nova.yaml @@ -876,3 +876,45 @@ sla: failure_rate: max: 0 + + NovaAgents.list_agents: + - + runner: + type: "constant" + concurrency: 2 + times: 5 + sla: + failure_rate: + max: 0 + + NovaAggregates.list_aggregates: + - + runner: + type: "constant" + concurrency: 2 + times : 5 + sla: + failure_rate: + max: 0 + + NovaAvailabilityZones.list_availability_zones: + - + args: + detailed: true + runner: + type: "constant" + concurrency: 2 + times: 5 + sla: + failure_rate: + max: 0 + + NovaHosts.list_hosts: + - + runner: + type: "constant" + concurrency: 2 + times: 5 + sla: + failure_rate: + max: 0 diff --git a/rally/plugins/openstack/scenarios/nova/agents.py b/rally/plugins/openstack/scenarios/nova/agents.py new file mode 100644 index 00000000..d1946a65 --- /dev/null +++ b/rally/plugins/openstack/scenarios/nova/agents.py @@ -0,0 +1,41 @@ +# Copyright 2016 IBM Corp. +# 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.common import logging +from rally import consts +from rally.plugins.openstack import scenario +from rally.plugins.openstack.scenarios.nova import utils +from rally.task import validation + + +LOG = logging.getLogger(__name__) + + +class NovaAgents(utils.NovaScenario): + """Benchmark scenarios for Nova agents.""" + + @validation.required_services(consts.Service.NOVA) + @validation.required_openstack(admin=True) + @scenario.configure() + def list_agents(self, hypervisor=None): + """List all builds. + + Measure the "nova agent-list" command performance. + + :param hypervisor: List agent builds on a specific hypervisor. + None (default value) means list for all + hypervisors + """ + self._list_agents(hypervisor) diff --git a/rally/plugins/openstack/scenarios/nova/aggregates.py b/rally/plugins/openstack/scenarios/nova/aggregates.py new file mode 100644 index 00000000..c0000b38 --- /dev/null +++ b/rally/plugins/openstack/scenarios/nova/aggregates.py @@ -0,0 +1,37 @@ +# Copyright 2016 IBM Corp. +# 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.common import logging +from rally import consts +from rally.plugins.openstack import scenario +from rally.plugins.openstack.scenarios.nova import utils +from rally.task import validation + + +LOG = logging.getLogger(__name__) + + +class NovaAggregates(utils.NovaScenario): + """Benchmark scenarios for Nova aggregates.""" + + @validation.required_services(consts.Service.NOVA) + @validation.required_openstack(admin=True) + @scenario.configure() + def list_aggregates(self): + """List all nova aggregates. + + Measure the "nova aggregate-list" command performance. + """ + self._list_aggregates() diff --git a/rally/plugins/openstack/scenarios/nova/availability_zones.py b/rally/plugins/openstack/scenarios/nova/availability_zones.py new file mode 100644 index 00000000..80d46be2 --- /dev/null +++ b/rally/plugins/openstack/scenarios/nova/availability_zones.py @@ -0,0 +1,40 @@ +# Copyright 2016 IBM Corp. +# 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.common import logging +from rally import consts +from rally.plugins.openstack import scenario +from rally.plugins.openstack.scenarios.nova import utils +from rally.task import validation + + +LOG = logging.getLogger(__name__) + + +class NovaAvailabilityZones(utils.NovaScenario): + """Benchmark scenarios for Nova availability-zones.""" + + @validation.required_services(consts.Service.NOVA) + @validation.required_openstack(admin=True) + @scenario.configure() + def list_availability_zones(self, detailed=True): + """List all availability zones. + + Measure the "nova availability-zone-list" command performance. + + :param detailed: True if the availability-zone listing should contain + detailed information about all of them + """ + self._list_availability_zones(detailed) diff --git a/rally/plugins/openstack/scenarios/nova/hosts.py b/rally/plugins/openstack/scenarios/nova/hosts.py new file mode 100644 index 00000000..7114fb1a --- /dev/null +++ b/rally/plugins/openstack/scenarios/nova/hosts.py @@ -0,0 +1,41 @@ +# Copyright 2016 IBM Corp +# 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.common import logging +from rally import consts +from rally.plugins.openstack import scenario +from rally.plugins.openstack.scenarios.nova import utils +from rally.task import validation + + +LOG = logging.getLogger(__name__) + + +class NovaHosts(utils.NovaScenario): + """Benchmark scenarios for Nova hosts.""" + + @validation.required_services(consts.Service.NOVA) + @validation.required_openstack(admin=True) + @scenario.configure() + def list_hosts(self, zone=None): + """List all nova hosts. + + Measure the "nova host-list" command performance. + + :param zone: List nova hosts in an availibility-zone. + None (default value) means list hosts in all + availibility-zones + """ + self._list_hosts(zone) diff --git a/rally/plugins/openstack/scenarios/nova/utils.py b/rally/plugins/openstack/scenarios/nova/utils.py index 28eb017d..afa4261e 100644 --- a/rally/plugins/openstack/scenarios/nova/utils.py +++ b/rally/plugins/openstack/scenarios/nova/utils.py @@ -903,3 +903,37 @@ class NovaScenario(scenario.OpenStackScenario): :returns: flavors list """ return self.clients("nova").flavors.list(detailed, **kwargs) + + @atomic.action_timer("nova.list_agents") + def _list_agents(self, hypervisor=None): + """List all nova-agent builds. + + :param hypervisor: The nova-hypervisor ID on which we need to list all + the builds + :returns: Nova-agent build list + """ + return self.admin_clients("nova").agents.list(hypervisor) + + @atomic.action_timer("nova.list_aggregates") + def _list_aggregates(self): + """Returns list of all os-aggregates.""" + return self.admin_clients("nova").aggregates.list() + + @atomic.action_timer("nova.list_availbility_zones") + def _list_availability_zones(self, detailed=True): + """List availability-zones. + + :param detailed: True if the availability-zone listing should contain + detailed information + :returns: Availability-zone list + """ + return self.admin_clients("nova").availability_zones.list(detailed) + + @atomic.action_timer("nova.list_hosts") + def _list_hosts(self, zone=None): + """List nova hosts. + + :param zone: List all hosts in the given nova availability-zone ID + :returns: Nova host list + """ + return self.admin_clients("nova").hosts.list(zone) diff --git a/samples/tasks/scenarios/nova/list-agents.json b/samples/tasks/scenarios/nova/list-agents.json new file mode 100644 index 00000000..c724e8ae --- /dev/null +++ b/samples/tasks/scenarios/nova/list-agents.json @@ -0,0 +1,11 @@ +{ + "NovaAgents.list_agents": [ + { + "runner": { + "type": "constant", + "concurrency": 2, + "times": 10 + } + } + ] +} diff --git a/samples/tasks/scenarios/nova/list-agents.yaml b/samples/tasks/scenarios/nova/list-agents.yaml new file mode 100644 index 00000000..31680d78 --- /dev/null +++ b/samples/tasks/scenarios/nova/list-agents.yaml @@ -0,0 +1,7 @@ +--- + NovaAgents.list_agents: + - + runner: + type: "constant" + concurrency: 2 + times: 10 diff --git a/samples/tasks/scenarios/nova/list-aggregates.json b/samples/tasks/scenarios/nova/list-aggregates.json new file mode 100644 index 00000000..a0125145 --- /dev/null +++ b/samples/tasks/scenarios/nova/list-aggregates.json @@ -0,0 +1,11 @@ +{ + "NovaAggregates.list_aggregates": [ + { + "runner": { + "type": "constant", + "concurrency": 2, + "times": 10 + } + } + ] +} diff --git a/samples/tasks/scenarios/nova/list-aggregates.yaml b/samples/tasks/scenarios/nova/list-aggregates.yaml new file mode 100644 index 00000000..8f3f45f8 --- /dev/null +++ b/samples/tasks/scenarios/nova/list-aggregates.yaml @@ -0,0 +1,7 @@ +--- + NovaAggregates.list_aggregates: + - + runner: + type: "constant" + concurrency: 2 + times : 10 diff --git a/samples/tasks/scenarios/nova/list-availability-zones.json b/samples/tasks/scenarios/nova/list-availability-zones.json new file mode 100644 index 00000000..a9fd1b78 --- /dev/null +++ b/samples/tasks/scenarios/nova/list-availability-zones.json @@ -0,0 +1,14 @@ +{ + "NovaAvailabilityZones.list_availability_zones": [ + { + "runner": { + "type": "constant", + "concurrency": 2, + "times": 10 + }, + "args": { + "detailed": true + } + } + ] +} diff --git a/samples/tasks/scenarios/nova/list-availability-zones.yaml b/samples/tasks/scenarios/nova/list-availability-zones.yaml new file mode 100644 index 00000000..50f6376a --- /dev/null +++ b/samples/tasks/scenarios/nova/list-availability-zones.yaml @@ -0,0 +1,9 @@ +--- + NovaAvailabilityZones.list_availability_zones: + - + args: + detailed: true + runner: + type: "constant" + concurrency: 2 + times: 10 diff --git a/samples/tasks/scenarios/nova/list-hosts.json b/samples/tasks/scenarios/nova/list-hosts.json new file mode 100644 index 00000000..a02de4a5 --- /dev/null +++ b/samples/tasks/scenarios/nova/list-hosts.json @@ -0,0 +1,11 @@ +{ + "NovaHosts.list_hosts": [ + { + "runner": { + "type": "constant", + "concurrency": 2, + "times": 10 + } + } + ] +} diff --git a/samples/tasks/scenarios/nova/list-hosts.yaml b/samples/tasks/scenarios/nova/list-hosts.yaml new file mode 100644 index 00000000..b442f07f --- /dev/null +++ b/samples/tasks/scenarios/nova/list-hosts.yaml @@ -0,0 +1,7 @@ +--- + NovaHosts.list_hosts: + - + runner: + type: "constant" + concurrency: 2 + times: 10 diff --git a/tests/unit/plugins/openstack/scenarios/nova/test_agents.py b/tests/unit/plugins/openstack/scenarios/nova/test_agents.py new file mode 100644 index 00000000..733f6d92 --- /dev/null +++ b/tests/unit/plugins/openstack/scenarios/nova/test_agents.py @@ -0,0 +1,28 @@ +# Copyright 2016 IBM Corp. +# 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.plugins.openstack.scenarios.nova import agents +from tests.unit import test + + +class NovaAgentsTestCase(test.TestCase): + + def test_list_agents(self): + scenario = agents.NovaAgents() + scenario._list_agents = mock.Mock() + scenario.list_agents(hypervisor=None) + scenario._list_agents.assert_called_once_with(None) diff --git a/tests/unit/plugins/openstack/scenarios/nova/test_aggregates.py b/tests/unit/plugins/openstack/scenarios/nova/test_aggregates.py new file mode 100644 index 00000000..5b2e4ca7 --- /dev/null +++ b/tests/unit/plugins/openstack/scenarios/nova/test_aggregates.py @@ -0,0 +1,28 @@ +# Copyright 2016 IBM Corp. +# 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.plugins.openstack.scenarios.nova import aggregates +from tests.unit import test + + +class NovaAggregatesTestCase(test.TestCase): + + def test_list_aggregates(self): + scenario = aggregates.NovaAggregates() + scenario._list_aggregates = mock.Mock() + scenario.list_aggregates() + scenario._list_aggregates.assert_called_once_with() diff --git a/tests/unit/plugins/openstack/scenarios/nova/test_availability_zones.py b/tests/unit/plugins/openstack/scenarios/nova/test_availability_zones.py new file mode 100644 index 00000000..d3132316 --- /dev/null +++ b/tests/unit/plugins/openstack/scenarios/nova/test_availability_zones.py @@ -0,0 +1,28 @@ +# Copyright 2016 IBM Corp. +# 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.plugins.openstack.scenarios.nova import availability_zones +from tests.unit import test + + +class NovaAvailabilityZonesTestCase(test.TestCase): + + def test_list_availability_zones(self): + scenario = availability_zones.NovaAvailabilityZones() + scenario._list_availability_zones = mock.Mock() + scenario.list_availability_zones(detailed=False) + scenario._list_availability_zones.assert_called_once_with(False) diff --git a/tests/unit/plugins/openstack/scenarios/nova/test_hosts.py b/tests/unit/plugins/openstack/scenarios/nova/test_hosts.py new file mode 100644 index 00000000..82dadb55 --- /dev/null +++ b/tests/unit/plugins/openstack/scenarios/nova/test_hosts.py @@ -0,0 +1,28 @@ +# Copyright 2016 IBM Corp. +# 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.plugins.openstack.scenarios.nova import hosts +from tests.unit import test + + +class NovaHostsTestCase(test.TestCase): + + def test_list_hosts(self): + scenario = hosts.NovaHosts() + scenario._list_hosts = mock.Mock() + scenario.list_hosts(zone=None) + scenario._list_hosts.assert_called_once_with(None) diff --git a/tests/unit/plugins/openstack/scenarios/nova/test_utils.py b/tests/unit/plugins/openstack/scenarios/nova/test_utils.py index 551b2b57..75d65141 100644 --- a/tests/unit/plugins/openstack/scenarios/nova/test_utils.py +++ b/tests/unit/plugins/openstack/scenarios/nova/test_utils.py @@ -875,3 +875,50 @@ class NovaScenarioTestCase(test.ScenarioTestCase): True, fakearg="fakearg") self._test_atomic_action_timer(nova_scenario.atomic_actions(), "nova.list_flavors") + + @ddt.data({}, + {"hypervisor": "foo_hypervisor"}) + @ddt.unpack + def test__list_agents(self, hypervisor=None): + nova_scenario = utils.NovaScenario() + self.admin_clients("nova").agents.list.return_value = "agents_list" + result = nova_scenario._list_agents(hypervisor) + self.assertEqual("agents_list", result) + self.admin_clients("nova").agents.list.assert_called_once_with( + hypervisor) + self._test_atomic_action_timer(nova_scenario.atomic_actions(), + "nova.list_agents") + + def test__list_aggregates(self): + nova_scenario = utils.NovaScenario() + self.admin_clients("nova").aggregates.list.return_value = ( + "aggregates_list") + result = nova_scenario._list_aggregates() + self.assertEqual("aggregates_list", result) + self.admin_clients("nova").aggregates.list.assert_called_once_with() + self._test_atomic_action_timer(nova_scenario.atomic_actions(), + "nova.list_aggregates") + + def test__list_availability_zones(self): + nova_scenario = utils.NovaScenario() + self.admin_clients("nova").availability_zones.list.return_value = ( + "availability_zones_list") + result = nova_scenario._list_availability_zones(detailed=True) + self.assertEqual("availability_zones_list", result) + nova_admin_client = self.admin_clients("nova") + availability_zones_client = nova_admin_client.availability_zones + availability_zones_client.list.assert_called_once_with(True) + self._test_atomic_action_timer(nova_scenario.atomic_actions(), + "nova.list_availbility_zones") + + @ddt.data({}, + {"zone": "foo_zone"}) + @ddt.unpack + def test__list_hosts(self, zone=None): + nova_scenario = utils.NovaScenario() + self.admin_clients("nova").hosts.list.return_value = "hosts_list" + result = nova_scenario._list_hosts(zone) + self.assertEqual("hosts_list", result) + self.admin_clients("nova").hosts.list.assert_called_once_with(zone) + self._test_atomic_action_timer(nova_scenario.atomic_actions(), + "nova.list_hosts")