mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 02:33:34 +00:00
util: add support to configure mirror daemon count
Currently we are assuming that only one rbd mirror daemon running on the ceph cluster but that is not true for many cases and it can be more that one, this PR make this as a configurable parameter. fixes: #4312 Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
committed by
mergify[bot]
parent
51d1d46dd2
commit
4c2d2caf9f
@ -45,6 +45,7 @@ const (
|
||||
"clusterID": "<cluster-id>",
|
||||
"rbd": {
|
||||
"radosNamespace": "<rados-namespace>"
|
||||
"mirrorDaemonCount": 1
|
||||
},
|
||||
"monitors": [
|
||||
"<monitor-value>",
|
||||
@ -105,6 +106,22 @@ func GetRadosNamespace(pathToConfig, clusterID string) (string, error) {
|
||||
return cluster.RBD.RadosNamespace, nil
|
||||
}
|
||||
|
||||
// GetRBDMirrorDaemonCount returns the number of mirror daemon count for the
|
||||
// given clusterID.
|
||||
func GetRBDMirrorDaemonCount(pathToConfig, clusterID string) (int, error) {
|
||||
cluster, err := readClusterInfo(pathToConfig, clusterID)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
// if it is empty, set the default to 1 which is most common in a cluster.
|
||||
if cluster.RBD.MirrorDaemonCount == 0 {
|
||||
return 1, nil
|
||||
}
|
||||
|
||||
return cluster.RBD.MirrorDaemonCount, nil
|
||||
}
|
||||
|
||||
// CephFSSubvolumeGroup returns the subvolumeGroup for CephFS volumes. If not set, it returns the default value "csi".
|
||||
func CephFSSubvolumeGroup(pathToConfig, clusterID string) (string, error) {
|
||||
cluster, err := readClusterInfo(pathToConfig, clusterID)
|
||||
|
Reference in New Issue
Block a user