Skip to content

Add DNS metadata support for NFS shares - #309

Open
skook1 wants to merge 1 commit into
stable/2025.1-m3from
fix/dns-name-for-manila-ports
Open

skook1 wants to merge 1 commit into
stable/2025.1-m3from
fix/dns-name-for-manila-ports

Conversation

@skook1

@skook1 skook1 commented May 13, 2026

Copy link
Copy Markdown
  • Creates a DNS A record in OpenStack Designate pointing to the preferred export location IP
  • Adds an extra export location with the DNS path
  • Solved the problem of NFS clients needing to update mount configurations when a share server is recreated and gets a different IP — the DNS name stays stable even if the underlying IP changes

Change-Id: I6f7ff44c3a8fe0aad2a6b93124e3beb5151a7876

Comment thread manila/share/api.py Outdated
@skook1
skook1 force-pushed the fix/dns-name-for-manila-ports branch 3 times, most recently from 98817b8 to 6c39ef5 Compare May 18, 2026 16:03
@skook1
skook1 requested a review from kpawar-sap May 19, 2026 10:31
@Carthaca

Carthaca commented Jun 2, 2026

Copy link
Copy Markdown
Collaborator

pep8: commands[0]> flake8
./manila/tests/dns/test_designate_integration.py:1:1: H102: Apache 2.0 license header not found
./manila/tests/dns/test_designate_integration.py:4:1: H306: imports not in alphabetical order (manila.test, manila.dns.designate)
./manila/tests/dns/test_designate_integration.py:84:54: E127 continuation line over-indented for visual indent
./manila/tests/dns/test_designate_integration.py:165:55: E127 continuation line over-indented for visual indent
./manila/tests/dns/test_designate_integration.py:197:50: E127 continuation line over-indented for visual indent
./manila/tests/dns/test_designate_scenarios.py:1:1: H102: Apache 2.0 license header not found
./manila/tests/dns/test_designate_scenarios.py:4:1: H306: imports not in alphabetical order (manila.test, manila.dns.designate)
./manila/tests/dns/test_designate_scenarios.py:10:1: E302 expected 2 blank lines, found 1
./manila/tests/dns/test_designate_scenarios.py:131:53: E127 continuation line over-indented for visual indent
./manila/tests/dns/test_designate_scenarios.py:156:33: E127 continuation line over-indented for visual indent
./manila/tests/dns/test_designate_scenarios.py:158:33: E127 continuation line over-indented for visual indent
./manila/tests/share/test_manager.py:10890:80: E501 line too long (80 > 79 characters)
./manila/tests/share/test_manager.py:10898:80: E501 line too long (80 > 79 characters)
./manila/tests/share/test_manager.py:10944:80: E501 line too long (80 > 79 characters)
./manila/tests/share/test_manager.py:10959:80: E501 line too long (80 > 79 characters)
./manila/tests/share/test_manager.py:10989:80: E501 line too long (80 > 79 characters)
./manila/tests/share/test_manager.py:11003:80: E501 line too long (87 > 79 characters)
./manila/tests/share/drivers/netapp/dataontap/cluster_mode/test_lib_base_dns.py:1:1: H102: Apache 2.0 license header not found
./manila/tests/share/drivers/netapp/dataontap/cluster_mode/test_lib_base_dns.py:5:1: H306: imports not in alphabetical order (manila.test, manila.share.drivers.netapp.dataontap.cluster_mode.lib_base)
./manila/tests/share/drivers/netapp/dataontap/cluster_mode/test_lib_base_dns.py:9:1: H405: multi line docstring summary not separated with an empty line
./manila/tests/share/drivers/netapp/dataontap/cluster_mode/test_lib_base_dns.py:10:1: H405: multi line docstring summary not separated with an empty line
./manila/tests/share/drivers/netapp/dataontap/cluster_mode/test_lib_base_dns.py:11:1: H405: multi line docstring summary not separated with an empty line
./manila/tests/api/views/test_export_locations_dns.py:1:1: H102: Apache 2.0 license header not found
./manila/dns/designate.py:1:1: H102: Apache 2.0 license header not found
./manila/share/manager.py:7426:1: H405: multi line docstring summary not separated with an empty line
./manila/share/manager.py:7426:29: H403: multi line docstrings should end on a new line
./manila/share/manager.py:7427:1: H405: multi line docstring summary not separated with an empty line
./manila/share/manager.py:7427:29: H403: multi line docstrings should end on a new line
./manila/share/manager.py:7465:80: E501 line too long (80 > 79 characters)

@skook1
skook1 force-pushed the fix/dns-name-for-manila-ports branch from 6c39ef5 to 8c2fbe4 Compare June 3, 2026 13:44
@skook1

