rbd: move radosNamespace to RBD section

As radosNamespace is more specific to
RBD not the general ceph configuration. Now
we introduced a new RBD section for RBD specific
options, Moving the radosNamespace to RBD section
and keeping the radosNamespace still under the
global ceph level configration for backward
compatibility.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
Madhu Rajanna
2022-04-18 11:38:52 +05:30
committed by mergify[bot]
parent 766346868e
commit b4acbd08a5
5 changed files with 36 additions and 17 deletions

View File

@ -41,7 +41,7 @@ type ClusterInfo struct {
// ClusterID is used for unique identification
ClusterID string `json:"clusterID"`
// RadosNamespace is a rados namespace in the pool
RadosNamespace string `json:"radosNamespace"`
RadosNamespace string `json:"radosNamespace"` // For backward compatibility. TODO: Remove this in 3.7.0
// Monitors is monitor list for corresponding cluster ID
Monitors []string `json:"monitors"`
// CephFS contains CephFS specific options
@ -54,18 +54,22 @@ type ClusterInfo struct {
RBD struct {
// symlink filepath for the network namespace where we need to execute commands.
NetNamespaceFilePath string `json:"netNamespaceFilePath"`
// RadosNamespace is a rados namespace in the pool
RadosNamespace string `json:"radosNamespace"`
} `json:"rbd"`
}
// Expected JSON structure in the passed in config file is,
// [
// {
// "clusterID": "<cluster-id>",
// "radosNamespace": "<rados-namespace>",
// "monitors":
// [
// "<monitor-value>",
// "<monitor-value>",
// "clusterID": "<cluster-id>",
// "rbd": {
// "radosNamespace": "<rados-namespace>"
// },
// "monitors":
// [
// "<monitor-value>",
// "<monitor-value>",
// ...
// ],
// "cephFS": {
@ -121,6 +125,10 @@ func GetRadosNamespace(pathToConfig, clusterID string) (string, error) {
return "", err
}
if cluster.RBD.RadosNamespace != "" {
return cluster.RBD.RadosNamespace, nil
}
return cluster.RadosNamespace, nil
}