Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NFS exports restored as read-only #2912 #2927

Merged

Conversation

phillxnet
Copy link
Member

Fix translation of DB dump derived config-save field names to NFS export create API field names.

Fixes #2912

Affects Web-UI surfaced NFS export config of:

  • Access type ('Writable'/'Read only')
  • Response type ('async'/'sync') for NFS exports created via a config restore process.

Note that we maintain DB dump derived config-save field names in the generated API calls (ignored currently), to enable future API field name alignment to DB model field names. At which point the additional fields added here to the API payload would themselves become redundant and up for deprecation, and in the change-over period ignored.

Fix translation of DB dump derived config-save field names to
NFS export create API field names.

Affects Web-UI surfaced NFS export config of:
- Access type ('Writable'/'Read only')
- Response type ('async'/'sync')
for NFS exports created via a config restore process.

Note that we maintain DB dump derived config-save field names
in the generated API calls (ignored currently), to enable
future API field name alignment to DB model field names.
At which point the additional fields added here to the API
payload would themselves become redundant and up for
deprecation, and in the change-over period ignored.
@phillxnet
Copy link
Member Author

Testing

An rpm was build and installed on a Leap 15.6 OS host using this PRs branch.

The following Shares & their respective NFS exports were created:

Shares Host String Read only Sync / Async Actions
share-ro-async * yes async  
share-ro-sync * yes sync  
share-rw-async * no async  
share-rw-sync * no sync  

And OS config confirmed:

cat /etc/exports
/export/share-rw-async *(rw,async,insecure) 
/export/share-rw-sync *(rw,sync,insecure) 
/export/share-ro-async *(ro,async,insecure) 
/export/share-ro-sync *(ro,sync,insecure) 

This config was then saved via SYSTEM -> Config Backups - "Backup current config" (button).


All NFS exports (above) where then deleted, and the following Shares and a single NFS export was created via the Web-UI:

Shares:

  • place-holder
  • NFS-share
Shares Host String Read only Sync / Async Actions
place-holder test.lan no async  

A prior issue reproducer config-save file (containing a saved NFS export for NFS-share) was then uploaded and replayed, resulting in:

  • rockstor.log
tail -f /opt/rockstor/var/log/rockstor.log
...
[15/Nov/2024 11:37:38] INFO [storageadmin.views.config_backup:127] Started restoring NFS exports.
[15/Nov/2024 11:37:38] INFO [storageadmin.views.config_backup:55] Successfully created resource: https://localhost/api/nfs-exports. Payload: {'host_str': '*', 'editable': 'rw', 'syncable': 'async', 'mount_security': 'insecure', 'nohide': False, 'enabled': True, 'admin_host': None, 'pk': 1, 'mod_choice': 'rw', 'sync_choice': 'async', 'export_group': 1, 'share': 1, 'mount': '/export/NFS-share', 'shares': ['NFS-share']}
[15/Nov/2024 11:37:38] INFO [storageadmin.views.config_backup:55] Successfully created resource: https://localhost/api/adv-nfs-exports. Payload: {'entries': []}
[15/Nov/2024 11:37:38] INFO [storageadmin.views.config_backup:155] Finished restoring NFS exports.

Note the newly added repeat value fields of 'mod_choice', and 'sync_choice' in the above.

Shares Host String Read only Sync / Async Actions
NFS-share * no async  
place-holder test.lan no async  
cat /etc/exports
/export/place-holder test.lan(rw,async,insecure) 
/export/NFS-share *(rw,async,insecure) 

The original 4 NFS exports pertaining to the still existing shares was also then replayed/applied; resulting in:

tail -f /opt/rockstor/var/log/rockstor.log
...
[15/Nov/2024 11:44:55] INFO [storageadmin.views.config_backup:127] Started restoring NFS exports.
[15/Nov/2024 11:44:55] INFO [storageadmin.views.config_backup:55] Successfully created resource: https://localhost/api/nfs-exports. Payload: {'host_str': '*', 'editable': 'rw', 'syncable': 'async', 'mount_security': 'insecure', 'nohide': False, 'enabled': True, 'admin_host': None, 'pk': 1, 'mod_choice': 'rw', 'sync_choice': 'async', 'export_group': 1, 'share': 2, 'mount': '/export/share-rw-async', 'shares': ['share-rw-async']}
[15/Nov/2024 11:44:56] INFO [storageadmin.views.config_backup:55] Successfully created resource: https://localhost/api/nfs-exports. Payload: {'host_str': '*', 'editable': 'rw', 'syncable': 'sync', 'mount_security': 'insecure', 'nohide': False, 'enabled': True, 'admin_host': None, 'pk': 2, 'mod_choice': 'rw', 'sync_choice': 'sync', 'export_group': 2, 'share': 3, 'mount': '/export/share-rw-sync', 'shares': ['share-rw-sync']}
[15/Nov/2024 11:44:56] INFO [storageadmin.views.config_backup:55] Successfully created resource: https://localhost/api/nfs-exports. Payload: {'host_str': '*', 'editable': 'ro', 'syncable': 'async', 'mount_security': 'insecure', 'nohide': False, 'enabled': True, 'admin_host': None, 'pk': 3, 'mod_choice': 'ro', 'sync_choice': 'async', 'export_group': 3, 'share': 4, 'mount': '/export/share-ro-async', 'shares': ['share-ro-async']}
[15/Nov/2024 11:44:56] INFO [storageadmin.views.config_backup:55] Successfully created resource: https://localhost/api/nfs-exports. Payload: {'host_str': '*', 'editable': 'ro', 'syncable': 'sync', 'mount_security': 'insecure', 'nohide': False, 'enabled': True, 'admin_host': None, 'pk': 4, 'mod_choice': 'ro', 'sync_choice': 'sync', 'export_group': 4, 'share': 5, 'mount': '/export/share-ro-sync', 'shares': ['share-ro-sync']}
[15/Nov/2024 11:44:56] INFO [storageadmin.views.config_backup:55] Successfully created resource: https://localhost/api/adv-nfs-exports. Payload: {'entries': []}
[15/Nov/2024 11:44:56] INFO [storageadmin.views.config_backup:155] Finished restoring NFS exports.

Shares Host String Read only Sync / Async Actions
NFS-share * no async  
place-holder test.lan no async  
share-ro-async * yes async  
share-ro-sync * yes sync  
share-rw-async * no async  
share-rw-sync * no sync  

Reflected in the underlying OS config:

cat /etc/exports

/export/place-holder test.lan(rw,async,insecure) 
/export/NFS-share *(rw,async,insecure) 
/export/share-rw-async *(rw,async,insecure) 
/export/share-rw-sync *(rw,sync,insecure) 
/export/share-ro-async *(ro,async,insecure) 
/export/share-ro-sync *(ro,sync,insecure) 

@phillxnet
Copy link
Member Author

Merging as per last comment test result. We appear to now successfully restore 'Access type', as per issue detailed failure. And similarly to have also fixed an identical failure found during development re restoring 'Response type'.

@phillxnet phillxnet merged commit 366324d into rockstor:testing Nov 15, 2024
@phillxnet phillxnet deleted the 2912-NFS-exports-restored-as-read-only branch November 15, 2024 15:36
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.

1 participant