Skip to content

Commit

Permalink
Add WriteVolumeCache API to v1beta2 Volume API group
Browse files Browse the repository at this point in the history
add writevolumecache api to csi-proxy v1beta2 volume API group
  • Loading branch information
jingxu97 committed Oct 9, 2020
1 parent 897abed commit 506d1fd
Show file tree
Hide file tree
Showing 15 changed files with 917 additions and 62 deletions.
238 changes: 177 additions & 61 deletions client/api/volume/v1beta1/api.pb.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion client/api/volume/v1beta1/api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,4 @@ message VolumeIDFromMountRequest {
message VolumeIDFromMountResponse {
// Mount
string volume_id = 1;
}
}
4 changes: 4 additions & 0 deletions client/groups/volume/v1beta1/client_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions integrationtests/volume_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ func simpleE2e(t *testing.T) {
if err != nil {
t.Fatalf("Volume id %s mount to path %s failed. Error: %v", volumeID, mountPath, err)
}

// Dismount the volume
dismountVolumeRequest := &v1alpha1.DismountVolumeRequest{
VolumeId: volumeID,
Expand Down
10 changes: 10 additions & 0 deletions internal/os/volume/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@ func (VolAPIImplementor) FormatVolume(volumeID string) (err error) {
return nil
}

// WriteVolumeCache - Writes the file system cache to disk with given file path
func (VolAPIImplementor) WriteVolumeCache(filePath string) (err error) {
cmd := fmt.Sprintf("Get-Volume -FilePath \"%s\" | Write-Volumecache", filePath)
out, err := runExec(cmd)
if err != nil {
return fmt.Errorf("error writing volume cache. cmd: %s, output: %s, error: %v", cmd, string(out), err)
}
return nil
}

// IsVolumeFormatted - Check if the volume is formatted with the pre specified filesystem(typically ntfs).
func (VolAPIImplementor) IsVolumeFormatted(volumeID string) (bool, error) {
cmd := fmt.Sprintf("(Get-Volume -UniqueId \"%s\" -ErrorAction Stop).FileSystemType", volumeID)
Expand Down
7 changes: 7 additions & 0 deletions internal/server/volume/api_group_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions internal/server/volume/internal/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ type FormatVolumeRequest struct {
type FormatVolumeResponse struct {
}

type WriteVolumeCacheRequest struct {
FilePath string
}

type WriteVolumeCacheResponse struct {
}

type DismountVolumeRequest struct {
VolumeId string
Path string
Expand Down
1 change: 1 addition & 0 deletions internal/server/volume/internal/types_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 38 additions & 0 deletions internal/server/volume/internal/v1beta1/conversion_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions internal/server/volume/internal/v1beta1/server_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions internal/server/volume/internal/v1beta2/conversion.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package v1beta2

// Add manual conversion functions here to override automatic conversion functions
Loading

0 comments on commit 506d1fd

Please sign in to comment.