Skip to content

Commit

Permalink
Merge pull request #142 from sunpa93/expand-volume-fix
Browse files Browse the repository at this point in the history
expand volume fix
  • Loading branch information
akutz authored Feb 3, 2021
2 parents 97feea8 + 98cb74c commit b3dfd21
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
11 changes: 7 additions & 4 deletions csc/cmd/controller_expand_volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
var expandVolume struct {
reqBytes int64
limBytes int64
volCap *volumeCapabilitySliceArg
volCap volumeCapabilitySliceArg
}

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

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

if len(expandVolume.volCap.data) > 0 {
req.VolumeCapability = expandVolume.volCap.data[0]
}

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

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

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

flagWithRequiresCreds(
expandVolumeCmd.Flags(),
Expand Down
9 changes: 6 additions & 3 deletions csc/cmd/node_expand_volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ var nodeExpandVolume struct {
reqBytes int64
limBytes int64
stagingPath string
volCap *volumeCapabilitySliceArg
volCap volumeCapabilitySliceArg
}

var nodeExpandVolumeCmd = &cobra.Command{
Expand All @@ -34,7 +34,10 @@ USAGE
VolumeId: args[0],
VolumePath: args[1],
StagingTargetPath: nodeExpandVolume.stagingPath,
VolumeCapability: nodeExpandVolume.volCap.data[0],
}

if len(nodeExpandVolume.volCap.data) > 0 {
req.VolumeCapability = expandVolume.volCap.data[0]
}

if nodeExpandVolume.reqBytes > 0 || nodeExpandVolume.limBytes > 0 {
Expand Down Expand Up @@ -71,5 +74,5 @@ func init() {

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

flagVolumeCapability(nodeExpandVolumeCmd.Flags(), nodeExpandVolume.volCap)
flagVolumeCapability(nodeExpandVolumeCmd.Flags(), &nodeExpandVolume.volCap)
}

0 comments on commit b3dfd21

Please sign in to comment.