Skip to content

Commit

Permalink
Merge pull request #137 from codenrhoden/csi-1.2.0
Browse files Browse the repository at this point in the history
CSI spec 1.2.0
  • Loading branch information
codenrhoden committed Jan 28, 2020
2 parents e059537 + 6dea40e commit 4989490
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 18 deletions.
6 changes: 5 additions & 1 deletion csc/cmd/controller_expand_volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
var expandVolume struct {
reqBytes int64
limBytes int64
volCap *volumeCapabilitySliceArg
}

var expandVolumeCmd = &cobra.Command{
Expand All @@ -28,7 +29,8 @@ USAGE
RunE: func(cmd *cobra.Command, args []string) error {

req := csi.ControllerExpandVolumeRequest{
Secrets: root.secrets,
Secrets: root.secrets,
VolumeCapability: expandVolume.volCap.data[0],
}

if expandVolume.reqBytes > 0 || expandVolume.limBytes > 0 {
Expand Down Expand Up @@ -68,6 +70,8 @@ func init() {

flagLimitBytes(expandVolumeCmd.Flags(), &expandVolume.limBytes)

flagVolumeCapability(expandVolumeCmd.Flags(), expandVolume.volCap)

flagWithRequiresCreds(
expandVolumeCmd.Flags(),
&root.withRequiresCreds,
Expand Down
1 change: 1 addition & 0 deletions csc/cmd/controller_list_snapshots.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ var listSnapshotsCmd = &cobra.Command{
StartingToken: listSnapshots.startingToken,
SnapshotId: listSnapshots.SnapshotId,
SourceVolumeId: listSnapshots.sourceVolumeId,
Secrets: root.secrets,
}

// If auto-paging is not enabled then send a normal request.
Expand Down
16 changes: 11 additions & 5 deletions csc/cmd/node_expand_volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ import (
)

var nodeExpandVolume struct {
reqBytes int64
limBytes int64
volPath string
reqBytes int64
limBytes int64
stagingPath string
volCap *volumeCapabilitySliceArg
}

var nodeExpandVolumeCmd = &cobra.Command{
Expand All @@ -30,8 +31,10 @@ USAGE

// Set the volume name and path for the current request.
req := csi.NodeExpandVolumeRequest{
VolumeId: args[0],
VolumePath: args[1],
VolumeId: args[0],
VolumePath: args[1],
StagingTargetPath: nodeExpandVolume.stagingPath,
VolumeCapability: nodeExpandVolume.volCap.data[0],
}

if nodeExpandVolume.reqBytes > 0 || nodeExpandVolume.limBytes > 0 {
Expand Down Expand Up @@ -66,4 +69,7 @@ func init() {

flagLimitBytes(nodeExpandVolumeCmd.Flags(), &nodeExpandVolume.limBytes)

flagStagingTargetPath(nodeExpandVolumeCmd.Flags(), &nodeExpandVolume.stagingPath)

flagVolumeCapability(nodeExpandVolumeCmd.Flags(), nodeExpandVolume.volCap)
}
13 changes: 4 additions & 9 deletions csc/cmd/node_get_volume_stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,13 @@ import (
"github.com/container-storage-interface/spec/lib/go/csi"
)

var nodeGetVolumeStats struct {
nodeID string
stagingTargetPath string
pubInfo mapOfStringArg
attribs mapOfStringArg
caps volumeCapabilitySliceArg
}

var nodeGetVolumeStatsCmd = &cobra.Command{
Use: "stats",
Short: `invokes the rpc "NodeGetVolumeStats"`,
Example: `
USAGE
csc node stats VOLUME_ID:VOLUME_PATH [VOLUME_ID:VOLUME_PATh...]
csc node stats VOLUME_ID:VOLUME_PATH:STAGING_PATH [VOLUME_ID:VOLUME_PATH:STAGING_PATH...]
`,
Args: cobra.MinimumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
Expand All @@ -39,6 +31,9 @@ USAGE
// Set the volume ID and volume path for the current request.
split := strings.Split(args[i], ":")
req.VolumeId, req.VolumePath = split[0], split[1]
if len(split) > 2 {
req.StagingTargetPath = split[2]
}

log.WithField("request", req).Debug("staging volume")
rep, err := node.client.NodeGetVolumeStats(ctx, &req)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.12
require (
github.com/akutz/gosync v0.1.0
github.com/akutz/memconn v0.1.0
github.com/container-storage-interface/spec v1.1.0
github.com/container-storage-interface/spec v1.2.0
github.com/coreos/bbolt v1.3.3 // indirect
github.com/coreos/etcd v3.3.13+incompatible
github.com/coreos/go-semver v0.3.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24
github.com/beorn7/perks v1.0.0 h1:HWo1m869IqiPhD389kmkxeTalrjNbbJTC8LXupb+sl0=
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/container-storage-interface/spec v1.1.0 h1:qPsTqtR1VUPvMPeK0UnCZMtXaKGyyLPG8gj/wG6VqMs=
github.com/container-storage-interface/spec v1.1.0/go.mod h1:6URME8mwIBbpVyZV93Ce5St17xBiQJQY67NDsuohiy4=
github.com/container-storage-interface/spec v1.2.0 h1:bD9KIVgaVKKkQ/UbVUY9kCaH/CJbhNxe0eeB4JeJV2s=
github.com/container-storage-interface/spec v1.2.0/go.mod h1:6URME8mwIBbpVyZV93Ce5St17xBiQJQY67NDsuohiy4=
github.com/coreos/bbolt v1.3.3 h1:n6AiVyVRKQFNb6mJlwESEvvLoDyiTzXX7ORAUlkeBdY=
github.com/coreos/bbolt v1.3.3/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
github.com/coreos/etcd v3.3.13+incompatible h1:8F3hqu9fGYLBifCmRCJsicFqDx/D68Rt3q1JMazcgBQ=
Expand Down

0 comments on commit 4989490

Please sign in to comment.