diff --git a/docs/parameters.md b/docs/parameters.md index 7b8eec0f1..0818b71e2 100644 --- a/docs/parameters.md +++ b/docs/parameters.md @@ -18,8 +18,8 @@ The AWS EBS CSI Driver supports [tagging](tagging.md) through `StorageClass.para | "kmsKeyId" | | | The full ARN of the key to use when encrypting the volume. If not specified, AWS will use the default KMS key for the region the volume is in. This will be an auto-generated key called `/aws/ebs` if not changed. | | "blockSize" | | | The block size to use when formatting the underlying filesystem. Only supported on linux nodes and with fstype `ext2`, `ext3`, `ext4`, or `xfs`. | | "inodeSize" | | | The inode size to use when formatting the underlying filesystem. Only supported on linux nodes and with fstype `ext2`, `ext3`, `ext4`, or `xfs`. | -| "bytesPerINode" | | | The `bytes-per-inode` to use when formatting the underlying filesystem. Only supported on linux nodes and with fstype `ext2`, `ext3`, `ext4`. | -| "numberOfINodes" | | | The `number-of-inodes` to use when formatting the underlying filesystem. Only supported on linux nodes and with fstype `ext2`, `ext3`, `ext4`. | +| "bytesPerInode" | | | The `bytes-per-inode` to use when formatting the underlying filesystem. Only supported on linux nodes and with fstype `ext2`, `ext3`, `ext4`. | +| "numberOfInodes" | | | The `number-of-inodes` to use when formatting the underlying filesystem. Only supported on linux nodes and with fstype `ext2`, `ext3`, `ext4`. | ## Restrictions * `gp3` is currently not supported on outposts. Outpost customers need to use a different type for their volumes. * If the requested IOPS (either directly from `iops` or from `iopsPerGB` multiplied by the volume's capacity) produces a value above the maximum IOPS allowed for the [volume type](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-volume-types.html), the IOPS will be capped at the maximum value allowed. If the value is lower than the minimal supported IOPS value per volume, either an error is returned (the default behavior), or the value is increased to fit into the supported range when `allowautoiopspergbincrease` is `"true"`. diff --git a/pkg/driver/constants.go b/pkg/driver/constants.go index 0842c1277..43b5e346d 100644 --- a/pkg/driver/constants.go +++ b/pkg/driver/constants.go @@ -85,14 +85,14 @@ const ( // BlockSizeKey configures the block size when formatting a volume BlockSizeKey = "blocksize" - // INodeSizeKey configures the inode size when formatting a volume - INodeSizeKey = "inodesize" + // InodeSizeKey configures the inode size when formatting a volume + InodeSizeKey = "inodesize" - // BytesPerINodeKey configures the `bytes-per-inode` when formatting a volume - BytesPerINodeKey = "bytesperinode" + // BytesPerInodeKey configures the `bytes-per-inode` when formatting a volume + BytesPerInodeKey = "bytesperinode" - // NumberOfINodesKey configures the `number-of-inodes` when formatting a volume - NumberOfINodesKey = "numberofinodes" + // NumberOfInodesKey configures the `number-of-inodes` when formatting a volume + NumberOfInodesKey = "numberofinodes" // TagKeyPrefix contains the prefix of a volume parameter that designates it as // a tag to be attached to the resource @@ -198,16 +198,16 @@ var ( }, FSTypeXfs: { NotSupportedParams: map[string]struct{}{ - BytesPerINodeKey: {}, - NumberOfINodesKey: {}, + BytesPerInodeKey: {}, + NumberOfInodesKey: {}, }, }, FSTypeNtfs: { NotSupportedParams: map[string]struct{}{ BlockSizeKey: {}, - INodeSizeKey: {}, - BytesPerINodeKey: {}, - NumberOfINodesKey: {}, + InodeSizeKey: {}, + BytesPerInodeKey: {}, + NumberOfInodesKey: {}, }, }, } diff --git a/pkg/driver/controller.go b/pkg/driver/controller.go index f2f5a3724..34b83b06f 100644 --- a/pkg/driver/controller.go +++ b/pkg/driver/controller.go @@ -139,8 +139,8 @@ func (d *controllerService) CreateVolume(ctx context.Context, req *csi.CreateVol } blockSize string inodeSize string - bytesPerINode string - numberOfINodes string + bytesPerInode string + numberOfInodes string ) tProps := new(template.PVProps) @@ -192,21 +192,21 @@ func (d *controllerService) CreateVolume(ctx context.Context, req *csi.CreateVol return nil, status.Errorf(codes.InvalidArgument, "Could not parse blockSize (%s): %v", value, err) } blockSize = value - case INodeSizeKey: + case InodeSizeKey: if isAlphanumeric := util.StringIsAlphanumeric(value); !isAlphanumeric { return nil, status.Errorf(codes.InvalidArgument, "Could not parse inodeSize (%s): %v", value, err) } inodeSize = value - case BytesPerINodeKey: + case BytesPerInodeKey: if isAlphanumeric := util.StringIsAlphanumeric(value); !isAlphanumeric { - return nil, status.Errorf(codes.InvalidArgument, "Could not parse bytesPerINode (%s): %v", value, err) + return nil, status.Errorf(codes.InvalidArgument, "Could not parse bytesPerInode (%s): %v", value, err) } - bytesPerINode = value - case NumberOfINodesKey: + bytesPerInode = value + case NumberOfInodesKey: if isAlphanumeric := util.StringIsAlphanumeric(value); !isAlphanumeric { - return nil, status.Errorf(codes.InvalidArgument, "Could not parse numberOfINodes (%s): %v", value, err) + return nil, status.Errorf(codes.InvalidArgument, "Could not parse numberOfInodes (%s): %v", value, err) } - numberOfINodes = value + numberOfInodes = value default: if strings.HasPrefix(key, TagKeyPrefix) { scTags = append(scTags, value) @@ -225,20 +225,20 @@ func (d *controllerService) CreateVolume(ctx context.Context, req *csi.CreateVol } } if len(inodeSize) > 0 { - responseCtx[INodeSizeKey] = inodeSize - if err = validateVolumeCapabilities(req.GetVolumeCapabilities(), INodeSizeKey, FileSystemConfigs); err != nil { + responseCtx[InodeSizeKey] = inodeSize + if err = validateVolumeCapabilities(req.GetVolumeCapabilities(), InodeSizeKey, FileSystemConfigs); err != nil { return nil, err } } - if len(bytesPerINode) > 0 { - responseCtx[BytesPerINodeKey] = bytesPerINode - if err = validateVolumeCapabilities(req.GetVolumeCapabilities(), BytesPerINodeKey, FileSystemConfigs); err != nil { + if len(bytesPerInode) > 0 { + responseCtx[BytesPerInodeKey] = bytesPerInode + if err = validateVolumeCapabilities(req.GetVolumeCapabilities(), BytesPerInodeKey, FileSystemConfigs); err != nil { return nil, err } } - if len(numberOfINodes) > 0 { - responseCtx[NumberOfINodesKey] = numberOfINodes - if err = validateVolumeCapabilities(req.GetVolumeCapabilities(), NumberOfINodesKey, FileSystemConfigs); err != nil { + if len(numberOfInodes) > 0 { + responseCtx[NumberOfInodesKey] = numberOfInodes + if err = validateVolumeCapabilities(req.GetVolumeCapabilities(), NumberOfInodesKey, FileSystemConfigs); err != nil { return nil, err } } diff --git a/pkg/driver/controller_test.go b/pkg/driver/controller_test.go index 1f692042a..a39b819c6 100644 --- a/pkg/driver/controller_test.go +++ b/pkg/driver/controller_test.go @@ -1670,21 +1670,21 @@ func TestCreateVolumeWithFormattingParameters(t *testing.T) { { name: "success with inode size", formattingOptionParameters: map[string]string{ - INodeSizeKey: "256", + InodeSizeKey: "256", }, errExpected: false, }, { name: "success with bytes-per-inode", formattingOptionParameters: map[string]string{ - BytesPerINodeKey: "8192", + BytesPerInodeKey: "8192", }, errExpected: false, }, { name: "success with number-of-inodes", formattingOptionParameters: map[string]string{ - NumberOfINodesKey: "13107200", + NumberOfInodesKey: "13107200", }, errExpected: false, }, @@ -1698,21 +1698,21 @@ func TestCreateVolumeWithFormattingParameters(t *testing.T) { { name: "failure with inode size", formattingOptionParameters: map[string]string{ - INodeSizeKey: "wrong_value", + InodeSizeKey: "wrong_value", }, errExpected: true, }, { name: "failure with bytes-per-inode", formattingOptionParameters: map[string]string{ - BytesPerINodeKey: "wrong_value", + BytesPerInodeKey: "wrong_value", }, errExpected: true, }, { name: "failure with number-of-inodes", formattingOptionParameters: map[string]string{ - NumberOfINodesKey: "wrong_value", + NumberOfInodesKey: "wrong_value", }, errExpected: true, }, diff --git a/pkg/driver/node.go b/pkg/driver/node.go index 39278ead8..32bb7b9d3 100644 --- a/pkg/driver/node.go +++ b/pkg/driver/node.go @@ -161,15 +161,15 @@ func (d *nodeService) NodeStageVolume(ctx context.Context, req *csi.NodeStageVol if err != nil { return nil, err } - inodeSize, err := recheckFormattingOptionParameter(context, INodeSizeKey, FileSystemConfigs, fsType) + inodeSize, err := recheckFormattingOptionParameter(context, InodeSizeKey, FileSystemConfigs, fsType) if err != nil { return nil, err } - bytesPerINode, err := recheckFormattingOptionParameter(context, BytesPerINodeKey, FileSystemConfigs, fsType) + bytesPerInode, err := recheckFormattingOptionParameter(context, BytesPerInodeKey, FileSystemConfigs, fsType) if err != nil { return nil, err } - numINodes, err := recheckFormattingOptionParameter(context, NumberOfINodesKey, FileSystemConfigs, fsType) + numInodes, err := recheckFormattingOptionParameter(context, NumberOfInodesKey, FileSystemConfigs, fsType) if err != nil { return nil, err } @@ -256,11 +256,11 @@ func (d *nodeService) NodeStageVolume(ctx context.Context, req *csi.NodeStageVol } formatOptions = append(formatOptions, option, inodeSize) } - if len(bytesPerINode) > 0 { - formatOptions = append(formatOptions, "-i", bytesPerINode) + if len(bytesPerInode) > 0 { + formatOptions = append(formatOptions, "-i", bytesPerInode) } - if len(numINodes) > 0 { - formatOptions = append(formatOptions, "-N", numINodes) + if len(numInodes) > 0 { + formatOptions = append(formatOptions, "-N", numInodes) } err = d.mounter.FormatAndMountSensitiveWithFormatOptions(source, target, fsType, mountOptions, nil, formatOptions) if err != nil { diff --git a/pkg/driver/node_test.go b/pkg/driver/node_test.go index 80fc2aa4a..fbf785e29 100644 --- a/pkg/driver/node_test.go +++ b/pkg/driver/node_test.go @@ -284,7 +284,7 @@ func TestNodeStageVolume(t *testing.T) { StagingTargetPath: targetPath, VolumeCapability: stdVolCap, VolumeId: volumeID, - VolumeContext: map[string]string{INodeSizeKey: "256"}, + VolumeContext: map[string]string{InodeSizeKey: "256"}, }, expectMock: func(mockMounter MockMounter, mockDeviceIdentifier MockDeviceIdentifier) { successExpectMock(mockMounter, mockDeviceIdentifier) @@ -307,7 +307,7 @@ func TestNodeStageVolume(t *testing.T) { }, }, VolumeId: volumeID, - VolumeContext: map[string]string{INodeSizeKey: "256"}, + VolumeContext: map[string]string{InodeSizeKey: "256"}, }, expectMock: func(mockMounter MockMounter, mockDeviceIdentifier MockDeviceIdentifier) { successExpectMock(mockMounter, mockDeviceIdentifier) @@ -321,7 +321,7 @@ func TestNodeStageVolume(t *testing.T) { StagingTargetPath: targetPath, VolumeCapability: stdVolCap, VolumeId: volumeID, - VolumeContext: map[string]string{BytesPerINodeKey: "8192"}, + VolumeContext: map[string]string{BytesPerInodeKey: "8192"}, }, expectMock: func(mockMounter MockMounter, mockDeviceIdentifier MockDeviceIdentifier) { successExpectMock(mockMounter, mockDeviceIdentifier) @@ -335,7 +335,7 @@ func TestNodeStageVolume(t *testing.T) { StagingTargetPath: targetPath, VolumeCapability: stdVolCap, VolumeId: volumeID, - VolumeContext: map[string]string{NumberOfINodesKey: "13107200"}, + VolumeContext: map[string]string{NumberOfInodesKey: "13107200"}, }, expectMock: func(mockMounter MockMounter, mockDeviceIdentifier MockDeviceIdentifier) { successExpectMock(mockMounter, mockDeviceIdentifier) diff --git a/tests/e2e/format_options.go b/tests/e2e/format_options.go index ceae5cf72..6bb365db7 100644 --- a/tests/e2e/format_options.go +++ b/tests/e2e/format_options.go @@ -35,15 +35,15 @@ var ( CreateVolumeParameterValue: "1024", }, { - CreateVolumeParameterKey: ebscsidriver.INodeSizeKey, + CreateVolumeParameterKey: ebscsidriver.InodeSizeKey, CreateVolumeParameterValue: "512", }, { - CreateVolumeParameterKey: ebscsidriver.BytesPerINodeKey, + CreateVolumeParameterKey: ebscsidriver.BytesPerInodeKey, CreateVolumeParameterValue: "8192", }, { - CreateVolumeParameterKey: ebscsidriver.NumberOfINodesKey, + CreateVolumeParameterKey: ebscsidriver.NumberOfInodesKey, CreateVolumeParameterValue: "200192", }, }