add DeleteVolumeGroupSnapshot API to delete group snapshot
This commit is contained in:
@@ -18,11 +18,12 @@ package group_snapshotter
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/container-storage-interface/spec/lib/go/csi"
|
||||
csirpc "github.com/kubernetes-csi/csi-lib-utils/rpc"
|
||||
"google.golang.org/grpc"
|
||||
klog "k8s.io/klog/v2"
|
||||
"time"
|
||||
)
|
||||
|
||||
// GroupSnapshotter implements CreateGroupSnapshot/DeleteGroupSnapshot operations against a CSI driver.
|
||||
@@ -31,7 +32,7 @@ type GroupSnapshotter interface {
|
||||
CreateGroupSnapshot(ctx context.Context, groupSnapshotName string, volumeIDs []string, parameters map[string]string, snapshotterCredentials map[string]string) (driverName string, groupSnapshotId string, snapshots []*csi.Snapshot, timestamp time.Time, readyToUse bool, err error)
|
||||
|
||||
// DeleteGroupSnapshot deletes a group snapshot of multiple volumes
|
||||
DeleteGroupSnapshot(ctx context.Context, groupSnapshotID string, snapshotterCredentials map[string]string) (err error)
|
||||
DeleteGroupSnapshot(ctx context.Context, groupSnapshotID string, snapshotIDs []string, snapshotterCredentials map[string]string) (err error)
|
||||
|
||||
// GetGroupSnapshotStatus returns if a group snapshot is ready to use, its creation time, etc
|
||||
GetGroupSnapshotStatus(ctx context.Context, groupSnapshotID string, snapshotterListCredentials map[string]string) (bool, time.Time, error)
|
||||
@@ -74,8 +75,20 @@ func (gs *groupSnapshot) CreateGroupSnapshot(ctx context.Context, groupSnapshotN
|
||||
|
||||
}
|
||||
|
||||
func (gs *groupSnapshot) DeleteGroupSnapshot(ctx context.Context, groupSnapshotID string, snapshotterCredentials map[string]string) error {
|
||||
// TODO: Implement DeleteGroupSnapshot
|
||||
func (gs *groupSnapshot) DeleteGroupSnapshot(ctx context.Context, groupSnapshotID string, snapshotIds []string, snapshotterCredentials map[string]string) error {
|
||||
client := csi.NewGroupControllerClient(gs.conn)
|
||||
|
||||
req := csi.DeleteVolumeGroupSnapshotRequest{
|
||||
Secrets: snapshotterCredentials,
|
||||
GroupSnapshotId: groupSnapshotID,
|
||||
SnapshotIds: snapshotIds,
|
||||
}
|
||||
|
||||
_, err := client.DeleteVolumeGroupSnapshot(ctx, &req)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user