Skip to content

Conversation

@panagiotisevaggelou
Copy link
Contributor

@panagiotisevaggelou panagiotisevaggelou commented Jun 26, 2025

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

  • Bug fix (non-breaking change which fixes an issue)

How has this been tested?

The validation was tested locally by building the microceph binary and running the remote import command with:

  • Identical --local-name and remote name: correctly triggers a validation error
  • Distinct values: proceeds past validation as expected

return fmt.Errorf("please provide a local name using `--local-name` flag")
}

if c.localName == args[0] {
Copy link
Contributor

Choose a reason for hiding this comment

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

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.

Copy link
Contributor Author

@panagiotisevaggelou panagiotisevaggelou Jul 1, 2025

Choose a reason for hiding this comment

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

@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.

Copy link
Contributor

@UtkarshBhatthere UtkarshBhatthere left a comment

Choose a reason for hiding this comment

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

Thanks for the PR. suggestions.

@panagiotisevaggelou panagiotisevaggelou force-pushed the fix-duplicate-site-name branch 8 times, most recently from d91462b to 4d77e1f Compare July 1, 2025 12:40
Signed-off-by: panagiotisevaggelou <panagiotisevaggelou02@gmail.com>
@panagiotisevaggelou panagiotisevaggelou force-pushed the fix-duplicate-site-name branch from 4d77e1f to d6cb671 Compare July 1, 2025 12:56
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.

Fault enabling replication

2 participants