canonical / canonical/microceph

Cluster export fails when local cluster name contains hyphens

Open
#649 5 comments 0 reactions 0 assignees View on GitHub
bug documentation
Dominant language
Go
Stars
396
Forks
74
Avg merge
2d 20h
Merged PRs (30d)
7

Description

# Issue report

## What version of MicroCeph are you using ?

tracking: squid/stable
installed: 19.2.1+snap74c0060321 (1582) 128MB held

## What are the steps to reproduce this issue ?

1. Bootstrap a MicroCeph cluster using a hostname that contains hyphens.
2. Attempt to export this cluster in order to enable Ceph replication.

## What happens (observed behaviour) ?

root@cluster-with-hyphens:~# microceph cluster export anotherclustername
Error: failed to fetch cluster state: cluster names can only have [a-z] or [0-9] characters: %!w()

**Note:** The issue is not related to the remote cluster name.
The validation fails due to the local cluster name (the one being exported).

## What were you expecting to happen ?

Since MicroCeph allows cluster names with hyphens during bootstrap and cluster add, it should also accept them during cluster export/cluster import, unless this is a strict upstream Ceph limitation (which does not seem to be the case).

## Additional information

The validation appears to originate from the regex defined in microceph/constants/constants.go

```
// ClusterNameRegex is the regex for validating cluster names (a-z0-9)
const ClusterNameRegex = "^[a-z0-9]+$"
```

This regex does not allow hyphens, which leads to the inconsistency.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.