
# 导入存储
#### 功能介绍
导入已有存储到指定的命名空间。
当前支持**导入EVS（云硬盘卷，块存储）、SFS（文件存储卷）、SFS Turbo** **（极速文件存储卷）** 、**OBS（对象存储卷）**，使用时 spec.storageClassName 参数的取值如下：
- sata：普通I/O云硬盘卷
- sas：高I/O云硬盘卷
- ssd：超高I/O云硬盘卷
- nfs-rw：标准文件协议类型文件存储卷
- efs-performance：性能型极速文件存储卷
- efs-standard：标准型极速文件存储卷
- obs：对象存储卷
![](https://support.huaweicloud.com/api-cci/public_sys-resources/note_3.0-zh-cn.png)
- 回收策略采用 **DELETE**，即PVC被删除后，立即删除存储。
- OBS对象存储包含"对象桶"和"并行文件系统"两种类型。并行文件系统是OBS提供的一种经过优化的高性能文件系统，提供毫秒级别访问时延，以及TB/s级别带宽和百万级别的IOPS，相较于OBS对象存储在稳定性、性能上更具优势。因此如需通过挂载方式，**生产环境中推荐您使用OBS并行文件系统**，而不推荐OBS对象存储。
 
#### URI
POST /api/v1/namespaces/{namespace}/extended-persistentvolumeclaims
表1Path参数 
| 参数        | 参数类型   | 描述    |
|:---|:---|:---|
| namespace | String | 命名空间。 |
   
#### 请求消息
**请求参数**
表2PersistentVolumeClaim v1 数据结构说明 
| 参数         | 是否必选 | 参数类型   | 描述                                                                                                                                                                                                                                         |
|:---|:---|:---|:---|
| 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. 详情请参见[表10](https://support.huaweicloud.com/api-cci/cci_02_0074.html#cci_02_0074__zh-cn_topic_0079614925_table47756489)。 其中annotations字段请参见[表3]。 |
| spec       | Yes  | Object | Spec defines the desired characteristics of a volume requested by a pod author. 详情请参见[表177](https://support.huaweicloud.com/api-cci/cci_02_0074.html#cci_02_0074__table31902563)。                                                          |
| status     | No   | Object | Status represents the current information/status of a persistent volume claim. Read-only. 详情请参见[表178](https://support.huaweicloud.com/api-cci/cci_02_0074.html#cci_02_0074__table29397739)。                                                |
   
 表3metadata.annotations字段说明 
| 参数              | 是否必选 | 参数类型   | 描述                                                                                                                                                                                                                                                                                                                  |
|:---|:---|:---|:---|
| fsType          | Yes  | String | 文件系统名称。可设置为： - 块存储：ext4  - 对象存储： obs  - 文件存储、极速文件存储： nfs   |
| volumeID        | Yes  | String | 卷id。                                                                                                                                                                                                                                                                                                                |
| deviceMountPath | No   | String | 共享路径。 说明： 只有文件存储卷和极速文件存储卷需要设置该值。                                                                                                                                                                                                                           |
   
**请求示例**
```
{
    "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"
    }
}
```
#### 响应消息
**响应参数**
表4响应参数 
| 参数                    | 类型     | 描述                                                                                                |
|:---|:---|:---|
| PersistentVolumeClaim | Object | 详情请参见[表175](https://support.huaweicloud.com/api-cci/cci_02_0074.html#cci_02_0074__table37685299)。 |
   
**响应示例**
```
{
    "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"
    }
}
```
#### 状态码
表5状态码 
| 状态码 | 描述                     |
|:---|:---|
| 200 | Export volume success. |
   
更多状态码请参见[状态码](https://support.huaweicloud.com/api-cci/cci_02_0068.html)。
