Configuring PVC Changes
The PVC change feature is implemented using CRD. Related resources are described as follows.
Table 1 Resource description
NAME | APIVERSION | NAMESPACED | KIND |
---|
volumemodifyclaims | xuanwu.huawei.io/v1 | false | VolumeModifyClaim |
volumemodifycontents | xuanwu.huawei.io/v1 | false | VolumeModifyContent |
- VolumeModifyClaim resources can be created, deleted, and queried, but cannot be updated.
- VolumeModifyContent resources can only be queried and are used to display the change details of a single PVC. Do not manually create, delete, or modify the resources.
- VolumeModifyContent resources are managed by VolumeModifyClaim. Do not manually manage VolumeModifyContent resources.
1 - Creating a PVC Change
Prerequisites
The storage backends associated with the PVC to be changed are HyperMetro storage backends. If they are not HyperMetro storage backends, configure them by following the instructions in Manually Updating a Storage Backend.
1.1 - Preparing a PVC Change File
PVC Change File Description
The sample template of the PVC change file is /examples/volumemodifyclaim.yaml. The following table lists the configuration items.
Table 1 Parameter description
Parameter | Description | Mandatory | Default Value | Remarks |
---|
apiVersion | API group, which is of the string type. | Yes | xuanwu.huawei.io/v1 | The value is fixed at xuanwu.huawei.io/v1. |
kind | Resource type, which is of the string type. | Yes | VolumeModifyClaim | The value is fixed at VolumeModifyClaim. |
metadata.name | Name of a cluster resource object, which is of the string type. | Yes | - | The name must comply with the naming rules of a DNS subdomain name. The value can contain a maximum of 63 characters, including digits, lowercase letters, hyphens (-), and periods (.). It must start and end with a lowercase letter or digit. |
spec.source.kind | Data source type, which is of the string type. | Yes | StorageClass | This parameter can only be set to StorageClass. |
spec.source.name | Data source name, which is of the string type. | Yes | - | Only a StorageClass name can be configured. |
spec.parameters.hyperMetro | Whether to change a common volume to a HyperMetro volume. Currently, the value can only be "true". | Yes | - | Only common storage volumes at the primary site can be changed to HyperMetro storage volumes. |
spec.parameters.metroPairSyncSpeed | Data synchronization speed of a HyperMetro pair. The value ranges from 1 to 4. The value can be: - 1: low
- 2: medium
- 3: high
- 4: highest
| No | - | This parameter is available only when spec.parameters.hyperMetro is set to "true". Note: - If this parameter is not configured, the storage speed of the HyperMetro pair is determined by the storage device.
- The highest synchronization speed may increase the host latency.
|
- The spec.source.kind and spec.source.name parameters are used to specify the volume change scope. For example, if they are set to a StorageClass and the corresponding name respectively, all PVCs in the Bound state provisioned using the target StorageClass will be changed.
- After all associated PVCs are changed, Huawei CSI will replace the original StorageClass and add the spec.parameters parameter of the VolumeModifyClaim so that the PVCs meet the StorageClass definition.
For details about the configuration in typical scenarios, see the following example:
Changing a Common Volume to a HyperMetro Volume
The following is an example of changing a common volume to a HyperMetro volume:
apiVersion: xuanwu.huawei.io/v1
kind: VolumeModifyClaim
metadata:
name: myvmc
spec:
source:
kind: StorageClass
name: mysc
parameters:
hyperMetro: "true"
1.2 - Creating a PVC Change Resource
This section describes how to create a PVC change resource based on a configured PVC change file.
- Only the HyperMetro active-active (AA) mode is supported.
- When a common volume is changed to a HyperMetro volume, only the storage volume at the primary site can be changed.
- Do not use Huawei CSI to manage a PVC during PVC change resource creation.
- Multiple VolumeModifyClaim resources cannot be created for the same PVC. If the target PVC needs to be changed for multiple times, perform the changes one by one.
Procedure
Use a remote access tool, such as PuTTY, to log in to any master node in the Kubernetes cluster through the management IP address.
Run the following command to create a PVC change.
kubectl create -f volumemodifyclaim.yaml
Query the creation result by following the instructions in Querying a PVC Change.
2 - Querying a PVC Change
This section describes how to use Kubectl to query the PVC change status. Currently, Huawei CSI provides the following APIs through CRD.
Querying a VolumeModifyClaim
To query a VolumeModifyClaim using kubectl, perform the following steps.
Use a remote access tool, such as PuTTY, to log in to any master node in the Kubernetes cluster through the management IP address.
Run the following command to query a PVC change. In the command, vmc-name indicates the name of the VolumeModifyClaim resource.
kubectl get volumemodifyclaims <vmc-name> -owide
The following is an example of the command output.
NAME STATUS READY SOURCEKIND SOURCENAME STARTEDAT COMPLETEDAT AGE
myvmc Completed 1/1 StorageClass mysc 2024-06-06T03:19:13Z 2024-06-06T03:19:16Z 2m2s
Table 1 Command output description
Parameter | Description |
---|
NAME | VolumeModifyClaim resource name. |
STATUS | VolumeModifyClaim resource status. The value can be: - Pending: initial status.
- Creating: The VolumeModifyClaim has completed basic verification and the server has received the change task, but the task has not been completed.
- Completed: All associated PVCs are changed.
- Rollback: When associated PVCs are partially changed, a user deletes PVCs.
- Deleting: When all associated PVCs are changed, a user deletes PVCs.
|
READY | Ratio of the number of changed PVCs to the total number of PVCs that need to be changed. |
SOURCEKIND | Data source type, for example, StorageClass. |
SOURCENAME | Data source name, for example, StorageClass name. |
STARTEDAT | Change start time, that is, the timestamp when the server receives the task and starts to process the task. |
COMPLETEDAT | Change completion time, that is, the timestamp when the changes of all associated PVCs are complete. This parameter exists only when STATUS is Completed. |
AGE | Lifetime of a VolumeModifyClaim from the time when it is created to the current time. |
You can use kubectl to view the Events information of a VolumeModifyClaim. If a VolumeModifyClaim cannot meet the creation requirements or an error occurs during the creation, the server will record the Events information. The following command is used as an example:
kubectl describe volumemodifyclaims local-to-hypermetro
Querying a VolumeModifyContent
A VolumeModifyContent is created using a VolumeModifyClaim and records the change details of a single PVC. To query a VolumeModifyContent using kubectl, perform the following steps:
Use a remote access tool, such as PuTTY, to log in to any master node in the Kubernetes cluster through the management IP address.
Run the following command to query a PVC change. In the command, myvmc-uid indicates the VolumeModifyContent resource name.
kubectl get volumemodifycontents myvmc-uid -owide
The following is an example of the command output.
NAME STATUS MODIFYCLAIMNAME SOURCEVOLUME STARTEDAT COMPLETEDAT AGE
myvmc-uid Completed myvmc default/mypvc 2024-06-06T03:19:07Z 2024-06-06T03:19:09Z 36m
Table 2 Command output description
Parameter | Description |
---|
NAME | VolumeModifyContent resource name. The format is VolumeModifyClaim name-UID of the associated PVC. |
STATUS | VolumeModifyContent resource status. The value can be: - Pending: initial status.
- Creating: The VolumeModifyContent has completed basic verification and the server has received the change task, but the task has not been completed.
- Completed: The associated PVC is changed.
- Rollback: The PVC change is being rolled back.
|
MODIFYCLAIMNAME | Name of the associated VolumeModifyClaim. |
SOURCEVOLUME | Information about the associated PVC. The format is Namespace name/PVC name. |
STARTEDAT | PVC change start time, that is, the timestamp when the server receives the task and starts to process the task. |
COMPLETEDAT | PVC change completion time, that is, the timestamp when the changes of all associated PVCs are complete. This parameter exists only when STATUS is Completed. |
AGE | Lifetime of a VolumeModifyContent from the time when it is created to the current time. |
You can use kubectl to view the Events information of a VolumeModifyContent. If a VolumeModifyContent cannot meet the creation requirements or an error occurs during the PVC change, the server will record the Events information. The following command is used as an example:
kubectl describe volumemodifycontents myvmc-uid
3 - Deleting a PVC Change
- If STATUS of a VolumeModifyClaim is Creating, deleting the VolumeModifyClaim resource will delete the created resource on the storage side and then remove the cluster resource. After the deletion, if you continue to use the original StorageClass for PVC management, you need to restore the associated storage backend to a non-HyperMetro storage backend.
- If STATUS of a VolumeModifyClaim is Pending or Completed, deleting the VolumeModifyClaim resource will only remove the cluster resource and will not delete the created resource on the storage side (that is, there is not interaction with the storage side).
- VolumeModifyContent resources are managed by VolumeModifyClaim. Do not manually manage VolumeModifyContent resources.
- If some PVCs among the PVCs to be changed meet the change requirements and the batch change fails, all PVC changes will be removed. As a result, the PVCs that meet the change requirements will not meet the change requirements.
- If a PVC to be changed has been manually managed on the storage side, the change may fail. Do not manually manage storage volumes when using the change feature.
This section describes how to use kubectl to delete a PVC change. The procedure is as follows.
Procedure
Use a remote access tool, such as PuTTY, to log in to any master node in the Kubernetes cluster through the management IP address.
Run the following command to delete a PVC change. In the command, vmc-name indicates the name of the VolumeModifyClaim resource.
kubectl delete volumemodifyclaims <vmc-name>
Query the deletion result by following the instructions in Creating a PVC Change Resource.