skook1 commented Jun 3, 2026

Copy link
Copy Markdown
Author

pep8: commands[0]> flake8
./manila/tests/dns/test_designate_integration.py:1:1: H102: Apache 2.0 license header not found
./manila/tests/dns/test_designate_integration.py:4:1: H306: imports not in alphabetical order (manila.test, manila.dns.designate)
./manila/tests/dns/test_designate_integration.py:84:54: E127 continuation line over-indented for visual indent
./manila/tests/dns/test_designate_integration.py:165:55: E127 continuation line over-indented for visual indent
./manila/tests/dns/test_designate_integration.py:197:50: E127 continuation line over-indented for visual indent
./manila/tests/dns/test_designate_scenarios.py:1:1: H102: Apache 2.0 license header not found
./manila/tests/dns/test_designate_scenarios.py:4:1: H306: imports not in alphabetical order (manila.test, manila.dns.designate)
./manila/tests/dns/test_designate_scenarios.py:10:1: E302 expected 2 blank lines, found 1
./manila/tests/dns/test_designate_scenarios.py:131:53: E127 continuation line over-indented for visual indent
./manila/tests/dns/test_designate_scenarios.py:156:33: E127 continuation line over-indented for visual indent
./manila/tests/dns/test_designate_scenarios.py:158:33: E127 continuation line over-indented for visual indent
./manila/tests/share/test_manager.py:10890:80: E501 line too long (80 > 79 characters)
./manila/tests/share/test_manager.py:10898:80: E501 line too long (80 > 79 characters)
./manila/tests/share/test_manager.py:10944:80: E501 line too long (80 > 79 characters)
./manila/tests/share/test_manager.py:10959:80: E501 line too long (80 > 79 characters)
./manila/tests/share/test_manager.py:10989:80: E501 line too long (80 > 79 characters)
./manila/tests/share/test_manager.py:11003:80: E501 line too long (87 > 79 characters)
./manila/tests/share/drivers/netapp/dataontap/cluster_mode/test_lib_base_dns.py:1:1: H102: Apache 2.0 license header not found
./manila/tests/share/drivers/netapp/dataontap/cluster_mode/test_lib_base_dns.py:5:1: H306: imports not in alphabetical order (manila.test, manila.share.drivers.netapp.dataontap.cluster_mode.lib_base)
./manila/tests/share/drivers/netapp/dataontap/cluster_mode/test_lib_base_dns.py:9:1: H405: multi line docstring summary not separated with an empty line
./manila/tests/share/drivers/netapp/dataontap/cluster_mode/test_lib_base_dns.py:10:1: H405: multi line docstring summary not separated with an empty line
./manila/tests/share/drivers/netapp/dataontap/cluster_mode/test_lib_base_dns.py:11:1: H405: multi line docstring summary not separated with an empty line
./manila/tests/api/views/test_export_locations_dns.py:1:1: H102: Apache 2.0 license header not found
./manila/dns/designate.py:1:1: H102: Apache 2.0 license header not found
./manila/share/manager.py:7426:1: H405: multi line docstring summary not separated with an empty line
./manila/share/manager.py:7426:29: H403: multi line docstrings should end on a new line
./manila/share/manager.py:7427:1: H405: multi line docstring summary not separated with an empty line
./manila/share/manager.py:7427:29: H403: multi line docstrings should end on a new line
./manila/share/manager.py:7465:80: E501 line too long (80 > 79 characters)

resolved

@skook1
skook1 changed the base branch from stable/2023.1-m3 to stable/2025.1-m3 June 25, 2026 12:16
@skook1
skook1 force-pushed the fix/dns-name-for-manila-ports branch from 8c2fbe4 to 37c481d Compare June 25, 2026 12:19
@Carthaca

Copy link
Copy Markdown
Collaborator

==============================
Failed 4 tests - output below:

manila.tests.api.views.test_export_locations_dns.ExportLocationsViewBuilderDNSTestCase.test_dns_metadata_preserved_with_preferred

Captured traceback:

    Traceback (most recent call last):

      File "/tmp/build/a031654e/pull-request-manila/manila/tests/api/views/test_export_locations_dns.py", line 112, in test_dns_metadata_preserved_with_preferred
    self.assertEqual(view_dict['dns_name'], 'share1')

    KeyError: 'dns_name'


manila.tests.api.views.test_export_locations_dns.ExportLocationsViewBuilderDNSTestCase.test_dns_domain_only
-----------------------------------------------------------------------------------------------------------

Captured traceback:
Traceback (most recent call last):

  File "/tmp/build/a031654e/pull-request-manila/manila/tests/api/views/test_export_locations_dns.py", line 98, in test_dns_domain_only
