From 45442821d0864d89c78236af00abf6c8f0711053 Mon Sep 17 00:00:00 2001 From: Akihiro Motoki Date: Sun, 28 Jan 2018 02:19:44 +0900 Subject: [PATCH] Use nova os-services to retrieve host list novaclient version 10 has dropped the support for novaclient.v2.hosts. os-aggregates and migrateLive APIs expects host from os-services, so this commit retrieves host list from os-services API. Change-Id: I5ec007ab1f244ca8caee1eb7b5d4262ac6c32171 Closes-Bug: #1745502 --- openstack_dashboard/api/nova.py | 5 - .../dashboards/admin/aggregates/tests.py | 163 +++++++++--------- .../dashboards/admin/aggregates/workflows.py | 18 +- .../dashboards/admin/instances/forms.py | 6 +- .../dashboards/admin/instances/tests.py | 60 ++++--- .../dashboards/admin/instances/views.py | 4 +- .../test/test_data/nova_data.py | 35 +--- 7 files changed, 124 insertions(+), 167 deletions(-) diff --git a/openstack_dashboard/api/nova.py b/openstack_dashboard/api/nova.py index 002aa05fbe..25077847fe 100644 --- a/openstack_dashboard/api/nova.py +++ b/openstack_dashboard/api/nova.py @@ -994,11 +994,6 @@ def aggregate_set_metadata(request, aggregate_id, metadata): return novaclient(request).aggregates.set_metadata(aggregate_id, metadata) -@profiler.trace -def host_list(request): - return novaclient(request).hosts.list() - - @profiler.trace def add_host_to_aggregate(request, aggregate_id, host): return novaclient(request).aggregates.add_host(aggregate_id, host) diff --git a/openstack_dashboard/dashboards/admin/aggregates/tests.py b/openstack_dashboard/dashboards/admin/aggregates/tests.py index eba59240bb..af670e877e 100644 --- a/openstack_dashboard/dashboards/admin/aggregates/tests.py +++ b/openstack_dashboard/dashboards/admin/aggregates/tests.py @@ -30,39 +30,21 @@ class BaseAggregateWorkflowTests(test.BaseAdminViewTests): "availability_zone": aggregate.availability_zone} if hosts: - compute_hosts = [] - for host in hosts: - if host.service == 'compute': - compute_hosts.append(host) - host_field_name = 'add_host_to_aggregate_role_member' - aggregate_info[host_field_name] = \ - [h.host_name for h in compute_hosts] - - return aggregate_info - - def _get_manage_workflow_data(self, aggregate, hosts=None, ): - aggregate_info = {"id": aggregate.id} - - if hosts: - compute_hosts = [] - for host in hosts: - if host.service == 'compute': - compute_hosts.append(host) - - host_field_name = 'add_host_to_aggregate_role_member' - aggregate_info[host_field_name] = \ - [h.host_name for h in compute_hosts] + aggregate_info[host_field_name] = hosts return aggregate_info class CreateAggregateWorkflowTests(BaseAggregateWorkflowTests): - @test.create_stubs({api.nova: ('host_list', ), }) + @test.create_stubs({api.nova: ('service_list', ), }) def test_workflow_get(self): - api.nova.host_list(IsA(http.HttpRequest)).AndReturn(self.hosts.list()) + compute_services = [s for s in self.services.list() + if s.binary == 'nova-compute'] + api.nova.service_list(IsA(http.HttpRequest), binary='nova-compute') \ + .AndReturn(compute_services) self.mox.ReplayAll() url = reverse(constants.AGGREGATES_CREATE_URL) @@ -76,13 +58,16 @@ class CreateAggregateWorkflowTests(BaseAggregateWorkflowTests): ['', '']) - @test.create_stubs({api.nova: ('host_list', 'aggregate_details_list', + @test.create_stubs({api.nova: ('service_list', 'aggregate_details_list', 'aggregate_create'), }) def _test_generic_create_aggregate(self, workflow_data, aggregate, existing_aggregates=(), error_count=0, expected_error_message=None): - api.nova.host_list(IsA(http.HttpRequest)).AndReturn(self.hosts.list()) + compute_services = [s for s in self.services.list() + if s.binary == 'nova-compute'] + api.nova.service_list(IsA(http.HttpRequest), binary='nova-compute') \ + .AndReturn(compute_services) api.nova.aggregate_details_list(IsA(http.HttpRequest)) \ .AndReturn(existing_aggregates) if not expected_error_message: @@ -140,33 +125,32 @@ class CreateAggregateWorkflowTests(BaseAggregateWorkflowTests): existing_aggregates, 1, expected_error_message) - @test.create_stubs({api.nova: ('host_list', + @test.create_stubs({api.nova: ('service_list', 'aggregate_details_list', 'aggregate_create', 'add_host_to_aggregate'), }) def test_create_aggregate_with_hosts(self): aggregate = self.aggregates.first() - hosts = self.hosts.list() - api.nova.host_list(IsA(http.HttpRequest)).AndReturn(self.hosts.list()) + compute_services = [s for s in self.services.list() + if s.binary == 'nova-compute'] + compute_hosts = [s.host for s in compute_services] + api.nova.service_list(IsA(http.HttpRequest), binary='nova-compute') \ + .AndReturn(compute_services) api.nova.aggregate_details_list(IsA(http.HttpRequest)).AndReturn([]) - workflow_data = self._get_create_workflow_data(aggregate, hosts) + workflow_data = self._get_create_workflow_data(aggregate, + compute_hosts) api.nova.aggregate_create( IsA(http.HttpRequest), name=workflow_data['name'], availability_zone=workflow_data['availability_zone'], ).AndReturn(aggregate) - compute_hosts = [] - for host in hosts: - if host.service == 'compute': - compute_hosts.append(host) - for host in compute_hosts: api.nova.add_host_to_aggregate( IsA(http.HttpRequest), - aggregate.id, host.host_name).InAnyOrder() + aggregate.id, host).InAnyOrder() self.mox.ReplayAll() @@ -177,18 +161,13 @@ class CreateAggregateWorkflowTests(BaseAggregateWorkflowTests): self.assertRedirectsNoFollow(res, reverse(constants.AGGREGATES_INDEX_URL)) - @test.create_stubs({api.nova: ('host_list', 'aggregate_details_list', ), }) - def test_host_list_nova_compute(self): - - hosts = self.hosts.list() - compute_hosts = [] - - for host in hosts: - if host.service == 'compute': - compute_hosts.append(host) - - api.nova.host_list(IsA(http.HttpRequest)).AndReturn(self.hosts.list()) - + @test.create_stubs({api.nova: ('service_list', + 'aggregate_details_list', ), }) + def test_service_list_nova_compute(self): + compute_services = [s for s in self.services.list() + if s.binary == 'nova-compute'] + api.nova.service_list(IsA(http.HttpRequest), binary='nova-compute') \ + .AndReturn(compute_services) self.mox.ReplayAll() url = reverse(constants.AGGREGATES_CREATE_URL) @@ -197,7 +176,7 @@ class CreateAggregateWorkflowTests(BaseAggregateWorkflowTests): step = workflow.get_step("add_host_to_aggregate") field_name = step.get_member_field_name('member') self.assertEqual(len(step.action.fields[field_name].choices), - len(compute_hosts)) + len(compute_services)) class AggregatesViewTests(test.BaseAdminViewTests): @@ -273,14 +252,16 @@ class AggregatesViewTests(test.BaseAdminViewTests): class ManageHostsTests(test.BaseAdminViewTests): - @test.create_stubs({api.nova: ('aggregate_get', 'host_list')}) + @test.create_stubs({api.nova: ('aggregate_get', 'service_list')}) def test_manage_hosts(self): aggregate = self.aggregates.first() api.nova.aggregate_get(IsA(http.HttpRequest), str(aggregate.id)) \ .AndReturn(aggregate) - api.nova.host_list(IsA(http.HttpRequest)) \ - .AndReturn(self.hosts.list()) + compute_services = [s for s in self.services.list() + if s.binary == 'nova-compute'] + api.nova.service_list(IsA(http.HttpRequest), binary='nova-compute') \ + .AndReturn(compute_services) self.mox.ReplayAll() res = self.client.get(reverse(constants.AGGREGATES_MANAGE_HOSTS_URL, @@ -291,13 +272,14 @@ class ManageHostsTests(test.BaseAdminViewTests): @test.create_stubs({api.nova: ('aggregate_get', 'add_host_to_aggregate', 'remove_host_from_aggregate', - 'host_list')}) + 'service_list')}) def test_manage_hosts_update_add_remove_not_empty_aggregate(self): aggregate = self.aggregates.first() aggregate.hosts = ['host1', 'host2'] - host = self.hosts.list()[0] - form_data = {'manageaggregatehostsaction_role_member': - [host.host_name]} + compute_services = [s for s in self.services.list() + if s.binary == 'nova-compute'] + host = compute_services[0].host + form_data = {'manageaggregatehostsaction_role_member': [host]} api.nova.remove_host_from_aggregate(IsA(http.HttpRequest), str(aggregate.id), @@ -307,12 +289,14 @@ class ManageHostsTests(test.BaseAdminViewTests): 'host1').InAnyOrder() api.nova.aggregate_get(IsA(http.HttpRequest), str(aggregate.id)) \ .AndReturn(aggregate) - api.nova.host_list(IsA(http.HttpRequest)) \ - .AndReturn(self.hosts.list()) + compute_services = [s for s in self.services.list() + if s.binary == 'nova-compute'] + api.nova.service_list(IsA(http.HttpRequest), binary='nova-compute') \ + .AndReturn(compute_services) api.nova.aggregate_get(IsA(http.HttpRequest), str(aggregate.id)) \ .AndReturn(aggregate) api.nova.add_host_to_aggregate(IsA(http.HttpRequest), - str(aggregate.id), host.host_name) + str(aggregate.id), host) self.mox.ReplayAll() res = self.client.post(reverse(constants.AGGREGATES_MANAGE_HOSTS_URL, @@ -324,23 +308,25 @@ class ManageHostsTests(test.BaseAdminViewTests): @test.create_stubs({api.nova: ('aggregate_get', 'add_host_to_aggregate', 'remove_host_from_aggregate', - 'host_list')}) + 'service_list')}) def test_manage_hosts_update_add_not_empty_aggregate_should_fail(self): aggregate = self.aggregates.first() aggregate.hosts = ['devstack001'] - host1 = self.hosts.list()[0] - host3 = self.hosts.list()[2] - form_data = {'manageaggregatehostsaction_role_member': - [host1.host_name, host3.host_name]} + compute_services = [s for s in self.services.list() + if s.binary == 'nova-compute'] + host1 = compute_services[0].host + host3 = compute_services[2].host + form_data = {'manageaggregatehostsaction_role_member': [host1, host3]} api.nova.aggregate_get(IsA(http.HttpRequest), str(aggregate.id)) \ .InAnyOrder().AndReturn(aggregate) - api.nova.host_list(IsA(http.HttpRequest)) \ - .InAnyOrder().AndReturn(self.hosts.list()) + api.nova.service_list(IsA(http.HttpRequest), binary='nova-compute') \ + .AndReturn(compute_services) api.nova.aggregate_get(IsA(http.HttpRequest), str(aggregate.id)) \ .InAnyOrder().AndReturn(aggregate) api.nova.add_host_to_aggregate(IsA(http.HttpRequest), - str(aggregate.id), host3.host_name) \ + str(aggregate.id), + host3) \ .InAnyOrder().AndRaise(self.exceptions.nova) self.mox.ReplayAll() @@ -354,7 +340,7 @@ class ManageHostsTests(test.BaseAdminViewTests): @test.create_stubs({api.nova: ('aggregate_get', 'add_host_to_aggregate', 'remove_host_from_aggregate', - 'host_list')}) + 'service_list')}) def test_manage_hosts_update_clean_not_empty_aggregate_should_fail(self): aggregate = self.aggregates.first() aggregate.hosts = ['host2'] @@ -367,8 +353,10 @@ class ManageHostsTests(test.BaseAdminViewTests): .AndRaise(self.exceptions.nova) api.nova.aggregate_get(IsA(http.HttpRequest), str(aggregate.id)) \ .AndReturn(aggregate) - api.nova.host_list(IsA(http.HttpRequest)) \ - .AndReturn(self.hosts.list()) + compute_services = [s for s in self.services.list() + if s.binary == 'nova-compute'] + api.nova.service_list(IsA(http.HttpRequest), binary='nova-compute') \ + .AndReturn(compute_services) api.nova.aggregate_get(IsA(http.HttpRequest), str(aggregate.id)) \ .AndReturn(aggregate) self.mox.ReplayAll() @@ -383,7 +371,7 @@ class ManageHostsTests(test.BaseAdminViewTests): @test.create_stubs({api.nova: ('aggregate_get', 'add_host_to_aggregate', 'remove_host_from_aggregate', - 'host_list')}) + 'service_list')}) def _test_manage_hosts_update(self, host, aggregate, @@ -402,14 +390,16 @@ class ManageHostsTests(test.BaseAdminViewTests): 'host1').InAnyOrder() api.nova.aggregate_get(IsA(http.HttpRequest), str(aggregate.id)) \ .AndReturn(aggregate) - api.nova.host_list(IsA(http.HttpRequest)) \ - .AndReturn(self.hosts.list()) + compute_services = [s for s in self.services.list() + if s.binary == 'nova-compute'] + api.nova.service_list(IsA(http.HttpRequest), binary='nova-compute') \ + .AndReturn(compute_services) api.nova.aggregate_get(IsA(http.HttpRequest), str(aggregate.id)) \ .AndReturn(aggregate) if addAggregate: api.nova.add_host_to_aggregate(IsA(http.HttpRequest), str(aggregate.id), - host.host_name) + host) self.mox.ReplayAll() res = self.client.post(reverse(constants.AGGREGATES_MANAGE_HOSTS_URL, @@ -421,10 +411,11 @@ class ManageHostsTests(test.BaseAdminViewTests): def test_manage_hosts_update_nothing_not_empty_aggregate(self): aggregate = self.aggregates.first() - host = self.hosts.list()[0] - aggregate.hosts = [host.host_name] - form_data = {'manageaggregatehostsaction_role_member': - [host.host_name]} + compute_services = [s for s in self.services.list() + if s.binary == 'nova-compute'] + host = compute_services[0].host + aggregate.hosts = [host] + form_data = {'manageaggregatehostsaction_role_member': [host]} self._test_manage_hosts_update(host, aggregate, form_data, @@ -443,9 +434,10 @@ class ManageHostsTests(test.BaseAdminViewTests): def test_manage_hosts_update_add_empty_aggregate(self): aggregate = self.aggregates.first() aggregate.hosts = [] - host = self.hosts.list()[0] - form_data = {'manageaggregatehostsaction_role_member': - [host.host_name]} + compute_services = [s for s in self.services.list() + if s.binary == 'nova-compute'] + host = compute_services[0].host + form_data = {'manageaggregatehostsaction_role_member': [host]} self._test_manage_hosts_update(host, aggregate, form_data, @@ -454,10 +446,11 @@ class ManageHostsTests(test.BaseAdminViewTests): def test_manage_hosts_update_add_not_empty_aggregate(self): aggregate = self.aggregates.first() aggregate.hosts = ['devstack001'] - host1 = self.hosts.list()[0] - host3 = self.hosts.list()[2] - form_data = {'manageaggregatehostsaction_role_member': - [host1.host_name, host3.host_name]} + compute_services = [s for s in self.services.list() + if s.binary == 'nova-compute'] + host1 = compute_services[0].host + host3 = compute_services[2].host + form_data = {'manageaggregatehostsaction_role_member': [host1, host3]} self._test_manage_hosts_update(host3, aggregate, form_data, diff --git a/openstack_dashboard/dashboards/admin/aggregates/workflows.py b/openstack_dashboard/dashboards/admin/aggregates/workflows.py index 3a15983a2e..9da82b68d7 100644 --- a/openstack_dashboard/dashboards/admin/aggregates/workflows.py +++ b/openstack_dashboard/dashboards/admin/aggregates/workflows.py @@ -76,16 +76,13 @@ class AddHostsToAggregateAction(workflows.MembershipAction): field_name = self.get_member_field_name('member') self.fields[field_name] = forms.MultipleChoiceField(required=False) - hosts = [] + services = [] try: - hosts = api.nova.host_list(request) + services = api.nova.service_list(request, binary='nova-compute') except Exception: exceptions.handle(request, err_msg) - host_names = [] - for host in hosts: - if host.host_name not in host_names and host.service == u'compute': - host_names.append(host.host_name) + host_names = [s.host for s in services] host_names.sort() self.fields[field_name].choices = \ @@ -114,16 +111,13 @@ class ManageAggregateHostsAction(workflows.MembershipAction): aggregate = api.nova.aggregate_get(request, aggregate_id) current_aggregate_hosts = aggregate.hosts - hosts = [] + services = [] try: - hosts = api.nova.host_list(request) + services = api.nova.service_list(request, binary='nova-compute') except Exception: exceptions.handle(request, err_msg) - host_names = [] - for host in hosts: - if host.host_name not in host_names and host.service == u'compute': - host_names.append(host.host_name) + host_names = [s.host for s in services] host_names.sort() self.fields[field_name].choices = \ diff --git a/openstack_dashboard/dashboards/admin/instances/forms.py b/openstack_dashboard/dashboards/admin/instances/forms.py index 01195a409b..5002f593c1 100644 --- a/openstack_dashboard/dashboards/admin/instances/forms.py +++ b/openstack_dashboard/dashboards/admin/instances/forms.py @@ -48,11 +48,7 @@ class LiveMigrateForm(forms.SelfHandlingForm): def populate_host_choices(self, request, initial): hosts = initial.get('hosts') current_host = initial.get('current_host') - host_list = [(host.host_name, - host.host_name) - for host in hosts - if (host.service.startswith('compute') and - host.host_name != current_host)] + host_list = [(host, host) for host in hosts if host != current_host] if host_list: host_list.insert(0, ("AUTO_SCHEDULE", _("Automatically schedule new host."))) diff --git a/openstack_dashboard/dashboards/admin/instances/tests.py b/openstack_dashboard/dashboards/admin/instances/tests.py index 5a69852062..2340a1809f 100644 --- a/openstack_dashboard/dashboards/admin/instances/tests.py +++ b/openstack_dashboard/dashboards/admin/instances/tests.py @@ -257,14 +257,16 @@ class InstanceViewTest(test.BaseAdminViewTests): self.assertContains(res, "instances__revert") self.assertNotContains(res, "instances__migrate") - @test.create_stubs({api.nova: ('host_list', + @test.create_stubs({api.nova: ('service_list', 'server_get',)}) def test_instance_live_migrate_get(self): server = self.servers.first() + compute_services = [s for s in self.services.list() + if s.binary == 'nova-compute'] api.nova.server_get(IsA(http.HttpRequest), server.id) \ .AndReturn(server) - api.nova.host_list(IsA(http.HttpRequest)) \ - .AndReturn(self.hosts.list()) + api.nova.service_list(IsA(http.HttpRequest), binary='nova-compute') \ + .AndReturn(compute_services) self.mox.ReplayAll() @@ -288,13 +290,13 @@ class InstanceViewTest(test.BaseAdminViewTests): self.assertRedirectsNoFollow(res, INDEX_URL) - @test.create_stubs({api.nova: ('host_list', + @test.create_stubs({api.nova: ('service_list', 'server_get',)}) - def test_instance_live_migrate_list_hypervisor_get_exception(self): + def test_instance_live_migrate_list_host_get_exception(self): server = self.servers.first() api.nova.server_get(IsA(http.HttpRequest), server.id) \ .AndReturn(server) - api.nova.host_list(IsA(http.HttpRequest)) \ + api.nova.service_list(IsA(http.HttpRequest), binary='nova-compute') \ .AndRaise(self.exceptions.nova) self.mox.ReplayAll() @@ -304,40 +306,42 @@ class InstanceViewTest(test.BaseAdminViewTests): self.assertRedirectsNoFollow(res, INDEX_URL) - @test.create_stubs({api.nova: ('host_list', + @test.create_stubs({api.nova: ('service_list', 'server_get',)}) - def test_instance_live_migrate_list_hypervisor_without_current(self): + def test_instance_live_migrate_list_host_without_current(self): server = self.servers.first() + compute_services = [s for s in self.services.list() + if s.binary == 'nova-compute'] api.nova.server_get(IsA(http.HttpRequest), server.id) \ .AndReturn(server) - api.nova.host_list(IsA(http.HttpRequest)) \ - .AndReturn(self.hosts.list()) + api.nova.service_list(IsA(http.HttpRequest), binary='nova-compute') \ + .AndReturn(compute_services) self.mox.ReplayAll() url = reverse('horizon:admin:instances:live_migrate', args=[server.id]) res = self.client.get(url) - self.assertNotContains( - res, "") self.assertContains( res, "") - self.assertNotContains( - res, "") self.assertContains( - res, "") + res, "") + self.assertNotContains( + res, "") - @test.create_stubs({api.nova: ('host_list', + @test.create_stubs({api.nova: ('service_list', 'server_get', 'server_live_migrate',)}) def test_instance_live_migrate_post(self): server = self.servers.first() - host = self.hosts.first().host_name + compute_services = [s for s in self.services.list() + if s.binary == 'nova-compute'] + host = compute_services[0].host api.nova.server_get(IsA(http.HttpRequest), server.id) \ .AndReturn(server) - api.nova.host_list(IsA(http.HttpRequest)) \ - .AndReturn(self.hosts.list()) + api.nova.service_list(IsA(http.HttpRequest), binary='nova-compute') \ + .AndReturn(compute_services) api.nova.server_live_migrate(IsA(http.HttpRequest), server.id, host, block_migration=False, disk_over_commit=False) \ @@ -351,7 +355,7 @@ class InstanceViewTest(test.BaseAdminViewTests): self.assertNoFormErrors(res) self.assertRedirectsNoFollow(res, INDEX_URL) - @test.create_stubs({api.nova: ('host_list', + @test.create_stubs({api.nova: ('service_list', 'server_get', 'server_live_migrate',)}) def test_instance_live_migrate_auto_sched(self): @@ -359,8 +363,10 @@ class InstanceViewTest(test.BaseAdminViewTests): host = "AUTO_SCHEDULE" api.nova.server_get(IsA(http.HttpRequest), server.id) \ .AndReturn(server) - api.nova.host_list(IsA(http.HttpRequest)) \ - .AndReturn(self.hosts.list()) + compute_services = [s for s in self.services.list() + if s.binary == 'nova-compute'] + api.nova.service_list(IsA(http.HttpRequest), binary='nova-compute') \ + .AndReturn(compute_services) api.nova.server_live_migrate(IsA(http.HttpRequest), server.id, None, block_migration=False, disk_over_commit=False) \ @@ -374,17 +380,19 @@ class InstanceViewTest(test.BaseAdminViewTests): self.assertNoFormErrors(res) self.assertRedirectsNoFollow(res, INDEX_URL) - @test.create_stubs({api.nova: ('host_list', + @test.create_stubs({api.nova: ('service_list', 'server_get', 'server_live_migrate',)}) def test_instance_live_migrate_post_api_exception(self): server = self.servers.first() - host = self.hosts.first().host_name + compute_services = [s for s in self.services.list() + if s.binary == 'nova-compute'] + host = compute_services[0].host api.nova.server_get(IsA(http.HttpRequest), server.id) \ .AndReturn(server) - api.nova.host_list(IsA(http.HttpRequest)) \ - .AndReturn(self.hosts.list()) + api.nova.service_list(IsA(http.HttpRequest), binary='nova-compute') \ + .AndReturn(compute_services) api.nova.server_live_migrate(IsA(http.HttpRequest), server.id, host, block_migration=False, disk_over_commit=False) \ diff --git a/openstack_dashboard/dashboards/admin/instances/views.py b/openstack_dashboard/dashboards/admin/instances/views.py index 7db917ce08..ccccd7a95b 100644 --- a/openstack_dashboard/dashboards/admin/instances/views.py +++ b/openstack_dashboard/dashboards/admin/instances/views.py @@ -215,7 +215,9 @@ class LiveMigrateView(forms.ModalFormView): @memoized.memoized_method def get_hosts(self, *args, **kwargs): try: - return api.nova.host_list(self.request) + services = api.nova.service_list(self.request, + binary='nova-compute') + return [s.host for s in services] except Exception: redirect = reverse("horizon:admin:instances:index") msg = _('Unable to retrieve host information.') diff --git a/openstack_dashboard/test/test_data/nova_data.py b/openstack_dashboard/test/test_data/nova_data.py index ebf26f2fe4..31e20cceed 100644 --- a/openstack_dashboard/test/test_data/nova_data.py +++ b/openstack_dashboard/test/test_data/nova_data.py @@ -19,7 +19,6 @@ from novaclient.v2 import availability_zones from novaclient.v2 import certs from novaclient.v2 import flavor_access from novaclient.v2 import flavors -from novaclient.v2 import hosts from novaclient.v2 import hypervisors from novaclient.v2 import keypairs from novaclient.v2 import quotas @@ -169,7 +168,6 @@ def data(TEST): TEST.hypervisors = utils.TestDataContainer() TEST.services = utils.TestDataContainer() TEST.aggregates = utils.TestDataContainer() - TEST.hosts = utils.TestDataContainer() TEST.server_groups = utils.TestDataContainer() # Volumes @@ -490,7 +488,7 @@ def data(TEST): "vcpus_used": 1, "hypervisor_type": "QEMU", "local_gb_used": 20, - "hypervisor_hostname": "devstack001", + "hypervisor_hostname": "devstack002", "memory_mb_used": 1500, "memory_mb": 2000, "current_workload": 0, @@ -516,7 +514,7 @@ def data(TEST): "vcpus_used": 1, "hypervisor_type": "QEMU", "local_gb_used": 20, - "hypervisor_hostname": "devstack003", + "hypervisor_hostname": "instance-host", "memory_mb_used": 1500, "memory_mb": 2000, "current_workload": 0, @@ -629,35 +627,6 @@ def data(TEST): TEST.aggregates.add(aggregate_1) TEST.aggregates.add(aggregate_2) - host1 = hosts.Host(hosts.HostManager(None), { - "host_name": "devstack001", - "service": "compute", - "zone": "testing", - }) - - host2 = hosts.Host(hosts.HostManager(None), { - "host_name": "devstack002", - "service": "nova-conductor", - "zone": "testing", - }) - - host3 = hosts.Host(hosts.HostManager(None), { - "host_name": "devstack003", - "service": "compute", - "zone": "testing", - }) - - host4 = hosts.Host(hosts.HostManager(None), { - "host_name": "devstack004", - "service": "compute", - "zone": "testing", - }) - - TEST.hosts.add(host1) - TEST.hosts.add(host2) - TEST.hosts.add(host3) - TEST.hosts.add(host4) - server_group_1 = server_groups.ServerGroup( server_groups.ServerGroupsManager(None), {