Delete individual volume snapshots as part of the group snapshot delete API and prevent users from deleting individual volume snapshots if it is part of an existing group snapshot

Also revert commit bb29899ca3.
This commit is contained in:
Raunak Pradip Shah
2023-11-07 11:26:37 +05:30
parent 5ca300ec1e
commit 060ee23d6d
13 changed files with 129 additions and 80 deletions

View File

@@ -882,10 +882,11 @@ type listCall struct {
snapshotID string
secrets map[string]string
// information to return
readyToUse bool
createTime time.Time
size int64
err error
readyToUse bool
createTime time.Time
size int64
err error
groupSnapshotID string
}
type deleteCall struct {
@@ -982,10 +983,10 @@ func (f *fakeSnapshotter) DeleteSnapshot(ctx context.Context, snapshotID string,
return call.err
}
func (f *fakeSnapshotter) GetSnapshotStatus(ctx context.Context, snapshotID string, snapshotterListCredentials map[string]string) (bool, time.Time, int64, error) {
func (f *fakeSnapshotter) GetSnapshotStatus(ctx context.Context, snapshotID string, snapshotterListCredentials map[string]string) (bool, time.Time, int64, string, error) {
if f.listCallCounter >= len(f.listCalls) {
f.t.Errorf("Unexpected CSI list Snapshot call: snapshotID=%s, index: %d, calls: %+v", snapshotID, f.createCallCounter, f.createCalls)
return false, time.Time{}, 0, fmt.Errorf("unexpected call")
return false, time.Time{}, 0, "", fmt.Errorf("unexpected call")
}
call := f.listCalls[f.listCallCounter]
f.listCallCounter++
@@ -1002,10 +1003,10 @@ func (f *fakeSnapshotter) GetSnapshotStatus(ctx context.Context, snapshotID stri
}
if err != nil {
return false, time.Time{}, 0, fmt.Errorf("unexpected call")
return false, time.Time{}, 0, "", fmt.Errorf("unexpected call")
}
return call.readyToUse, call.createTime, call.size, call.err
return call.readyToUse, call.createTime, call.size, call.groupSnapshotID, call.err
}
func newSnapshotError(message string) *crdv1.VolumeSnapshotError {