File System

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
    

NFS Protocol Configuration Example

When a container uses the NFS protocol to connect to file system resources, refer to the following StorageClass configuration example. In this example, NFS version 4.1 is specified for mounting.

kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: mysc
provisioner: csi.huawei.com
parameters:
  backend: nfs-nas-181
  pool: pool001
  volumeType: fs
  allocType: thin
  authClient: "*"
mountOptions:
  - nfsvers=4.1 # Specify the version 4.1 for NFS mounting.

DPC Protocol Configuration Example

When the storage supports access using the DPC protocol, you can configure the mount parameters for DPC access in the StorageClass. In this example, acl is used as the authentication parameter for mounting, and cnflush is used to set the asynchronous disk flushing mode.

kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: mysc
provisioner: csi.huawei.com
parameters:
  backend: nfs-dpc-101
  pool: pool001
  volumeType: fs
  allocType: thin
mountOptions:
  - acl # Set the authentication parameter.
  - cnflush # Set the asynchronous disk flushing mode.

StorageClass Parameters Supported by File Systems

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 fs.

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.

parameters.authClient

IP address of the NFS client that can access the volume. This parameter is mandatory when the NFS protocol is used.

You can enter the client host name (a full domain name is recommended), client IP address, or client IP address segment.

Conditionally mandatory

-

No

The asterisk (*) can be used to indicate any client. If you are not sure about the IP address of the access client, you are advised to use the asterisk (*) to prevent the client access from being rejected by the storage system.

If the client host name is used, you are advised to use the full domain name.

The IP addresses can be IPv4 addresses, IPv6 addresses, or a combination of IPv4 and IPv6 addresses.

You can enter multiple host names, IP addresses, or IP address segments and separate them with semicolons (;). Example: 192.168.0.10;192.168.0.0/24;myserver1.test

parameters.storageQuota

File system quota settings.

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: '{"spaceQuota": "softQuota", "gracePeriod": 100}'

No

-

No

For details about the supported quota configurations, see Table 4.

parameters.qos

QoS settings of the file system on the storage side of the PV.

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.rootSquash

Controls the root permission of the client.

The value can be:

  • root_squash: The client cannot access the storage system as user root. If a client accesses the storage system as user root, the client will be mapped as an anonymous user.
  • no_root_squash: A client can access the storage system as user root and has the permission of user root.

No

-

No

  

parameters.allSquash

Whether to retain the user ID (UID) and group ID (GID) of a shared directory.

The value can be:

  • all_squash: The UID and GID of the shared directory are mapped to anonymous users.
  • no_all_squash: The UID and GID of the shared directory are retained.

No

-

No

  

parameters.snapshotDirectoryVisibility

Whether the snapshot directory is visible.

The value can be:

  • visible: The snapshot directory is visible.
  • invisible: The snapshot directory is invisible.

No

-

No

  

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"

No

For OceanStor Pacific NAS, the sector size is 1 KB.

Table 2 Common parameters in mountOptions

Parameter

Description

Mandatory

Default Value

Remarks

mountOptions.nfsvers

NFS mount option on the host. The following mount option is supported:

nfsvers: protocol version for NFS mounting. The value can be 3, 4, 4.0, 4.1, or 4.2.

No

-

This parameter is optional after the -o parameter when the mount command is executed on the host. The value is in list format.

If the NFS version is specified for mounting, NFS 3, 4.0, 4.1, and 4.2 protocols are supported (the protocol must be supported and enabled on storage devices). If nfsvers is set to 4, the latest protocol version NFS 4 may be used for mounting due to different OS configurations, for example, 4.2. If the 4.0 protocol is required, you are advised to set nfsvers to 4.0.

mountOptions.proto

Transmission protocol used for NFS mounting.

The value can be rdma.

No

-

This example applies to 8.2.0 or later.

mountOptions.port

Protocol port used for NFS mounting.

Conditionally mandatory

-

If the transmission protocol is rdma, set this parameter to 20049.

mountOptions.acl

The DPC namespace supports the ACL function. The DPC client supports POSIX ACL, NFSv4 ACL, and NT ACL authentication.

No

-

The descriptions of acl, aclonlyposix, cnflush, and cflush are for reference only. For details about the parameters, see OceanStor Pacific Series Product Documentation and choose Configuration > Basic Service Configuration Guide for File > Configuring Basic Services (DPC Scenario) > Accessing a DPC Share on a Client > Step 2.

mountOptions.aclonlyposix

The DPC namespace supports POSIX ACL, and the DPC client supports POSIX ACL authentication.

The following protocols support POSIX ACL: DPC, NFSv3, and HDFS. If NFSv4 ACL or NT ACL is used, the DPC client cannot identify the ACL of this type. As a result, the ACL of this type does not take effect.

No

-

If aclonlyposix and acl are used together, only acl takes effect. That is, the namespace supports the ACL function.

mountOptions.cnflush

Asynchronous disk flushing mode. That is, data is not flushed to disks immediately when files in the namespace are closed.

No

-

Asynchronous flushing mode: When a file is closed, data in the cache is not flushed to storage media in synchronous mode. Instead, data is written from the cache to the storage media in asynchronous flushing mode. After the write service is complete, data is flushed from the cache to disks periodically based on the flushing period. In a multi-client scenario, if concurrent operations are performed on the same file, the file size update is affected by the disk flushing period. That is, the file size is updated only after the disk flushing is complete. Generally, the update is completed within several seconds. Synchronous I/Os are not affected by the disk flushing period.

mountOptions.cflush

Synchronous disk flushing mode. That is, data is flushed to disks immediately when files in the namespace are closed.

No

-

By default, the synchronous disk flushing mode is used.

Table 3 Supported QoS configurations

Parameter

Description

Remarks

maxMBPS

Maximum bandwidth. This is a restriction policy parameter.

This parameter is mandatory. The value is an integer greater than 0, expressed in MB/s. For details about the maximum value, see the actual limit of the storage device. For example, the maximum value of OceanStor Pacific NAS is 1073741824.

maxIOPS

Maximum IOPS. This is a restriction policy parameter.

This parameter is mandatory. The value is an integer greater than 0. For details about the maximum value, see the actual limit of the storage device. For example, the maximum value of OceanStor Pacific NAS is 1073741824000.

Table 4 Supported quota configurations

Parameter

Description

Remarks

spaceQuota

File quota type.

This parameter is mandatory. Only softQuota or hardQuota can be configured.

gracePeriod

Grace period allowed when the soft quota is configured.

This parameter is conditionally optional only when spaceQuota is set to softQuota.

The value is an integer ranging from 0 to 4294967294.