Block Services

Creating a StorageClass

  1. Prepare a StorageClass configuration file, for example, msc .yaml. For details about the StorageClass configuration, see the following example.

  2. Run the following command to create a StorageClass using the configuration file.

    kubectl apply -f mysc.yaml
    
  3. Run the following command to view the information about the created StorageClass.

    kubectl get sc mysc
    

    The following is an example of the command output.

    NAME   PROVISIONER      RECLAIMPOLICY   VOLUMEBINDINGMODE   ALLOWVOLUMEEXPANSION   AGE
    mysc   csi.huawei.com   Delete          Immediate           true                   8s
    

Block StorageClass Configuration Example

If LUNs are used as storage resources and the file system needs to be formatted to a local file system, refer to the following example.

kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: mysc
provisioner: csi.huawei.com
parameters:
  backend: lun-181
  pool: StoragePool001
  volumeType: lun
  allocType: thin
  fsType: ext4

StorageClass Parameters Supported by Block Services

Table 1 StorageClass configuration parameters

Parameter

Description

Mandatory

Default Value

Whether the Volume Management Takes Effect

Remarks

metadata.name

User-defined name of a StorageClass object.

Yes

-

Yes

Take Kubernetes v1.22.1 as an example. The value can contain digits, lowercase letters, hyphens (-), and periods (.), and must start and end with a letter or digit.

provisioner

Name of the provisioner.

Yes

csi.huawei.com

Yes

Set this parameter to the driver name set during Huawei CSI installation.

The value is the same as that of driverName in the values.yaml file.

reclaimPolicy

Reclamation policy. The following types are supported:

  • Delete: Resources are automatically reclaimed.
  • Retain: Resources are manually reclaimed.

No

Delete

Yes

  • Delete: When a PV/PVC is deleted, resources on the storage device are also deleted.
  • Retain: When a PV/PVC is deleted, resources on the storage device are not deleted.

allowVolumeExpansion

Whether to allow volume expansion. If this parameter is set to true, the capacity of the PV that uses the StorageClass can be expanded.

No

false

Yes

This function can only be used to expand PV capacity but cannot be used to reduce PV capacity.

mountOptions

List of mount parameters, which can be used to specify the parameters of the -o option when the mount command is executed on a host.

No

-

Yes

For details about common parameters in mountOptions, see Table 2.

You can also specify other mount parameters.

parameters.backend

Name of the backend where the resource to be created is located. This field must be set if parameters.pool is set.

Conditionally mandatory

-

No

If this parameter is not set, Huawei CSI will randomly select a backend that meets the capacity requirements to create resources.

You are advised to specify a backend to ensure that the created resource is located on the expected backend.

parameters.pool

Name of the storage resource pool where the resource to be created is located.

No

-

No

If this parameter is not set, Huawei CSI will randomly select a storage pool that meets the capacity requirements from the selected backend to create resources. You are advised to specify a storage pool to ensure that the created resource is located in the expected storage pool.

parameters.volumeType

Type of the volume to be created. The following types are supported:

  • lun: A LUN is provisioned on the storage side.
  • fs: A file system is provisioned on the storage side.
  • dtree: A volume of the Dtree type is provisioned on the storage side.

Yes

-

Yes

The value is fixed to lun.

parameters.allocType

Allocation type of the volume to be created. The following types are supported:

  • thin: Not all required space is allocated during creation. Instead, the space is dynamically allocated based on the usage.
  • thick: All required space is allocated during creation.

No

thin

No

If this parameter is set to thin, the required space is not allocated immediately when a volume is created. Instead, the space is dynamically allocated based on the usage.

OceanStor Dorado does not support thick.

parameters.fsType

Type of a host file system. The supported types are:

  • ext2
  • ext3
  • ext4
  • xfs

No

ext4

No

This parameter is available only when volumeMode of the PVC is set to Filesystem.

parameters.cloneSpeed

Cloning speed. The value ranges from 1 to 4.

No

3

No

4 indicates the highest speed. This parameter takes effect when you clone a PVC or create a PVC from a snapshot.

parameters.applicationType

Application type name of the LUN to be created.

No

-

Yes

Log in to DeviceManager and choose Services > Block Service > LUN Groups (or Namespace Groups) > LUNs (or Namespaces) > Create to obtain the application type name.

parameters.qos

LUN/NAS QoS settings of the PV on the storage side.

The value of the parameter is JSON character strings in dictionary format. A character string is enclosed by single quotation marks and the dictionary key by double quotation marks. Example: '{"maxMBPS": 999, "maxIOPS": 999}'

No

-

No

For details about the supported QoS configurations, see Table 3.

parameters.fsPermission

Permission on the directory mounted to a container.

No

-

No

For details about the configuration format, refer to the Linux permission settings, for example, 777 and 755.

parameters.disableVerifyCapacity

Whether to disable volume capacity verification. After this function is disabled, the system will not verify whether the volume capacity is an integer multiple of the sector size.

The value can be:

  • "true": disables volume capacity verification.
  • "false": enables volume capacity verification.
NOTICE:

When Red Hat OpenShift Virtualization is used to connect to CSI, this parameter must be set to true.

No

"true"

Yes

For OceanDisk, the sector size is 512 bytes.

parameters.description

Description of the LUN to be created.

Value type: character string

The value contains 0 to 255 characters.

No

-

No

  

Table 2 Common parameters in mountOptions

Parameter

Description

Mandatory

Default Value

Remarks

mountOptions.discard

Automatically triggers the Trim or Discard operation when a file system is mounted. This operation instructs a block device to release unused blocks.

No

-

The xfs and ext4 file systems are supported.

Table 3 Supported QoS configurations

Parameter

Description

Remarks

IOTYPE

Read/write type.

The value can be:

  • 2: read and write I/Os

MAXBANDWIDTH

Maximum bandwidth. This is a restriction policy parameter.

The value is an integer ranging from 1 to 999999999, expressed in MB/s.

MINBANDWIDTH

Minimum bandwidth. This is a protection policy parameter.

The value is an integer ranging from 1 to 999999999, expressed in MB/s.

MAXIOPS

Maximum IOPS. This is a restriction policy parameter.

The value is an integer ranging from 100 to 999999999.

MINIOPS

Minimum IOPS. This is a protection policy parameter.

The value is an integer ranging from 100 to 999999999.

LATENCY

Maximum latency. This is a protection policy parameter.

The value can be 0.5 or 1.5, expressed in ms.