implement GroupSnapshotter.GetGroupSnapshotStatus()

This commit is contained in:
Niels de Vos
2023-05-25 14:55:47 +02:00
parent 3124b8c9a4
commit d0f443f564
3 changed files with 33 additions and 14 deletions

View File

@@ -35,7 +35,7 @@ type GroupSnapshotter interface {
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)
GetGroupSnapshotStatus(ctx context.Context, groupSnapshotID string, snapshotIDs []string, snapshotterListCredentials map[string]string) (bool, time.Time, error)
}
type groupSnapshot struct {
@@ -92,7 +92,21 @@ func (gs *groupSnapshot) DeleteGroupSnapshot(ctx context.Context, groupSnapshotI
return nil
}
func (gs *groupSnapshot) GetGroupSnapshotStatus(ctx context.Context, groupSnapshotID string, snapshotterListCredentials map[string]string) (bool, time.Time, error) {
// TODO: Implement GetGroupSnapshotStatus
return true, time.Now(), nil
func (gs *groupSnapshot) GetGroupSnapshotStatus(ctx context.Context, groupSnapshotID string, snapshotIds []string, snapshotterListCredentials map[string]string) (bool, time.Time, error) {
klog.V(5).Infof("CSI GetGroupSnapshotStatus: %s", groupSnapshotID)
client := csi.NewGroupControllerClient(gs.conn)
req := csi.GetVolumeGroupSnapshotRequest{
Secrets: snapshotterListCredentials,
GroupSnapshotId: groupSnapshotID,
SnapshotIds: snapshotIds,
}
rsp, err := client.GetVolumeGroupSnapshot(ctx, &req)
if err != nil {
return false, time.Time{}, err
}
klog.V(5).Infof("CSI GetGroupSnapshot: group snapshot ID [%s] time stamp [%v] snapshots [%v] readyToUse [%v]", rsp.GroupSnapshot.GroupSnapshotId, rsp.GroupSnapshot.CreationTime, rsp.GroupSnapshot.Snapshots, rsp.GroupSnapshot.ReadyToUse)
return rsp.GroupSnapshot.ReadyToUse, rsp.GroupSnapshot.CreationTime.AsTime(), nil
}