fix: prevent using the same name for local alias and remote cluster#576
Open
panagiotisevaggelou wants to merge 1 commit intocanonical:mainfrom
Open
fix: prevent using the same name for local alias and remote cluster#576panagiotisevaggelou wants to merge 1 commit intocanonical:mainfrom
panagiotisevaggelou wants to merge 1 commit intocanonical:mainfrom
Conversation
| return fmt.Errorf("please provide a local name using `--local-name` flag") | ||
| } | ||
|
|
||
| if c.localName == args[0] { |
Contributor
There was a problem hiding this comment.
this check is client sided (CLI), which still leaves the backend API open to such mistakes from a user. Please check cmdOpsReplication in microceph/api/ops_replication.go to add this validation in the API.
Contributor
Author
There was a problem hiding this comment.
@UtkarshBhatthere, I've added the validation at the API level as requested. The empty check prevents errors from cases where the remote name is empty, which caused a test to fail previously. Also included LocalAlias in the struct to explicitly track and use the local cluster name.
UtkarshBhatthere
requested changes
Jun 26, 2025
Contributor
UtkarshBhatthere
left a comment
There was a problem hiding this comment.
Thanks for the PR. suggestions.
d91462b to
4d77e1f
Compare
Signed-off-by: panagiotisevaggelou <panagiotisevaggelou02@gmail.com>
4d77e1f to
d6cb671
Compare
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.
Description
This PR introduces a validation in the remote import CLI command to prevent users from specifying the same value for the --local-name flag and the remote cluster name (positional argument). This resolves an issue where Ceph replication fails due to duplicate site names during peer bootstrap.
Additionally, the relevant documentation (Import a remote MicroCeph cluster) was updated to include a note that clarifies this requirement for users.
Fixes #559
Type of change
How has this been tested?
The validation was tested locally by building the microceph binary and running the remote import command with: