1
0
mirror of https://github.com/gluster/glusterd2.git synced 2026-02-06 15:46:00 +01:00
Files
glusterd2/utils/volumeutils.go
Prashanth Pai 212a6f7dc0 Use Node UUID in brick volfile path
Signed-off-by: Prashanth Pai <ppai@redhat.com>
2017-02-22 11:19:10 +05:30

23 lines
667 B
Go

package utils
import (
"fmt"
"path"
"strings"
config "github.com/spf13/viper"
)
// GetVolumeDir returns path to volume directory
func GetVolumeDir(volumeName string) string {
return path.Join(config.GetString("localstatedir"), "vols", volumeName)
}
// GetBrickVolFilePath returns path to brick volfile
func GetBrickVolFilePath(volumeName string, brickNodeID string, brickPath string) string {
volumeDir := GetVolumeDir(volumeName)
brickPathWithoutSlashes := strings.Trim(strings.Replace(brickPath, "/", "-", -1), "-")
volFileName := fmt.Sprintf("%s.%s.%s.vol", volumeName, brickNodeID, brickPathWithoutSlashes)
return path.Join(volumeDir, volFileName)
}