Updated on 2023-12-21 GMT+08:00

Importing a Storage Device

Function

This API is used to import an existing storage device to a specified namespace.

Currently, EVS, SFS, SFS Turbo, and OBS volumes can be imported to CCI. The spec.storageClassName parameter specifies the volume type. It has the following values:

  • sata: common I/O EVS volume
  • sas: high I/O EVS volume
  • ssd: ultra-high I/O EVS volume
  • nfs-rw: Network File System (NFS) volume
  • efs-performance: high-performance SFS Turbo volume
  • efs-standard: standard SFS volume
  • obs: OBS volume
  • The reclaim policy is set to DELETE. To be specific, the storage is deleted immediately after the PVC is deleted. If you want to retain the storage, you can use Unbinding a Storage Device.
  • OBS provides object buckets and Parallel File Systems (PFSs). PFS is a high-performance file system provided by OBS, with access latency in milliseconds. PFS can support a bandwidth performance up to TB/s and supports millions of IOPS, outperforming OBS buckets. Therefore, you are advised to use OBS parallel file systems instead of OBS buckets (when mounting these objects) in the production environment.

URI

POST /api/v1/namespaces/{namespace}/extended-persistentvolumeclaims

Table 1 Path parameter

Parameter

Type

Description

namespace

String

Namespace to which the storage is to be imported.

Request

Request parameters

Table 2 Data structure of PersistentVolumeClaim v1

Parameter

Mandatory

Type

Description

apiVersion

Yes

String

apiVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values.

kind

Yes

String

kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated.

metadata

Yes

Object

Standard object's metadata. For details, see Table 10.

For details about the annotations field, see Table 3.

spec

Yes

Object

Spec defines the desired characteristics of a volume requested by a pod author. For details, see Table 177.

status

No

Object

Status represents the current information/status of a persistent volume claim. Read-only. For details, see Table 178.

Table 3 Description of the metadata.annotations field

Parameter

Mandatory

Type

Description

fsType

Yes

String

Name of the file system. The value can be:

  • ext4: EVS disk
  • obs: OBS bucket
  • nfs: SFS or SFS Turbo file system

volumeID

Yes

String

Volume ID.

deviceMountPath

No

String

Shared path.

NOTE:

Set this parameter only for SFS and SFS Turbo volumes.

Example request

{
    "apiVersion": "v1",
    "kind": "PersistentVolumeClaim",
    "metadata": {
        "annotations": {
            "fsType": "nfs",
            "volumeID": "378dfa73-3ae4-4179-81c0-67699976b505",
            "deviceMountPath": "sfs-nas01.cn-north-4b.myhuaweicloud.com:/share-84b38e4d"
        },
        "name": "cci-sfs-jxre8q80-ylpd",
        "namespace": "test-namespace"
    },
    "spec": {
        "resources": {
            "requests": {
                "storage": "10Gi"
            }
        },
        "storageClassName": "nfs-rw"
    }
}

Response

Response parameters

Table 4 Response parameters

Parameter

Type

Description

PersistentVolumeClaim

Object

For details, see Table 175.

Example response

{
    "metadata": {
        "name": "pvc-import-evs",
        "namespace": "test-namespace",
        "selfLink": "/api/v1/namespaces/test-namespace/persistentvolumeclaims/pvc-import-evs",
        "uid": "17646a17-a471-11e9-be8a-b44326d0c915",
        "resourceVersion": "65016560",
        "creationTimestamp": "2019-07-12T06:48:44Z",
        "annotations": {
            "kubernetes.io/volumeId": "378dfa73-3ae4-4179-81c0-67699976b505"
        }
    },
    "spec": {
        "accessModes": [
            "ReadWriteMany"
        ],
        "resources": {
            "requests": {
                "storage": "10"
            }
        },
        "storageClassName": "sata"
    },
    "status": {
        "phase": "Pending"
    }
}

Status Code

Table 5 Status code

Status Code

Description

200

Export volume success.

For more status codes, see Status Codes.