Add External Primary Storage

POST/zstack/v1/primary-storage/addon

Headers

Authorization: OAuth the-session-uuid

Body

{
  "params": {
    "identity": "zbd",
    "url": "vendorname://user:password@host:port/pool",
    "name": "my primary storage"
  },
  "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 Example

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"identity":"zbd","url":"vendorname://user:password@host:port/pool","name":"my primary storage"}}' \
http://localhost:8080/zstack/v1/primary-storage/addon

Parameter List

Name

Type

Location

Description

Allowed Values

Starting Version

identity

String

body(contained in params structure)

Storage Identity

 

5.0.0

defaultOutputProtocol

String

body(contained in params structure)

Default Output Protocol

  • Vhost
  • Scsi
  • Nvme
  • Curve
  • file

5.0.0

config (Optional)

String

body(contained in params structure)

Configuration

 

5.0.0

url

String

body(contained in params structure)

 

 

5.0.0

name

String

body(contained in params structure)

Resource Name

 

5.0.0

description (Optional)

String

body(contained in params structure)

Resource Description

 

5.0.0

type (Optional)

String

body(contained in params structure)

Type

 

5.0.0

zoneUuid

String

body(contained in params structure)

Data Center UUID

 

5.0.0

resourceUuid (Optional)

String

body(contained in params structure)

Resource UUID

 

5.0.0

tagUuids (Optional)

List

body(contained in params structure)

Tag UUID List

 

5.0.0

systemTags (Optional)

List

body

System Tags

 

5.0.0

userTags (Optional)

List

body

User Tags

 

5.0.0

API Response

Response Example

{
  "inventory": {
    "name": "PS1",
    "url": "/zstack_ps",
    "type": "LocalStorage",
    "state": "Enabled",
    "status": "Connected",
    "attachedClusterUuids": [
      "c6e9684e8bb93a9192c946dcd0564b39"
    ]
  }
}
NameTypeDescriptionStarting Version
successboolean 0.6
errorErrorCodeError code. If not null, the operation failed. When the operation succeeds, this field is null. See error0.6
inventoryPrimaryStorageInventorySee inventory0.6

error

NameTypeDescriptionStarting Version
codeStringError code number, a globally unique identifier for the error, for example 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 caused 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
descriptionStringResource Description0.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
createDateTimestampCreate Time0.6
lastOpDateTimestampLast Modification Time0.6
attachedClusterUuidsList 0.6

SDK Examples

Java SDK

AddExternalPrimaryStorageAction action = new AddExternalPrimaryStorageAction();
action.identity = "zbd";
action.url = "vendorname://user:password@host:port/pool";
action.name = "my primary storage";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
AddExternalPrimaryStorageAction.Result res = action.call();

Python SDK

AddExternalPrimaryStorageAction action = AddExternalPrimaryStorageAction()
action.identity = "zbd"
action.url = "vendorname://user:password@host:port/pool"
action.name = "my primary storage"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
AddExternalPrimaryStorageAction.Result res = action.call()