mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-12-18 02:50:30 +00:00
pkg/cephfs: Use request name to generate deterministic volume names
This commit is contained in:
parent
04872e5ebf
commit
d9fbdeb517
@ -43,7 +43,7 @@ func (cs *controllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
|
|||||||
return nil, status.Error(codes.InvalidArgument, err.Error())
|
return nil, status.Error(codes.InvalidArgument, err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
volId := newVolumeID()
|
volId := makeVolumeID(req.GetName())
|
||||||
|
|
||||||
conf := cephConfigData{Monitors: volOptions.Monitors, VolumeID: volId}
|
conf := cephConfigData{Monitors: volOptions.Monitors, VolumeID: volId}
|
||||||
if err = conf.writeToFile(); err != nil {
|
if err = conf.writeToFile(); err != nil {
|
||||||
|
@ -27,14 +27,13 @@ import (
|
|||||||
"google.golang.org/grpc/status"
|
"google.golang.org/grpc/status"
|
||||||
|
|
||||||
"github.com/container-storage-interface/spec/lib/go/csi"
|
"github.com/container-storage-interface/spec/lib/go/csi"
|
||||||
"github.com/pborman/uuid"
|
|
||||||
"k8s.io/kubernetes/pkg/util/mount"
|
"k8s.io/kubernetes/pkg/util/mount"
|
||||||
)
|
)
|
||||||
|
|
||||||
type volumeID string
|
type volumeID string
|
||||||
|
|
||||||
func newVolumeID() volumeID {
|
func makeVolumeID(volName string) volumeID {
|
||||||
return volumeID("csi-cephfs-" + uuid.NewUUID().String())
|
return volumeID("csi-cephfs-" + volName)
|
||||||
}
|
}
|
||||||
|
|
||||||
func execCommand(command string, args ...string) ([]byte, error) {
|
func execCommand(command string, args ...string) ([]byte, error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user