Skip to content
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

Merged
merged 3 commits into from
Nov 15, 2018
Merged

csi: implement Snapshot functionality #103

merged 3 commits into from
Nov 15, 2018

Conversation

fatih
Copy link
Contributor

@fatih fatih commented Nov 14, 2018

This PR adds Snapshot functionality. We're passing all unit test successfully.

// 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())

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

snapshots = snapshots[:req.MaxEntries]
}

var entries []*csi.ListSnapshotsResponse_Entry

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))

ll.Info("list snapshots is called")

// fetch all entries
listOpts := &godo.ListOptions{}
Copy link

@aybabtme aybabtme Nov 14, 2018

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

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

@aybabtme
Copy link

lgtm

@fatih fatih merged commit 6f315c9 into master Nov 15, 2018
@fatih fatih deleted the snapshotting branch November 15, 2018 10:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants