feat: cluster/module_uuid hash key#1088
Merged
DavidePrincipi merged 5 commits intomainfrom Feb 26, 2026
Merged
Conversation
Introduce a new Redis HASH key, cluster/module_uuid beside the existing cluster/module_node to safely store the module UUID, used by backup and service discovery functions. Only the cluster agent has write control on it, preventing arbitrary changes by applications. Changes summary: - Migration of UUID from module environment keys, for existing systems. Runs once. - Generate and assign the module UUID during add-module, for new modules. - Cluster-controlled assignment of UUID during restore and clone actions. To avoid UUID clash, during clone and restore a temporary UUID is set in cluster/module_uuid for the new module. The original UUID is copied on it once the original module has been successfully removed. Note that the new module immediately receives the original UUID in its environment and is not aware of the temporary UUID. - Small fix in agent.list_service_providers(): use cluster/module_node key to obtain the node_id of a module.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Simplify clone and restore actions by allowing temporary UUID duplication in cluster/module_uuid. The new approach: - Removes complex temporary UUID management from add-module - Eliminates race conditions in UUID conflict resolution - Adds module_seq field to service discovery for conflict resolution - Defers old module removal until after successful restoration Changes: - fix(list_service_providers): handle UUID conflicts via module sequence - fix(clone-module): remove manual UUID copying after module removal - fix(restore-module): collect conflicting modules upfront, remove after success - fix(add-module): use provided UUID directly instead of temporary assignment Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 14 out of 15 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
core/imageroot/var/lib/nethserver/cluster/actions/add-module/50update
Outdated
Show resolved
Hide resolved
core/imageroot/var/lib/nethserver/cluster/actions/restore-module/50restore_module
Outdated
Show resolved
Hide resolved
Improve restore-module logic to preserve the original module UUID when no conflicts exist, even in non-replace mode. This provides better consistency between backup and restored module identity. Changes: - Always extract UUID from backup environment - Scan for UUID conflicts regardless of replace flag - Preserve UUID when replace=true OR no conflicts found - Add force_uuid variable for clearer conditional logic Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Introduce a new Redis HASH key, cluster/module_uuid beside the existing cluster/module_node to safely store the module UUID, used by backup and service discovery functions. Only the cluster agent has write control on it, preventing arbitrary changes by applications.
Changes summary:
Migration of UUID from module environment keys, for existing systems. Runs once.
Generate and assign the module UUID during add-module, for new modules.
Cluster-controlled assignment of UUID during restore and clone actions. Temporary UUID
duplication in cluster/module_uuid is allowed and resolved by agent.list_service_providers().
Small fix in agent.list_service_providers(): use cluster/module_node key to obtain the node_id of a module.
Refs NethServer/dev#7814 NethServer/dev#7890 NethServer/dev#7810