diff --git a/manila/share/drivers/netapp/dataontap/client/client_cmode.py b/manila/share/drivers/netapp/dataontap/client/client_cmode.py index c279ce2505..47b0279dc2 100644 --- a/manila/share/drivers/netapp/dataontap/client/client_cmode.py +++ b/manila/share/drivers/netapp/dataontap/client/client_cmode.py @@ -659,6 +659,8 @@ class NetAppCmodeClient(client_base.NetAppBaseClient): @na_utils.trace def create_route(self, gateway, destination=None): + if not gateway: + return if not destination: if ':' in gateway: destination = '::/0' diff --git a/manila/tests/share/drivers/netapp/dataontap/client/test_client_cmode.py b/manila/tests/share/drivers/netapp/dataontap/client/test_client_cmode.py index 52463ab3df..0b9e501fb6 100644 --- a/manila/tests/share/drivers/netapp/dataontap/client/test_client_cmode.py +++ b/manila/tests/share/drivers/netapp/dataontap/client/test_client_cmode.py @@ -1249,6 +1249,11 @@ class NetAppClientCmodeTestCase(test.TestCase): self.client.send_request.assert_called_once_with( 'net-routes-create', expected_api_args) + def test_create_route_without_gateway(self): + self.mock_object(self.client, 'send_request') + self.client.create_route(None, destination=fake.SUBNET) + self.assertFalse(self.client.send_request.called) + def test_ensure_broadcast_domain_for_port_domain_match(self): port_info = { diff --git a/releasenotes/notes/bug-1777126-netapp-skip-route-setup-if-no-gateway-e841635dcd20fd12.yaml b/releasenotes/notes/bug-1777126-netapp-skip-route-setup-if-no-gateway-e841635dcd20fd12.yaml new file mode 100644 index 0000000000..57c8e8e608 --- /dev/null +++ b/releasenotes/notes/bug-1777126-netapp-skip-route-setup-if-no-gateway-e841635dcd20fd12.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - The NetApp driver has been fixed to not enforce route creation when the + share network provided has no gateway. See `Launchpad bug 1777126 + `_ for details.