-
Notifications
You must be signed in to change notification settings - Fork 62
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
Conversation
dbfb884
to
ac1c54b
Compare
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.
so this API is for specific file to flush memory to disk, right?
/lgtm
internal/os/volume/api.go
Outdated
@@ -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 |
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.
nit: Writes the file system cache to disk where given file path is located
client/api/volume/v1beta1/api.proto
Outdated
@@ -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) {} |
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.
I think we need a v1beta2 if we're going to modify the API since csi-proxy versions are not tied to k8s versions
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.
updated.
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. |
934cf70
to
b99c4b9
Compare
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.
One comment to fix a comment and switch to volume_id
client/api/volume/v1beta2/api.proto
Outdated
} | ||
|
||
message WriteVolumeCacheRequest { | ||
// Volume device ID of the volume to format |
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.
nit: please fix the comment above referring to format
. Also please use volume_id
as you mentioned and we discussed.
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.
updated. PTAL
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.
One more nit around volumeID. Otherwise lgtm.
internal/server/volume/server.go
Outdated
klog.V(4).Infof("calling WriteVolumeCache with request: %+v", request) | ||
response := &internal.WriteVolumeCacheResponse{} | ||
|
||
filePath := request.FilePath |
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.
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)
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.
thanks for catching it. updated. PTAL
4d30344
to
34e4770
Compare
add writevolumecache api to csi-proxy v1beta2 volume API group
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.
/lgtm
/approve
[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 |
add writevolumecache api to csi-proxy
What type of PR is this?
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?: