创建共享createShare
约束说明
- 该接口为异步接口,返回为200只是表示接口下发接收成功,后续可以通过6.2.4 查询共享详细信息查询共享的共享状态和共享路径,判断创建共享是否完成以及是否成功,如果共享状态变为available,或者共享路径已经生成,说明创建已经成功。
- 通过该接口创建共享成功后,用户还需要参考接口"添加共享访问规则添加共享访问规则",之后才可正常使用创建的共享。
URL
POST https://sfs.cn-south-2.myhuaweicloud.com/v2/{project_id}/shares
请求参数
名称 | 类型 | IN | 必选 | 描述 |
---|---|---|---|---|
X-Auth-Token
|
string | header | 是 |
用户Token。 通过调用 IAM 服务获取用 |
X-Openstack-Manila-Api-Version
|
float | header | 否 |
指定API微版本号 |
project_id
|
string | path | 是 |
操作用户的项目ID |
Body参数
名称 | 类型 | 必选 | 描述 |
---|---|---|---|
share
|
share object | 是 |
详见share字段说明 |
返回参数
请求示例
示例 1
创建共享
"POST https://{endpoint}/v2/{project_id}/shares"
{ "share": { "description": "test description", "is_public": false, "metadata": { "key1": "value1", "key2": "value2" }, "name": "test", "share_network_id": null, "share_proto": "NFS", "share_type": null, "size": 1, "snapshot_id": null } }
返回示例
返回码:202
Accepted
示例 1
{
"share": {
"availability_zone": "az1.dc1",
"created_at": "2015-09-18T10:25:24.533287",
"description": "My custom share London",
"export_location": null,
"export_locations": [],
"host": null,
"id": "011d21e2-fbc3-4e4a-9993-9ea223f73264",
"is_public": true,
"links": [
{
"href": "http://192.168.198.54:8786/v2/16e1ab15c35a457e9c2b2aa189f544e1/shares/011d21e2-fbc3-4e4a-9993-9ea223f73264",
"rel": "self"
},
{
"href": "http://192.168.198.54:8786/16e1ab15c35a457e9c2b2aa189f544e1/shares/011d21e2-fbc3-4e4a-9993-9ea223f73264",
"rel": "bookmark"
}
],
"metadata": {
"aim": "doc",
"project": "my_app"
},
"name": "share_London",
"project_id": "16e1ab15c35a457e9c2b2aa189f544e1",
"share_network_id": null,
"share_proto": "NFS",
"share_type": "25747776-08e5-494f-ab40-a64b9d20d8f7",
"size": 1,
"snapshot_id": null,
"status": "creating",
"volume_type": "default"
}
}
"share": {
"availability_zone": "az1.dc1",
"created_at": "2015-09-18T10:25:24.533287",
"description": "My custom share London",
"export_location": null,
"export_locations": [],
"host": null,
"id": "011d21e2-fbc3-4e4a-9993-9ea223f73264",
"is_public": true,
"links": [
{
"href": "http://192.168.198.54:8786/v2/16e1ab15c35a457e9c2b2aa189f544e1/shares/011d21e2-fbc3-4e4a-9993-9ea223f73264",
"rel": "self"
},
{
"href": "http://192.168.198.54:8786/16e1ab15c35a457e9c2b2aa189f544e1/shares/011d21e2-fbc3-4e4a-9993-9ea223f73264",
"rel": "bookmark"
}
],
"metadata": {
"aim": "doc",
"project": "my_app"
},
"name": "share_London",
"project_id": "16e1ab15c35a457e9c2b2aa189f544e1",
"share_network_id": null,
"share_proto": "NFS",
"share_type": "25747776-08e5-494f-ab40-a64b9d20d8f7",
"size": 1,
"snapshot_id": null,
"status": "creating",
"volume_type": "default"
}
}
错误码
请参考 错误码说明。