implement GroupSnapshotter.GetGroupSnapshotStatus()
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user