diff --git a/internal/cephfs/util.go b/internal/cephfs/util.go index 05834a1c9..42ecb03ce 100644 --- a/internal/cephfs/util.go +++ b/internal/cephfs/util.go @@ -23,7 +23,6 @@ import ( "github.com/ceph/ceph-csi/internal/util" "github.com/ceph/ceph-csi/internal/util/log" - "github.com/container-storage-interface/spec/lib/go/csi" "github.com/golang/protobuf/ptypes" "github.com/golang/protobuf/ptypes/timestamp" ) @@ -36,24 +35,6 @@ func execCommandErr(ctx context.Context, program string, args ...string) error { return err } -func genSnapFromOptions(ctx context.Context, req *csi.CreateSnapshotRequest) (snap *cephfsSnapshot, err error) { - cephfsSnap := &cephfsSnapshot{} - cephfsSnap.RequestName = req.GetName() - snapOptions := req.GetParameters() - - cephfsSnap.Monitors, cephfsSnap.ClusterID, err = util.GetMonsAndClusterID(snapOptions) - if err != nil { - log.ErrorLog(ctx, "failed getting mons (%s)", err) - - return nil, err - } - if namePrefix, ok := snapOptions["snapshotNamePrefix"]; ok { - cephfsSnap.NamePrefix = namePrefix - } - - return cephfsSnap, nil -} - func parseTime(ctx context.Context, createTime time.Time) (*timestamp.Timestamp, error) { tm, err := ptypes.TimestampProto(createTime) if err != nil { diff --git a/internal/cephfs/volumeoptions.go b/internal/cephfs/volumeoptions.go index 3a44cae22..ea62ecbe0 100644 --- a/internal/cephfs/volumeoptions.go +++ b/internal/cephfs/volumeoptions.go @@ -27,6 +27,7 @@ import ( cerrors "github.com/ceph/ceph-csi/internal/cephfs/errors" "github.com/ceph/ceph-csi/internal/util" + "github.com/ceph/ceph-csi/internal/util/log" ) type volumeOptions struct { @@ -586,3 +587,21 @@ func newSnapshotOptionsFromID( return &volOptions, &info, &sid, nil } + +func genSnapFromOptions(ctx context.Context, req *csi.CreateSnapshotRequest) (snap *cephfsSnapshot, err error) { + cephfsSnap := &cephfsSnapshot{} + cephfsSnap.RequestName = req.GetName() + snapOptions := req.GetParameters() + + cephfsSnap.Monitors, cephfsSnap.ClusterID, err = util.GetMonsAndClusterID(snapOptions) + if err != nil { + log.ErrorLog(ctx, "failed getting mons (%s)", err) + + return nil, err + } + if namePrefix, ok := snapOptions["snapshotNamePrefix"]; ok { + cephfsSnap.NamePrefix = namePrefix + } + + return cephfsSnap, nil +}