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

Don't wait for the snapshot to be completed #209

Merged

Conversation

tsmetana
Copy link
Contributor

This patch changes the way the snapshots are being created: Originally the driver waited for the snapshot to complete. This is wrong since the snapshot creation may take a really long time. Also the gRPC would most likely timeout (the call is meant to be blocking) and cause all kinds of other problems.

Now the driver retruns the snapshot as soon as it appears in EC2 with ReadyToUse state in false and updates the state accordingly when the controller calls the SnapshotCreate again with the same parameters.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Feb 13, 2019
@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Feb 13, 2019
@coveralls
Copy link

Pull Request Test Coverage Report for Build 440

  • 6 of 9 (66.67%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.01%) to 63.825%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/cloud/cloud.go 5 8 62.5%
Totals Coverage Status
Change from base Build 425: 0.01%
Covered Lines: 921
Relevant Lines: 1443

💛 - Coveralls

@coveralls
Copy link

coveralls commented Feb 13, 2019

Pull Request Test Coverage Report for Build 450

  • 7 of 9 (77.78%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.07%) to 63.74%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/cloud/cloud.go 6 8 75.0%
Totals Coverage Status
Change from base Build 425: -0.07%
Covered Lines: 893
Relevant Lines: 1401

💛 - Coveralls

@@ -732,7 +740,7 @@ func (c *cloud) waitForSnapshotCreate(ctx context.Context, snapshotID *string) e
case "completed":
return true, nil
case "pending":
return false, nil
return true, nil
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we are always returning true here, do we still need this waitForSnapshotCreate when creating snapshot? Can we just check the snapshot state returned from the CreateSnapshotWithContext?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is rather paranoid -- I only wanted to be sure DescribeSnapshotsWithContext can find the newly created snapshot.

SnapshotID: aws.StringValue(ec2Snapshot.SnapshotId),
SourceVolumeID: aws.StringValue(ec2Snapshot.VolumeId),
Size: snapshotSize,
CreationTime: aws.TimeValue(ec2Snapshot.StartTime),
}
if aws.StringValue(ec2Snapshot.State) == "completed" {
snapshot.ReadyToUse = true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
snapshot.ReadyToUse = true
snapshot.ReadyToUse = aws.StringValue(ec2Snapshot.State) == "completed"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will change it.

@leakingtapan
Copy link
Contributor

/cc @dkoshkin

@tsmetana tsmetana force-pushed the snapshot-return-pending branch from 0a0872a to 128122b Compare February 18, 2019 15:07
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Feb 18, 2019
@tsmetana
Copy link
Contributor Author

OK. I've removed the waiting method.

@leakingtapan
Copy link
Contributor

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 18, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: leakingtapan, tsmetana

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 18, 2019
@leakingtapan leakingtapan merged commit 51206be into kubernetes-sigs:snapshot Feb 18, 2019
jsafrane pushed a commit to jsafrane/aws-ebs-csi-driver that referenced this pull request Jul 18, 2023
…t/cherry-pick-208-to-release-4.11

[release-4.11] OCPBUGS-1749: UPSTREAM: 1398: Add resolver to handle custom endpoints
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants