@@ -36,7 +36,7 @@ type Handler interface {
36
36
DeleteSnapshot (content * crdv1.VolumeSnapshotContent , snapshotterCredentials map [string ]string ) error
37
37
GetSnapshotStatus (content * crdv1.VolumeSnapshotContent , snapshotterListCredentials map [string ]string ) (bool , time.Time , int64 , string , error )
38
38
CreateGroupSnapshot (content * crdv1alpha1.VolumeGroupSnapshotContent , parameters map [string ]string , snapshotterCredentials map [string ]string ) (string , string , []* csi.Snapshot , time.Time , bool , error )
39
- GetGroupSnapshotStatus (content * crdv1alpha1.VolumeGroupSnapshotContent , snapshotterListCredentials map [string ]string ) (bool , time.Time , error )
39
+ GetGroupSnapshotStatus (groupSnapshotContent * crdv1alpha1.VolumeGroupSnapshotContent , snapshotIDs [] string , snapshotterListCredentials map [string ]string ) (bool , time.Time , error )
40
40
DeleteGroupSnapshot (content * crdv1alpha1.VolumeGroupSnapshotContent , SnapshotID []string , snapshotterCredentials map [string ]string ) error
41
41
}
42
42
@@ -188,23 +188,27 @@ func (handler *csiHandler) DeleteGroupSnapshot(content *crdv1alpha1.VolumeGroupS
188
188
return handler .groupSnapshotter .DeleteGroupSnapshot (ctx , groupSnapshotHandle , snapshotIDs , snapshotterCredentials )
189
189
}
190
190
191
- func (handler * csiHandler ) GetGroupSnapshotStatus (groupSnapshotContent * crdv1alpha1.VolumeGroupSnapshotContent , snapshotterListCredentials map [string ]string ) (bool , time.Time , error ) {
191
+ func (handler * csiHandler ) GetGroupSnapshotStatus (content * crdv1alpha1.VolumeGroupSnapshotContent , snapshotIDs [] string , snapshotterListCredentials map [string ]string ) (bool , time.Time , error ) {
192
192
ctx , cancel := context .WithTimeout (context .Background (), handler .timeout )
193
193
defer cancel ()
194
194
195
+ // NOTE: snapshotIDs are required for GetGroupSnapshotStatus
196
+ if len (snapshotIDs ) == 0 {
197
+ return false , time.Time {}, fmt .Errorf ("cannot list group snapshot %s. No snapshots found in the group snapshot content" , content .Name )
198
+ }
195
199
var groupSnapshotHandle string
196
200
var err error
197
- if groupSnapshotContent .Status != nil && groupSnapshotContent .Status .VolumeGroupSnapshotHandle != nil {
198
- groupSnapshotHandle = * groupSnapshotContent .Status .VolumeGroupSnapshotHandle
199
- } else if groupSnapshotContent .Spec .Source .GroupSnapshotHandles != nil {
200
- groupSnapshotHandle = groupSnapshotContent .Spec .Source .GroupSnapshotHandles .VolumeGroupSnapshotHandle
201
+ if content .Status != nil && content .Status .VolumeGroupSnapshotHandle != nil {
202
+ groupSnapshotHandle = * content .Status .VolumeGroupSnapshotHandle
203
+ } else if content .Spec .Source .GroupSnapshotHandles != nil {
204
+ groupSnapshotHandle = content .Spec .Source .GroupSnapshotHandles .VolumeGroupSnapshotHandle
201
205
} else {
202
- return false , time.Time {}, fmt .Errorf ("failed to list group snapshot for group snapshot content %s: groupSnapshotHandle is missing" , groupSnapshotContent .Name )
206
+ return false , time.Time {}, fmt .Errorf ("failed to list group snapshot for group snapshot content %s: groupSnapshotHandle is missing" , content .Name )
203
207
}
204
208
205
- csiSnapshotStatus , timestamp , err := handler .groupSnapshotter .GetGroupSnapshotStatus (ctx , groupSnapshotHandle , snapshotterListCredentials )
209
+ csiSnapshotStatus , timestamp , err := handler .groupSnapshotter .GetGroupSnapshotStatus (ctx , groupSnapshotHandle , snapshotIDs , snapshotterListCredentials )
206
210
if err != nil {
207
- return false , time.Time {}, fmt .Errorf ("failed to list group snapshot for group snapshot content %s: %q" , groupSnapshotContent .Name , err )
211
+ return false , time.Time {}, fmt .Errorf ("failed to list group snapshot for group snapshot content %s: %q" , content .Name , err )
208
212
}
209
213
210
214
return csiSnapshotStatus , timestamp , nil
0 commit comments