diff --git a/nova/network/floating_ips.py b/nova/network/floating_ips.py index 0061e1cc74..036b2f210d 100644 --- a/nova/network/floating_ips.py +++ b/nova/network/floating_ips.py @@ -436,8 +436,8 @@ class FloatingIP(object): if network.multi_host: instance = objects.Instance.get_by_uuid( context, fixed_ip.instance_uuid) - service = objects.Service.get_by_host_and_topic( - context.elevated(), instance.host, CONF.network_topic) + service = objects.Service.get_by_host_and_binary( + context.elevated(), instance.host, 'nova-network') if service and self.servicegroup_api.service_is_up(service): host = instance.host else: diff --git a/nova/network/manager.py b/nova/network/manager.py index 7fe6359a4e..5e883e7810 100644 --- a/nova/network/manager.py +++ b/nova/network/manager.py @@ -224,8 +224,8 @@ class RPCAllocateFixedIP(object): address, instance=instance) if network.multi_host: - service = objects.Service.get_by_host_and_topic( - context, host, CONF.network_topic) + service = objects.Service.get_by_host_and_binary( + context, host, 'nova-network') if not service or not self.servicegroup_api.service_is_up(service): # NOTE(vish): deallocate the fixed ip locally but don't # teardown network devices diff --git a/nova/tests/unit/api/openstack/compute/contrib/test_hosts.py b/nova/tests/unit/api/openstack/compute/contrib/test_hosts.py index 6e1ef2770e..bf755793e8 100644 --- a/nova/tests/unit/api/openstack/compute/contrib/test_hosts.py +++ b/nova/tests/unit/api/openstack/compute/contrib/test_hosts.py @@ -32,9 +32,9 @@ def stub_service_get_all(context, disabled=None): return fake_hosts.SERVICES_LIST -def stub_service_get_by_host_and_topic(context, host_name, topic): +def stub_service_get_by_host_and_binary(context, host_name, binary): for service in stub_service_get_all(context): - if service['host'] == host_name and service['topic'] == topic: + if service['host'] == host_name and service['binary'] == binary: return service @@ -152,8 +152,8 @@ class HostTestCaseV21(test.TestCase): self.stubs.Set(db, 'service_get_all', stub_service_get_all) # Only hosts in our fake DB exist - self.stubs.Set(db, 'service_get_by_host_and_topic', - stub_service_get_by_host_and_topic) + self.stubs.Set(db, 'service_get_by_host_and_binary', + stub_service_get_by_host_and_binary) # 'host_c1' always succeeds, and 'host_c2' self.stubs.Set(self.hosts_api, 'set_host_enabled', stub_set_host_enabled) diff --git a/nova/tests/unit/fake_hosts.py b/nova/tests/unit/fake_hosts.py index 78fa414ac7..bd091fa4e5 100644 --- a/nova/tests/unit/fake_hosts.py +++ b/nova/tests/unit/fake_hosts.py @@ -33,5 +33,7 @@ HOST_LIST_NOVA_ZONE = [ service_base = test_service.fake_service SERVICES_LIST = [ - dict(service_base, host='host_c1', topic='compute'), - dict(service_base, host='host_c2', topic='compute')] + dict(service_base, host='host_c1', topic='compute', + binary='nova-compute'), + dict(service_base, host='host_c2', topic='compute', + binary='nova-compute')] diff --git a/nova/tests/unit/network/test_manager.py b/nova/tests/unit/network/test_manager.py index e19754e590..c31a6464f5 100644 --- a/nova/tests/unit/network/test_manager.py +++ b/nova/tests/unit/network/test_manager.py @@ -2760,7 +2760,7 @@ class FloatingIPTestCase(test.TestCase): @mock.patch('nova.db.fixed_ip_get') @mock.patch('nova.db.network_get') @mock.patch('nova.db.instance_get_by_uuid') - @mock.patch('nova.db.service_get_by_host_and_topic') + @mock.patch('nova.db.service_get_by_host_and_binary') @mock.patch('nova.db.floating_ip_get_by_address') def test_disassociate_floating_ip_multi_host_calls(self, floating_get, service_get,