From 46a2bc689bf31df9b70741cb5b01b098c1672b1e Mon Sep 17 00:00:00 2001 From: Balazs Gibizer Date: Sat, 7 Sep 2019 17:47:07 +0200 Subject: [PATCH] Follow up for I220fa02ee916728e241503084b14984bab4b0c3b * Enhanced exception message when provider mapping is missing during _update_port_binding_for_instance * replaced dict with real Migration object in the unit test blueprint: support-move-ops-with-qos-ports Change-Id: Ib033fee8b8464f51f10101a5da2dfc983bf76733 --- nova/network/neutronv2/api.py | 10 ++++++++-- nova/tests/unit/network/test_neutronv2.py | 15 +++++++++------ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/nova/network/neutronv2/api.py b/nova/network/neutronv2/api.py index e803131021..b2cb3b65f3 100644 --- a/nova/network/neutronv2/api.py +++ b/nova/network/neutronv2/api.py @@ -3321,8 +3321,14 @@ class API(base_api.NetworkAPI): # mapping based on that. raise exception.PortUpdateFailed( port_id=p['id'], - reason=_("Provider mappings wasn't provided for the " - "port with resource request")) + reason=_( + "Provider mappings are not available to the " + "compute service but are required for ports with " + "a resource request. If compute RPC API versions " + "are pinned for a rolling upgrade, you will need " + "to retry this operation once the RPC version is " + "unpinned and the nova-compute services are all " + "upgraded.")) # NOTE(gibi): In the resource provider mapping there can be # more than one RP fulfilling a request group. But resource diff --git a/nova/tests/unit/network/test_neutronv2.py b/nova/tests/unit/network/test_neutronv2.py index f5fe81a7d3..3d6e44f4ae 100644 --- a/nova/tests/unit/network/test_neutronv2.py +++ b/nova/tests/unit/network/test_neutronv2.py @@ -4543,8 +4543,8 @@ class TestNeutronv2WithMock(TestNeutronv2Base): constants.BINDING_PROFILE: {'allocation': uuids.source_compute_rp}, 'resource_request': mock.sentinel.resource_request}]} - migration = {'status': 'confirmed', - 'migration_type': "migration"} + migration = objects.Migration( + status='confirmed', migration_type='migration') list_ports_mock = mock.Mock(return_value=fake_ports) get_client_mock.return_value.list_ports = list_ports_mock @@ -4569,8 +4569,8 @@ class TestNeutronv2WithMock(TestNeutronv2Base): constants.BINDING_PROFILE: {'allocation': uuids.source_compute_rp}, 'resource_request': mock.sentinel.resource_request}]} - migration = {'status': 'confirmed', - 'migration_type': "migration"} + migration = objects.Migration( + status='confirmed', migration_type='migration') list_ports_mock = mock.Mock(return_value=fake_ports) get_client_mock.return_value.list_ports = list_ports_mock @@ -4579,8 +4579,11 @@ class TestNeutronv2WithMock(TestNeutronv2Base): self.api._update_port_binding_for_instance, self.context, instance, 'new-host', migration, provider_mappings=None) self.assertIn( - "Provider mappings wasn't provided for the port with resource " - "request", six.text_type(ex)) + "Provider mappings are not available to the compute service but " + "are required for ports with a resource request. If compute RPC " + "API versions are pinned for a rolling upgrade, you will need to " + "retry this operation once the RPC version is unpinned and the " + "nova-compute services are all upgraded.", six.text_type(ex)) def test_get_pci_mapping_for_migration(self): instance = fake_instance.fake_instance_obj(self.context)