func (controller *Controller) CreateSnapshot(ctx context.Context, req *csi.CreateSnapshotRequest) (*csi.CreateSnapshotResponse, error) {
	name := strings.Replace(req.Name[9:], "-", "", -1)
	_, respStatus, err := controller.dothillClient.CreateSnapshot(req.SourceVolumeId, name)
	if err != nil && respStatus.ReturnCode != snapshotAlreadyExists {
		return nil, err
	}
	response, _, err := controller.dothillClient.ShowSnapshots(name)
	if err != nil {
		return nil, err
	}
	var snapshot *csi.Snapshot
	for _, object := range response.Objects {
		if object.Typ != "snapshots" {
			continue
		}
		snapshot, err = newSnapshotFromResponse(&object)
		if err != nil {
			return nil, err
		}
	}
	if snapshot == nil {
		return nil, errors.New("snapshot not found")
	}
	if snapshot.SourceVolumeId != req.SourceVolumeId {
		return nil, status.Error(codes.AlreadyExists, "cannot validate volume with empty ID")
	}
	return &csi.CreateSnapshotResponse{Snapshot: snapshot}, nil
}
CreateSnapshot creates a snapshot of the given volume
package controller
import (
	"context"
	"errors"
	"fmt"
	"strconv"
	"strings"
	"time"
	"github.com/container-storage-interface/spec/lib/go/csi"
	"github.com/enix/dothill-api-go/v2"
	"github.com/golang/protobuf/ptypes"
	"github.com/golang/protobuf/ptypes/timestamp"
	"google.golang.org/grpc/codes"
	"google.golang.org/grpc/status"
	"k8s.io/klog"
)