• Cloud Container Engine

cce
  1. Help Center
  2. Cloud Container Engine
  3. API Reference 2.0
  4. API
  5. Storage Management
  6. Deleting a Persistent Volume

Deleting a Persistent Volume

Function

This API is used to delete a persistent volume from a specified namespace. Using this API, you can determine whether to retain the cloud storage associated with the persistent volume.

URI

DELETE /api/v1/cloudpersistentvolumes/{name}

Table 1 describes the parameters of the API.

Table 1 Parameter description

Parameter

Mandatory

Description

name

Yes

Name of the persistent volume to be deleted.

deleteVolume

No

Whether to retain the backend associated cloud storage after the persistent volume is deleted.

false: retain the cloud storage.

true: delete the cloud storage.

Default: false.

storageType

No

Cloud storage type. This parameter is used together with deleteVolume. That is, storageType is configurable only when deleteVolume has been configured.

  • bs: EVS.
  • nfs: SFS.

Request

N/A

Response

Response parameters:

Table 2 describes the response parameters.

Table 2 Parameter description

Parameter

Mandatory

Type

Description

apiVersion

Yes

String

API version. The value is fixed to v1.

kind

Yes

String

API type. The value is fixed to PersistentVolume.

metadata

Yes

Table 3

-

spec

Yes

Table 4

-

status

No

Table 5

-

Table 3 Data structure of the metadata field

Parameter

Mandatory

Type

Description

name

Yes

String

Name of the persistent volume.

labels

No

String

Label of the persistent volume. A label is a key-value pair.

Table 4 Data structure of the spec field

Parameter

Mandatory

Type

Description

volumeName

No

String

Name of the persistent volume.

NOTE:

If volumeID has been configured, the value of this parameter is invalid.

accessModes

Yes

String array

Access mode of the persistent volume.

Table 5 Data structure of the status field

Parameter

Mandatory

Type

Description

accessModes

No

String array

Access mode of the persistent volume.

capacity

No

Object

Actual resources and capacity of the persistent volume.

phase

No

String

Current status of the persistent volume.

Example response:

{
    "kind": "PersistentVolume",
    "apiVersion": "v1",
    "metadata": {
        "name": "pv-test",
        "selfLink": "/api/v1/persistentvolumes/pv-test",
        "uid": "0d93181d-3628-11e7-9093-fa163e8c373b",
        "resourceVersion": "180886",
        "creationTimestamp": "2017-05-11T08:58:51Z",
        "labels": {
            "app": "test"
        }
    },
    "spec": {
        "flexVolume": {
            "driver": "huawei.com/fuxivol",
            "fsType": "ext4",
            "options": {
                "fsType": "ext4",
                "kubernetes.io/namespace": "default",
                "volumeID": "0781b22f-4d89-4e9c-b026-80e545cea16c"
            }
        },
        "capacity": {
            "storage": "1Gi"
        },
        "accessModes": [
            "ReadWriteMany"
        ],
        "persistentVolumeReclaimPolicy": "Recycle"
    },
    "status": {
        "phase": "Available"
    }
}

Status Code

Table 6 describes the status code of the API.

Table 6 Status code

Status Code

Description

200

The job for deleting a persistent volume is successfully delivered.