mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 02:33:34 +00:00
rbd: Add rados namespace support for rbd
Make sure to operate within the namespace if any given when dealing with rbd images and snapshots and their journals. Signed-off-by: Mehdy Khoshnoody <mehdy.khoshnoody@gmail.com>
This commit is contained in:
committed by
Humble Devassy Chirammal
parent
b5320d9273
commit
fc5eadf106
@ -37,6 +37,8 @@ const (
|
||||
type ClusterInfo struct {
|
||||
// ClusterID is used for unique identification
|
||||
ClusterID string `json:"clusterID"`
|
||||
// Namespace is the namespace in the pool
|
||||
RadosNamespace string `json:"radosNamespace"`
|
||||
// Monitors is monitor list for corresponding cluster ID
|
||||
Monitors []string `json:"monitors"`
|
||||
// CephFS contains CephFS specific options
|
||||
@ -50,6 +52,7 @@ type ClusterInfo struct {
|
||||
// [
|
||||
// {
|
||||
// "clusterID": "<cluster-id>",
|
||||
// "namespace": "<namespace>",
|
||||
// "monitors":
|
||||
// [
|
||||
// "<monitor-value>",
|
||||
@ -100,6 +103,15 @@ func Mons(pathToConfig, clusterID string) (string, error) {
|
||||
return strings.Join(cluster.Monitors, ","), nil
|
||||
}
|
||||
|
||||
// RadosNamespace returns the namespace for the given clusterID.
|
||||
func RadosNamespace(pathToConfig, clusterID string) (string, error) {
|
||||
cluster, err := readClusterInfo(pathToConfig, clusterID)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return cluster.RadosNamespace, 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