Add NFS Storage

POST/zstack/v1/primary-storage/nfs

Headers

Authorization: OAuth the-session-uuid

Body

{
  "params": {
    "url": "192.168.0.25:/share/nfs",
    "name": "PS1",
    "type": "NFS",
    "zoneUuid": "4539fbc9b2704ef0a9ee7ee30af7c64e"
  },
  "systemTags": [],
  "userTags": []
}

In the example above, systemTags and userTags fields can be omitted. They are listed to indicate that the body can contain these two fields.

Curl Examples

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/nfs

Parameter List

NameTypeLocationDescriptionAllowed ValuesStarting Version
urlStringbody (nested in params structure)NFS exported address, format is nfs-host:/path/to/export 0.6
nameStringbody (nested in params structure)NFS storage name 0.6
description (optional)Stringbody (nested in params structure)Detailed description of the NFS storage 0.6
type (optional)Stringbody (nested in params structure)Type is NFS 0.6
zoneUuidStringbody (nested in params structure)Data Center UUID 0.6
resourceUuid (optional)Stringbody (nested in params structure)Resource UUID. If specified, the NFS data storage will use this value as its UUID. 0.6
systemTags (optional)ListbodySystem tags 0.6
userTags (optional)ListbodyUser tags 0.6

API Response

Response Example

{
  "inventory": {
    "name": "PS1",
    "url": "/Cloud_ps",
    "type": "LocalStorage",
    "state": "Enabled",
    "status": "Connected",
    "attachedClusterUuids": [
      "d949efe47c4141508073e2d77f005211"
    ]
  }
}
NameTypeDescriptionStarting Version
errorErrorCodeError code. If not null, indicates the operation failed. This field is null when the operation succeeds. For details, see error0.6
inventoryPrimaryStorageInventoryFor details, see inventory0.6

error

NameTypeDescriptionStarting Version
codeStringError code number, globally unique identifier for the error, such as SYS.1000, HOST.10010.6
descriptionStringBrief description of the error0.6
detailsStringDetailed error information0.6
elaborationStringReserved field, defaults to null0.6
opaqueLinkedHashMapReserved field, defaults to null0.6
causeErrorCodeRoot cause. The source error that triggered the current error. If there is no original error, this field is null0.6

inventory

NameTypeDescriptionStarting Version
uuidStringResource UUID, uniquely identifies the resource0.6
zoneUuidStringData Center UUID0.6
nameStringResource name0.6
urlString 0.6
descriptionStringDetailed description of the resource0.6
totalCapacityLong 0.6
availableCapacityLong 0.6
totalPhysicalCapacityLong 0.6
availablePhysicalCapacityLong 0.6
systemUsedCapacityLong 0.6
typeString 0.6
stateString 0.6
statusString 0.6
mountPathString 0.6
createDateTimestampCreation time0.6
lastOpDateTimestampLast modification time0.6
attachedClusterUuidsList 0.6

SDK Examples

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()