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

Add WriteVolumeCache API #84

Merged
merged 1 commit into from
Oct 12, 2020
Merged

Conversation

jingxu97
Copy link
Contributor

@jingxu97 jingxu97 commented Oct 3, 2020

add writevolumecache api to csi-proxy

What type of PR is this?

Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespaces from that line:

/kind api-change
/kind bug
/kind cleanup
/kind design
/kind documentation
/kind failing-test
/kind feature
/kind flake

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

Add WriteVolumeCache API

@k8s-ci-robot k8s-ci-robot added do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Oct 3, 2020
@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Oct 3, 2020
@jingxu97 jingxu97 force-pushed the oct/cache branch 2 times, most recently from dbfb884 to ac1c54b Compare October 3, 2020 23:33
Copy link
Member

@andyzhangx andyzhangx left a comment

Choose a reason for hiding this comment

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

so this API is for specific file to flush memory to disk, right?

/lgtm

@@ -47,6 +47,17 @@ func (VolAPIImplementor) FormatVolume(volumeID string) (err error) {
return nil
}

// WriteVolumeCache - Writes the file system cache to disk with given file path
Copy link
Member

Choose a reason for hiding this comment

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

nit: Writes the file system cache to disk where given file path is located

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 4, 2020
@@ -24,6 +24,8 @@ service Volume {
rpc GetVolumeDiskNumber(VolumeDiskNumberRequest) returns (VolumeDiskNumberResponse) {}
// GetVolumeIDFromMount gets the volume id for a given mount
rpc GetVolumeIDFromMount(VolumeIDFromMountRequest) returns (VolumeIDFromMountResponse) {}
// WriteVolumeCache write volume cache to disk
rpc WriteVolumeCache(WriteVolumeCacheRequest) returns (WriteVolumeCacheResponse) {}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we need a v1beta2 if we're going to modify the API since csi-proxy versions are not tied to k8s versions

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated.

@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed 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. labels Oct 9, 2020
@jingxu97
Copy link
Contributor Author

jingxu97 commented Oct 9, 2020

so this API is for specific file to flush memory to disk, right?

/lgtm

actually it mainly for volume to flush cache data before calling unstagevolume. I am considering to use volumeId too. For certain plugins like gce pd, we don't keep volume unique id, instead, it uses mount path. Get-volume could accept either volumeId or file path. But all other volume API currently use uniqueId, so maybe it makes more sense to use volumeId instead of path.
kubernetes-sigs/azuredisk-csi-driver#381 (comment)
@ddebroy

@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Oct 9, 2020
@jingxu97 jingxu97 force-pushed the oct/cache branch 5 times, most recently from 934cf70 to b99c4b9 Compare October 9, 2020 03:20
Copy link
Contributor

@ddebroy ddebroy left a comment

Choose a reason for hiding this comment

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

One comment to fix a comment and switch to volume_id

}

message WriteVolumeCacheRequest {
// Volume device ID of the volume to format
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: please fix the comment above referring to format. Also please use volume_id as you mentioned and we discussed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated. PTAL

Copy link
Contributor

@ddebroy ddebroy left a comment

Choose a reason for hiding this comment

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

One more nit around volumeID. Otherwise lgtm.

klog.V(4).Infof("calling WriteVolumeCache with request: %+v", request)
response := &internal.WriteVolumeCacheResponse{}

filePath := request.FilePath
Copy link
Contributor

Choose a reason for hiding this comment

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

This needs to be. Since the type is string, the compiler did not catch it.

	volumeID := request.VolumeId
	if volumeID == "" {
		klog.Errorf("volume id empty")
		return response, fmt.Errorf("volume id empty")
	}
	err := s.hostAPI. WriteVolumeCache(volumeID)

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 catching it. updated. PTAL

@jingxu97 jingxu97 force-pushed the oct/cache branch 6 times, most recently from 4d30344 to 34e4770 Compare October 9, 2020 22:40
add writevolumecache api to csi-proxy v1beta2 volume API group
Copy link
Contributor

@ddebroy ddebroy left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ddebroy, jingxu97

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 lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 10, 2020
@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Oct 12, 2020
@k8s-ci-robot k8s-ci-robot merged commit b3cbf0c into kubernetes-csi:master Oct 12, 2020
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. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants