Updated on 2026-01-08 GMT+08:00

Creating a PV (Discarded)

Function

This API is used to create a PV associated with cloud storage (for example, EVS, SFS, and OBS). This API has been discarded. Use the corresponding Kubernetes PV API instead.

The URL for storage management is in the format of https://{clusterid}.Endpoint/uri. In the URL, {clusterid} indicates a cluster ID, and uri indicates the resource path, that is, the path for API access. If https://Endpoint/uri is used, the X-Cluster-ID parameter must be specified in the request header.

Calling Method

For details, see Calling APIs.

Authorization

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.

  • If you are using role/policy-based authorization, see the required permissions in Permissions Policies and Supported Actions.
  • If you are using identity policy-based authorization, no identity policy-based permissions are required for calling this API.

URI

POST /api/v1/cloudpersistentvolumes

Request Parameters

Table 1 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

The request body type or format

Possible values:

  • application/json;charset=utf-8
  • application/json

X-Auth-Token

Yes

String

Requests for calling an API can be authenticated using either a token or AK/SK. If token-based authentication is used, this parameter is mandatory and must be set to a user token. For details about how to obtain a token, see Authentication.

Maximum length: 16,384 characters

X-Cluster-ID

No

String

Cluster ID. This parameter is mandatory when the URL format https://Endpoint/uri is used. For details about how to obtain the value, see How to Obtain Parameters in the API URI.

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

apiVersion

Yes

String

API version. The value is fixed at v1.

Default value: v1

kind

Yes

String

API type. The value is fixed at PersistentVolume.

Default value: PersistentVolume

metadata

Yes

PersistentVolumeMetadata object

PV metadata information.

spec

Yes

PersistentVolumeSpec object

PV specifications.

status

No

PersistentVolumeStatus object

PV status information.

Table 3 PersistentVolumeMetadata

Parameter

Mandatory

Type

Description

name

Yes

String

PV name. Enter 1 to 253 characters that start and end with a letter or digit. Only lowercase letters, digits, hyphens (-), and periods (.) are allowed. PV names must be unique in a namespace.

labels

No

Map<String,String>

PV labels, in the format of key-value pairs.

  • A key must contain 1 to 63 characters that start with a letter or digit. Only letters, digits, hyphens (-), underscores (_), and periods (.) are allowed. A DNS subdomain can be prefixed to a key, for example, example.com/my-key, and contain a maximum of 253 characters.
  • A value can be left empty or contain 1 to 63 characters that start with a letter or digit. Only letters, digits, hyphens (-), underscores (_), and periods (.) are allowed.

Example label: "foo": "bar"

Table 4 PersistentVolumeSpec

Parameter

Mandatory

Type

Description

flexVolume

Yes

FlexVolume object

FlexVolume storage plug-in of Kubernetes.

persistentVolumeReclaimPolicy

No

String

PV reclaim policy. Possible values:

  • Retain: The Retain reclaim policy allows for manual reclamation of the resource. When the PVC is deleted, the PV still exists and the volume is considered "released".
  • Recycle: The Recycle reclaim policy performs a basic scrub (rm -rf / thevolume / *) on the volume and makes it available again for a new claim.
  • Delete: For volume plug-ins that support the Delete reclaim policy, deletion removes both the PV object from Kubernetes, as well as the associated storage asset in the external infrastructure. Volumes that were dynamically provisioned inherit the reclaim policy of their StorageClass, which defaults to Delete.

accessModes

Yes

Array of strings

Access mode of the PV.

  • ReadWriteOnce: The volume can be mounted to a single node in read/write mode.
    NOTE:

    This function is supported only when the cluster version is v1.13.10 and the storage-driver version is 1.0.19.

  • ReadOnlyMany: The volume can be mounted to multiple nodes in read-only mode.
  • ReadWriteMany: The volume can be mounted to multiple nodes in read/write mode.
Table 5 FlexVolume

Parameter

Mandatory

Type

Description

driver

Yes

String

Name of the FlexVolume storage plug-in. Set this parameter based on the storage volume type.

  • huawei.com/fuxivol (EVS)
  • huawei.com/fuxinfs (SFS)
  • huawei.com/fuxiobs (OBS)
  • huawei.com/fuxiefs (SFS Turbo)

fsType

Yes

String

File system type. Set this parameter based on the storage volume type.

options

Yes

Options object

FlexVolume configuration items.

Table 6 Options

Parameter

Mandatory

Type

Description

fsType

Yes

String

File system type. Set this parameter based on the storage volume type.

  • ext4 (EVS)
  • nfs (SFS)
  • obs (OBS)
  • efs (SFS Turbo)

region

Yes

String

Region where the cloud storage is located.

volumeID

Yes

String

UUID of the cloud storage. If the cloud storage is an OBS bucket, set this parameter to the bucket name.

storageType

Yes

String

Cloud storage volume type.

  • bs (EVS)
  • nfs (SFS)
  • obs (OBS)
  • efs (SFS Turbo)
Table 7 PersistentVolumeStatus

Parameter

Mandatory

Type

Description

accessModes

No

Array of strings

Access mode of a PV

phase

No

String

PV status. Possible values:

  • Available: The volume is not bound to any PVC.
  • Bound: The PV has been bound to a PVC.
  • Released: The PVC bound to the PV has been deleted, but the PV has not been made available again for a new claim in the cluster.
  • Failed: Automatic reclaim of the volume has failed.

Response Parameters

Status code: 201

Table 8 Response body parameters

Parameter

Type

Description

apiVersion

String

API version. The value is fixed at v1.

Default value: v1

kind

String

API type. The value is fixed at PersistentVolume.

Default value: PersistentVolume

metadata

PersistentVolumeMetadata object

PV metadata information.

spec

PersistentVolumeSpec object

PV specifications.

status

PersistentVolumeStatus object

PV status information.

Table 9 PersistentVolumeMetadata

Parameter

Type

Description

name

String

PV name. Enter 1 to 253 characters that start and end with a letter or digit. Only lowercase letters, digits, hyphens (-), and periods (.) are allowed. PV names must be unique in a namespace.

labels

Map<String,String>

PV labels, in the format of key-value pairs.

  • A key must contain 1 to 63 characters that start with a letter or digit. Only letters, digits, hyphens (-), underscores (_), and periods (.) are allowed. A DNS subdomain can be prefixed to a key, for example, example.com/my-key, and contain a maximum of 253 characters.
  • A value can be left empty or contain 1 to 63 characters that start with a letter or digit. Only letters, digits, hyphens (-), underscores (_), and periods (.) are allowed.

Example label: "foo": "bar"

Table 10 PersistentVolumeSpec

Parameter

Type

Description

flexVolume

FlexVolume object

FlexVolume storage plug-in of Kubernetes.

persistentVolumeReclaimPolicy

String

PV reclaim policy. Possible values:

  • Retain: The Retain reclaim policy allows for manual reclamation of the resource. When the PVC is deleted, the PV still exists and the volume is considered "released".
  • Recycle: The Recycle reclaim policy performs a basic scrub (rm -rf / thevolume / *) on the volume and makes it available again for a new claim.
  • Delete: For volume plug-ins that support the Delete reclaim policy, deletion removes both the PV object from Kubernetes, as well as the associated storage asset in the external infrastructure. Volumes that were dynamically provisioned inherit the reclaim policy of their StorageClass, which defaults to Delete.

accessModes

Array of strings

Access mode of the PV.

  • ReadWriteOnce: The volume can be mounted to a single node in read/write mode.
    NOTE:

    This function is supported only when the cluster version is v1.13.10 and the storage-driver version is 1.0.19.

  • ReadOnlyMany: The volume can be mounted to multiple nodes in read-only mode.
  • ReadWriteMany: The volume can be mounted to multiple nodes in read/write mode.
Table 11 FlexVolume

Parameter

Type

Description

driver

String

Name of the FlexVolume storage plug-in. Set this parameter based on the storage volume type.

  • huawei.com/fuxivol (EVS)
  • huawei.com/fuxinfs (SFS)
  • huawei.com/fuxiobs (OBS)
  • huawei.com/fuxiefs (SFS Turbo)

fsType

String

File system type. Set this parameter based on the storage volume type.

options

Options object

FlexVolume configuration items.

Table 12 Options

Parameter

Type

Description

fsType

String

File system type. Set this parameter based on the storage volume type.

  • ext4 (EVS)
  • nfs (SFS)
  • obs (OBS)
  • efs (SFS Turbo)

region

String

Region where the cloud storage is located.

volumeID

String

UUID of the cloud storage. If the cloud storage is an OBS bucket, set this parameter to the bucket name.

storageType

String

Cloud storage volume type.

  • bs (EVS)
  • nfs (SFS)
  • obs (OBS)
  • efs (SFS Turbo)
Table 13 PersistentVolumeStatus

Parameter

Type

Description

accessModes

Array of strings

Access mode of a PV

phase

String

PV status. Possible values:

  • Available: The volume is not bound to any PVC.
  • Bound: The PV has been bound to a PVC.
  • Released: The PVC bound to the PV has been deleted, but the PV has not been made available again for a new claim in the cluster.
  • Failed: Automatic reclaim of the volume has failed.

Example Requests

  • Specify an EVS volume ID and create a PV (in a v1.9 cluster).
    {
      "apiVersion" : "v1",
      "kind" : "PersistentVolume",
      "metadata" : {
        "labels" : {
          "name" : "pv-test"
        },
        "name" : "pv-test"
      },
      "spec" : {
        "accessModes" : [ "ReadWriteMany" ],
        "flexVolume" : {
          "driver" : "huawei.com/fuxivol",
          "fsType" : "ext4",
          "options" : {
            "fsType" : "ext4",
            "kubernetes.io/namespace" : "default",
            "region" : "southchina",
            "volumeID" : "76e01b29-08b9-11e8-9ca5-1051722006ec",
            "storageType" : "bs"
          }
        },
        "persistentVolumeReclaimPolicy" : "Delete"
      }
    }
  • {
      "apiVersion" : "v1",
      "kind" : "PersistentVolume",
      "metadata" : {
        "labels" : {
          "name" : "pv-test"
        },
        "name" : "pv-test"
      },
      "spec" : {
        "accessModes" : [ "ReadWriteMany" ],
        "flexVolume" : {
          "driver" : "huawei.com/fuxivol",
          "fsType" : "ext4",
          "options" : {
            "fsType" : "ext4",
            "region" : "southchina",
            "volumeID" : "76e01b29-08b9-11e8-9ca5-1051722006ec",
            "storageType" : "bs"
          }
        },
        "persistentVolumeReclaimPolicy" : "Delete"
      }
    }

Example Responses

Status code: 201

The job for creating a PV has been delivered.

{
  "kind" : "PersistentVolume",
  "apiVersion" : "v1",
  "metadata" : {
    "name" : "pv-test",
    "namespace" : "default",
    "selfLink" : "/api/v1/namespaces/default/persistentvolumes/pv-test",
    "uid" : "e174188f-ff21-11e7-855b-fa163eaf5675",
    "resourceVersion" : "174229",
    "creationTimestamp" : "2018-01-22T03:11:03Z",
    "labels" : {
      "name" : "pv-test"
    },
    "enable" : true
  },
  "spec" : {
    "capacity" : {
      "storage" : "1Gi"
    },
    "accessModes" : [ "ReadWriteMany" ],
    "flexVolume" : {
      "driver" : "huawei.com/fuxivol",
      "fsType" : "ext4",
      "options" : {
        "fsType" : "ext4",
        "kubernetes.io/namespace" : "default",
        "volumeID" : "0781b22f-4d89-4e9c-b026-80e545cea16c"
      }
    },
    "persistentVolumeReclaimPolicy" : "Delete"
  },
  "status" : {
    "phase" : "Pending"
  }
}

Status Codes

Status Code

Description

201

The job for creating a PV has been delivered.

Error Codes

See Error Codes.