pkg/cephfs: Use request name to generate deterministic volume names

This commit is contained in:
Mike Cronce 2018-12-04 21:39:00 -05:00
parent 04872e5ebf
commit d9fbdeb517
2 changed files with 3 additions and 4 deletions

View File

@ -43,7 +43,7 @@ func (cs *controllerServer) CreateVolume(ctx context.Context, req *csi.CreateVol
return nil, status.Error(codes.InvalidArgument, err.Error())
}
volId := newVolumeID()
volId := makeVolumeID(req.GetName())
conf := cephConfigData{Monitors: volOptions.Monitors, VolumeID: volId}
if err = conf.writeToFile(); err != nil {

View File

@ -27,14 +27,13 @@ import (
"google.golang.org/grpc/status"
"github.com/container-storage-interface/spec/lib/go/csi"
"github.com/pborman/uuid"
"k8s.io/kubernetes/pkg/util/mount"
)
type volumeID string
func newVolumeID() volumeID {
return volumeID("csi-cephfs-" + uuid.NewUUID().String())
func makeVolumeID(volName string) volumeID {
return volumeID("csi-cephfs-" + volName)
}
func execCommand(command string, args ...string) ([]byte, error) {