From 1efddbd5ba713d21839a9ccecb0afedebb7aded0 Mon Sep 17 00:00:00 2001 From: Andrey Kurilin Date: Sun, 4 Mar 2018 20:48:45 +0200 Subject: [PATCH] [openstack] Remove nova hosts specific logic os-hosts CLIs and python API bindings had been deprecated from python-novaclient 9.0.0 and finally became removed in 10.0.0 release. The related scenarios become redundant. We cannot launch then in gates and it is impossible to ensure that they work even with old novaclient release. Since it is not something critical and what is called regulary in old OpenStack environments we should not provide any workaround and can just remove the os-hosts logic from Rally. [*] https://github.com/openstack/python-novaclient/blob/master/releasenotes/notes/remove-hosts-d08855550c40b9c6.yaml Change-Id: I915983dbc634dafcab1cc54dba7bae8d4e368884 --- rally-jobs/nova.yaml | 20 ------- rally_openstack/scenarios/nova/hosts.py | 60 ------------------- rally_openstack/scenarios/nova/utils.py | 22 ------- .../scenarios/nova/list-and-get-hosts.json | 22 ------- .../scenarios/nova/list-and-get-hosts.yaml | 14 ----- samples/tasks/scenarios/nova/list-hosts.json | 16 ----- samples/tasks/scenarios/nova/list-hosts.yaml | 10 ---- tests/ci/osresources.py | 3 - tests/unit/scenarios/nova/test_hosts.py | 41 ------------- tests/unit/scenarios/nova/test_utils.py | 31 ---------- 10 files changed, 239 deletions(-) delete mode 100644 rally_openstack/scenarios/nova/hosts.py delete mode 100644 samples/tasks/scenarios/nova/list-and-get-hosts.json delete mode 100644 samples/tasks/scenarios/nova/list-and-get-hosts.yaml delete mode 100644 samples/tasks/scenarios/nova/list-hosts.json delete mode 100644 samples/tasks/scenarios/nova/list-hosts.yaml delete mode 100644 tests/unit/scenarios/nova/test_hosts.py diff --git a/rally-jobs/nova.yaml b/rally-jobs/nova.yaml index 23e0b189..cb7ce151 100755 --- a/rally-jobs/nova.yaml +++ b/rally-jobs/nova.yaml @@ -924,26 +924,6 @@ constant: concurrency: 2 times: 4 - - - title: NovaHosts.list_hosts tests - scenario: - NovaHosts.list_hosts: {} - runner: - constant: - concurrency: 2 - times: 4 - - - title: NovaHosts.list_and_get_hosts tests - scenario: - NovaHosts.list_and_get_hosts: {} - runner: - constant: - concurrency: 2 - times: 4 - contexts: - users: - tenants: 2 - users_per_tenant: 2 - title: NovaServices.list_services tests scenario: diff --git a/rally_openstack/scenarios/nova/hosts.py b/rally_openstack/scenarios/nova/hosts.py deleted file mode 100644 index 2365b176..00000000 --- a/rally_openstack/scenarios/nova/hosts.py +++ /dev/null @@ -1,60 +0,0 @@ -# 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 import consts -from rally.task import validation - -from rally_openstack import scenario -from rally_openstack.scenarios.nova import utils - - -"""Scenarios for Nova hosts.""" - - -@validation.add("required_services", services=[consts.Service.NOVA]) -@validation.add("required_platform", platform="openstack", admin=True) -@scenario.configure(name="NovaHosts.list_hosts", platform="openstack") -class ListHosts(utils.NovaScenario): - - def run(self, zone=None): - """List all nova hosts. - - Measure the "nova host-list" command performance. - - :param zone: List nova hosts in an availability-zone. - None (default value) means list hosts in all - availability-zones - """ - self._list_hosts(zone) - - -@validation.add("required_services", services=[consts.Service.NOVA]) -@validation.add("required_platform", platform="openstack", admin=True) -@scenario.configure(name="NovaHosts.list_and_get_hosts", platform="openstack") -class ListAndGetHosts(utils.NovaScenario): - - def run(self, zone=None): - """List all nova hosts, and get detailed information for compute hosts. - - Measure the "nova host-describe" command performance. - - :param zone: List nova hosts in an availability-zone. - None (default value) means list hosts in all - availability-zones - """ - hosts = self._list_hosts(zone, service="compute") - - for host in hosts: - self._get_host(host.host_name) diff --git a/rally_openstack/scenarios/nova/utils.py b/rally_openstack/scenarios/nova/utils.py index 8aab188b..8d81f42c 100644 --- a/rally_openstack/scenarios/nova/utils.py +++ b/rally_openstack/scenarios/nova/utils.py @@ -916,19 +916,6 @@ class NovaScenario(scenario.OpenStackScenario): """ return self.admin_clients("nova").availability_zones.list(detailed) - @atomic.action_timer("nova.list_hosts") - def _list_hosts(self, zone=None, service=None): - """List nova hosts. - - :param zone: List all hosts in the given nova availability-zone ID - :param service: Name of service type to filter - :returns: Nova host list - """ - hosts = self.admin_clients("nova").hosts.list(zone) - if service: - hosts = [host for host in hosts if host.service == service] - return hosts - @atomic.action_timer("nova.list_interfaces") def _list_interfaces(self, server): """List interfaces attached to a server. @@ -938,15 +925,6 @@ class NovaScenario(scenario.OpenStackScenario): """ return self.clients("nova").servers.interface_list(server) - @atomic.action_timer("nova.get_host") - def _get_host(self, host_name): - """Describe a specific host. - - :param host_name: host name to get. - :returns: host object - """ - return self.admin_clients("nova").hosts.get(host_name) - @atomic.action_timer("nova.list_services") def _list_services(self, host=None, binary=None): """return all nova service details diff --git a/samples/tasks/scenarios/nova/list-and-get-hosts.json b/samples/tasks/scenarios/nova/list-and-get-hosts.json deleted file mode 100644 index 32673c9d..00000000 --- a/samples/tasks/scenarios/nova/list-and-get-hosts.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "NovaHosts.list_and_get_hosts": [ - { - "runner": { - "type": "constant", - "concurrency": 2, - "times": 10 - }, - "context": { - "users": { - "tenants": 2, - "users_per_tenant": 2 - } - }, - "sla": { - "failure_rate": { - "max": 0 - } - } - } - ] -} diff --git a/samples/tasks/scenarios/nova/list-and-get-hosts.yaml b/samples/tasks/scenarios/nova/list-and-get-hosts.yaml deleted file mode 100644 index 9319052a..00000000 --- a/samples/tasks/scenarios/nova/list-and-get-hosts.yaml +++ /dev/null @@ -1,14 +0,0 @@ ---- - NovaHosts.list_and_get_hosts: - - - runner: - type: "constant" - concurrency: 2 - times: 10 - context: - users: - tenants: 2 - users_per_tenant: 2 - sla: - failure_rate: - max: 0 diff --git a/samples/tasks/scenarios/nova/list-hosts.json b/samples/tasks/scenarios/nova/list-hosts.json deleted file mode 100644 index 62a75fc5..00000000 --- a/samples/tasks/scenarios/nova/list-hosts.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "NovaHosts.list_hosts": [ - { - "runner": { - "type": "constant", - "concurrency": 2, - "times": 10 - }, - "sla": { - "failure_rate": { - "max": 0 - } - } - } - ] -} diff --git a/samples/tasks/scenarios/nova/list-hosts.yaml b/samples/tasks/scenarios/nova/list-hosts.yaml deleted file mode 100644 index be7959ee..00000000 --- a/samples/tasks/scenarios/nova/list-hosts.yaml +++ /dev/null @@ -1,10 +0,0 @@ ---- - NovaHosts.list_hosts: - - - runner: - type: "constant" - concurrency: 2 - times: 10 - sla: - failure_rate: - max: 0 diff --git a/tests/ci/osresources.py b/tests/ci/osresources.py index fc590f13..ae9a96ba 100755 --- a/tests/ci/osresources.py +++ b/tests/ci/osresources.py @@ -168,9 +168,6 @@ class Nova(ResourceManager): def list_aggregates(self): return self.client.aggregates.list() - def list_hosts(self): - return self.client.hosts.list() - def list_hypervisors(self): return self.client.hypervisors.list() diff --git a/tests/unit/scenarios/nova/test_hosts.py b/tests/unit/scenarios/nova/test_hosts.py deleted file mode 100644 index b2965e5d..00000000 --- a/tests/unit/scenarios/nova/test_hosts.py +++ /dev/null @@ -1,41 +0,0 @@ -# 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_openstack.scenarios.nova import hosts -from tests.unit import test - - -class NovaHostsTestCase(test.TestCase): - - def test_list_hosts(self): - scenario = hosts.ListHosts() - scenario._list_hosts = mock.Mock() - scenario.run(zone=None) - scenario._list_hosts.assert_called_once_with(None) - - def test_list_and_get_hosts(self): - fake_hosts = [mock.Mock(host_name="fake_hostname")] - scenario = hosts.ListAndGetHosts() - scenario._list_hosts = mock.create_autospec(scenario._list_hosts, - return_value=fake_hosts) - scenario._get_host = mock.create_autospec(scenario._get_host, - "fake_hostname") - scenario.run(zone="nova") - - scenario._list_hosts.assert_called_once_with("nova", service="compute") - scenario._get_host.assert_called_once_with( - "fake_hostname") diff --git a/tests/unit/scenarios/nova/test_utils.py b/tests/unit/scenarios/nova/test_utils.py index 5a02ecc3..4211dc5d 100644 --- a/tests/unit/scenarios/nova/test_utils.py +++ b/tests/unit/scenarios/nova/test_utils.py @@ -836,17 +836,6 @@ class NovaScenarioTestCase(test.ScenarioTestCase): self._test_atomic_action_timer(nova_scenario.atomic_actions(), "nova.search_hypervisors") - def test__get_host(self): - nova_scenario = utils.NovaScenario() - result = nova_scenario._get_host("host_name") - self.assertEqual( - self.admin_clients("nova").hosts.get.return_value, - result) - self.admin_clients("nova").hosts.get.assert_called_once_with( - "host_name") - self._test_atomic_action_timer(nova_scenario.atomic_actions(), - "nova.get_host") - def test__list_interfaces(self): nova_scenario = utils.NovaScenario() result = nova_scenario._list_interfaces("server") @@ -948,26 +937,6 @@ class NovaScenarioTestCase(test.ScenarioTestCase): self._test_atomic_action_timer(nova_scenario.atomic_actions(), "nova.list_availability_zones") - @ddt.data({}, - {"zone": "foo_zone"}, - {"zone": "foo_zone", "service": "some"}) - @ddt.unpack - def test__list_hosts(self, zone=None, service=None): - - hosts = [mock.Mock(service="foo"), mock.Mock(service="some")] - - self.admin_clients("nova").hosts.list.return_value = hosts - nova_scenario = utils.NovaScenario() - - result = nova_scenario._list_hosts(zone, service=service) - - if service: - hosts = [h for h in hosts if h.service == service] - self.assertEqual(hosts, result) - self.admin_clients("nova").hosts.list.assert_called_once_with(zone) - self._test_atomic_action_timer(nova_scenario.atomic_actions(), - "nova.list_hosts") - @ddt.data({}, {"host": "foo_host"}, {"binary": "foo_binary"},