self.assertEqual(view_dict['dns_domain'], 'example.com.')

KeyError: 'dns_domain'

manila.tests.api.views.test_export_locations_dns.ExportLocationsViewBuilderDNSTestCase.test_dns_metadata_added_to_export_location_view

Captured traceback:

    Traceback (most recent call last):

      File "/tmp/build/a031654e/pull-request-manila/manila/tests/api/views/test_export_locations_dns.py", line 64, in test_dns_metadata_added_to_export_location_view
    self.assertEqual(view_dict['dns_name'], 'my_pet_share')

    KeyError: 'dns_name'


manila.tests.api.views.test_export_locations_dns.ExportLocationsViewBuilderDNSTestCase.test_partial_dns_metadata
----------------------------------------------------------------------------------------------------------------

Captured traceback:
Traceback (most recent call last):

  File "/tmp/build/a031654e/pull-request-manila/manila/tests/api/views/test_export_locations_dns.py", line 86, in test_partial_dns_metadata
self.assertEqual(view_dict['dns_name'], 'test_share')

KeyError: 'dns_name'

and trailing whitespace

diff --git a/releasenotes/notes/add-dns-metadata-for-export-locations-1200e7d5a.yaml b/releasenotes/notes/add-dns-metadata-for-export-locations-1200e7d5a.yaml
index 366bf74..dfdf65a 100644
--- a/releasenotes/notes/add-dns-metadata-for-export-locations-1200e7d5a.yaml
+++ b/releasenotes/notes/add-dns-metadata-for-export-locations-1200e7d5a.yaml
@@ -23,8 +23,8 @@ security:
     - Manila is not notified of external Designate changes, so the DNS export
       location entry in Manila's database will remain even after the record is
       deleted in Designate, leading to a stale path.
-    
+
     Suggestion:
-    
+
     - To reduce risk, it is recommended to restrict write access to the Designate
     zone used for Manila shares to the Manila service account only.

@skook1
skook1 force-pushed the fix/dns-name-for-manila-ports branch 2 times, most recently from 4beceef to 8befce2 Compare July 1, 2026 13:02
Comment thread manila/share/api.py Outdated
Comment thread manila/share/manager.py Outdated
@chuan137

chuan137 commented Jul 2, 2026

Copy link
Copy Markdown
Member

I think when replica promoted, the old dns record will still work because readable replica is enabled. And dns record should be updated to the new active replica. Potentially this might break share mounting. Honestly idk how to handle this correctly. Maybe simply forbid creating replica for shares with dns metadata, and forbid adding dns metadata for shares with replica. But this would make the feature less usable.

@Carthaca Carthaca left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I did not find much time, so I'll only gave it a quick AI-assisted glance now.

Look at the inline comments.

And in general, some remarks of identified things:
Would this work for CIFS or non-NetApp backends?

Efficiency: designateclient(context) and _get_zone_id are called per operation — cache the client and memoize dns_domain → zone_id

Critical-path blocking: Designate calls sit on the share-create / share-delete critical path; a Designate outage stalls every share for the full HTTP timeout window. Move to async / short timeout + best-effort reconcile.

Reuse: Hardcoded {'dns_name','dns_domain'} set duplicates the purpose of CONF.driver_updatable_metadata

Lifecycle gap: Renaming dns_name while dns_domain is unchanged leaves the old DNS export-location row and old A record behind (the branch condition not dns_export_locs is false, so no cleanup runs).

Comment thread manila/share/manager.py Outdated
Comment thread manila/share/manager.py Outdated
Comment thread manila/dns/designate.py Outdated
Comment thread manila/api/v2/shares.py
Comment thread manila/api/v2/shares.py
Comment thread manila/share/manager.py Outdated
@skook1
skook1 force-pushed the fix/dns-name-for-manila-ports branch from 8befce2 to 4f66927 Compare July 23, 2026 13:21
@skook1
skook1 requested review from Carthaca and kpawar-sap July 23, 2026 13:21
@skook1
skook1 force-pushed the fix/dns-name-for-manila-ports branch 3 times, most recently from 79174c0 to d484b97 Compare August 2, 2026 14:40
- Creates a DNS A record in OpenStack Designate pointing
  to the preferred export location IP
- Adds an extra export location with the DNS path
- Solved the problem of NFS clients needing to update
  mount configurations when a share server is recreated
  and gets a different IP — the DNS name stays stable
  even if the underlying IP changes

Change-Id: I6f7ff44c3a8fe0aad2a6b93124e3beb5151a7876
@skook1
skook1 force-pushed the fix/dns-name-for-manila-ports branch from d484b97 to 6ce9192 Compare August 2, 2026 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants