-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
csi: implement Snapshot functionality #103
Conversation
driver/controller.go
Outdated
// snapshot already exists, return the information we have | ||
createdAt, err := time.Parse(time.RFC3339, snap.Created) | ||
if err != nil { | ||
return nil, status.Errorf(codes.Internal, "couldn't parse snapshot's created field: %s", err.Error()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use a fmt.Errorf
here, not a grpc error
driver/controller.go
Outdated
snapshots = snapshots[:req.MaxEntries] | ||
} | ||
|
||
var entries []*csi.ListSnapshotsResponse_Entry |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
entries := make([]*csi.ListSnapshotsResponse_Entry, 0, len(snapshots))
driver/controller.go
Outdated
ll.Info("list snapshots is called") | ||
|
||
// fetch all entries | ||
listOpts := &godo.ListOptions{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe set the listOpts.PerPage = req.MaxEntries
value here. not guaranteed to be respected but at least it'll avoid making unnecessary calls if the two align
return nil, err | ||
} | ||
|
||
listOpts.Page = page + 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also set listOpts.PerPage
according to the response you got
lgtm |
This PR adds Snapshot functionality. We're passing all unit test successfully.