Skip to content

feat: cluster/module_uuid hash key#1088

Merged
DavidePrincipi merged 5 commits intomainfrom
feat-7814-2
Feb 26, 2026
Merged

feat: cluster/module_uuid hash key#1088
DavidePrincipi merged 5 commits intomainfrom
feat-7814-2

Conversation

@DavidePrincipi
Copy link
Member

@DavidePrincipi DavidePrincipi commented Feb 24, 2026

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

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.

This comment was marked as outdated.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
github-actions bot pushed a commit that referenced this pull request Feb 24, 2026
@DavidePrincipi DavidePrincipi added the testing Start test suite label Feb 24, 2026
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>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

github-actions bot pushed a commit that referenced this pull request Feb 25, 2026
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>
github-actions bot pushed a commit that referenced this pull request Feb 25, 2026
@DavidePrincipi DavidePrincipi marked this pull request as ready for review February 25, 2026 18:34
@DavidePrincipi DavidePrincipi linked an issue Feb 26, 2026 that may be closed by this pull request
Copy link
Member

@gsanchietti gsanchietti left a comment

Choose a reason for hiding this comment

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

🤷‍♂️

@DavidePrincipi DavidePrincipi merged commit c2fdf5c into main Feb 26, 2026
3 checks passed
@DavidePrincipi DavidePrincipi deleted the feat-7814-2 branch February 26, 2026 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

testing Start test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cluster and module_uuid based hash key Improve Restore UX in Disaster Recovery and Backup pages

3 participants