NFS Primary Storage Operations
AddNfsPrimaryStorage
API Request
URLs
POST zstack/v1/primary-storage/nfsHeaders
Authorization: OAuth the-session-uuidBody
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.
{
"params": {
"url": "192.168.0.25:/share/nfs",
"name": "PS1",
"type": "NFS",
"zoneUuid": "4539fbc9b2704ef0a9ee7ee30af7c64e"
},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.Curl
Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"url":"192.168.0.25:/share/nfs","name":"PS1","type":"NFS","zoneUuid":"9ce5da0042333fcaa16e0f7ff20aba13"}}' \
http://localhost:8080/zstack/v1/primary-storage/nfsRequest Parameters
| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| url | String | body (contained in the params structure) | The public URL of NFS. Format: nfs-host:/path/to/export. | 0.6 | |
| name | String | body (contained in the params structure) | The name of the NFS primary storage. | 0.6 | |
| description | String | body (contained in the params structure) | Optional. The detailed description of the NFS primary storage. | 0.6 | |
| type | String | body (contained in the params structure) | Optional. The primary storage type: NFS. | 0.6 | |
| zoneUuid | String | body (contained in the params structure) | The zone UUID. | 0.6 | |
| resourceUuid | String | body (contained in the params structure) | Optional. The resource UUID. If specified, the NFS primary storage will use this field as the UUID. | 0.6 | |
| systemTags | List | body | Optional. The system tags. | 0.6 | |
| userTags | List | body | Optional. The user tags. | 0.6 |
API Response
Sample
Response
{
"inventory": {
"name": "PS1",
"url": "/Cloud_ps",
"type": "LocalStorage",
"state": "Enabled",
"status": "Connected",
"attachedClusterUuids": [
"d949efe47c4141508073e2d77f005211"
]
}
}#error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. | 0.6 |
| description | String | The short description of the error. | 0.6 |
| details | String | The details about the error. | 0.6 |
| elaboration | String | The reserved field. Default value: null. | 0.6 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 0.6 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 0.6 |
#inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 0.6 |
| zoneUuid | String | The zone UUID. | 0.6 |
| name | String | The resource name. | 0.6 |
| url | String | 0.6 | |
| description | String | The detailed description of the resource. | 0.6 |
| totalCapacity | Long | 0.6 | |
| availableCapacity | Long | 0.6 | |
| totalPhysicalCapacity | Long | 0.6 | |
| availablePhysicalCapacity | Long | 0.6 | |
| systemUsedCapacity | Long | 0.6 | |
| type | String | 0.6 | |
| state | String | 0.6 | |
| status | String | 0.6 | |
| mountPath | String | 0.6 | |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
| attachedClusterUuids | List | 0.6 |
SDK Sample
Java
SDK
AddNfsPrimaryStorageAction action = new AddNfsPrimaryStorageAction();
action.url = "192.168.0.25:/share/nfs";
action.name = "PS1";
action.type = "NFS";
action.zoneUuid = "af419954499e4b92b30a9a1467ef83a8";
action.sessionId = "03c711c7f3c84733a032d86796e7bdee";
AddNfsPrimaryStorageAction.Result res = action.call();Python
SDK
AddNfsPrimaryStorageAction action = AddNfsPrimaryStorageAction()
action.url = "192.168.0.25:/share/nfs"
action.name = "PS1"
action.type = "NFS"
action.zoneUuid = "57d530e766014126861c6873ea6fbc7d"
action.sessionId = "4b9d819194df4e57821921721a856e2d"
AddNfsPrimaryStorageAction.Result res = action.call()