Skip to content
This repository was archived by the owner on Mar 16, 2021. It is now read-only.

Conversation

@wackxu
Copy link
Contributor

@wackxu wackxu commented Sep 4, 2018

based on #94

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 4, 2018
@wackxu
Copy link
Contributor Author

wackxu commented Sep 4, 2018

/assign @lpabon @xing-yang

@k8s-ci-robot
Copy link
Contributor

@wackxu: GitHub didn't allow me to assign the following users: xing-yang.

Note that only kubernetes-csi members and repo collaborators can be assigned.
For more information please see the contributor guide

Details

In response to this:

/assign @lpabon @xing-yang

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Copy link
Contributor

@lpabon lpabon left a comment

Choose a reason for hiding this comment

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

Looks great, just a few changes

contentSource := req.GetVolumeContentSource()
if contentSource.GetSnapshot() != nil {
snapshotId := contentSource.GetSnapshot().GetId()
snapshot, ok := hostPathVolumeSnapshots[snapshotId]
Copy link
Contributor

Choose a reason for hiding this comment

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

We keep them in memory? So if we restart the driver they get lost, right? if this is is true, we should document this somewhere. I am ok with having it memory and documenting that this is a test-only driver.

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, now, we store both hostpath volume and snapshot info in memory, agree with that it need document this since this a test-only driver.

return nil, status.Errorf(codes.NotFound, "cannot find snapshot %v", snapshotId)
}
snapshotPath := snapshot.Path
args := []string{"zxvf", snapshotPath, "-C", path}
Copy link
Contributor

Choose a reason for hiding this comment

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

nice snapshot method 👍

snapshotID := req.GetSnapshotId()
glog.V(4).Infof("deleting volume %s", snapshotID)
path := snapshotRoot + snapshotID + ".tgz"
os.RemoveAll(path)
Copy link
Contributor

Choose a reason for hiding this comment

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

Could log if the file not file for some reason. May be a good idea to return error if not found, which would be good for e2e tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we already have a talk about this, #94 (comment)

@lpabon
Copy link
Contributor

lpabon commented Sep 4, 2018

Could you also add an issue to add unit tests to hostpath driver? We need to start adding tests.

@wackxu wackxu mentioned this pull request Sep 4, 2018
@wackxu
Copy link
Contributor Author

wackxu commented Sep 4, 2018

@lpabon Open issue #109

if !ok {
return nil, status.Errorf(codes.NotFound, "cannot find snapshot %v", snapshotId)
}
snapshotPath := snapshot.Path

Choose a reason for hiding this comment

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

Do we also check the snapshot status before using it? This won't matter here, but a good practice if this example is being picked for other places.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for your review, updated

@sarjeet2013
Copy link

LGTM

@lpabon
Copy link
Contributor

lpabon commented Sep 11, 2018

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 11, 2018
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lpabon, wackxu

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

The pull request process is described here

Details 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 Sep 11, 2018
@k8s-ci-robot k8s-ci-robot merged commit 9ed907a into kubernetes-retired:master Sep 11, 2018
@wackxu wackxu deleted the restorevolume branch September 12, 2018 01:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

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 Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants