Add Distributed Storage

POST/zstack/v1/primary-storage/ceph

Headers

Authorization: OAuth the-session-uuid

Body

{
  "params": {
    "monUrls": [
      "root:password@localhost/?monPort=7777"
    ],
    "rootVolumePoolName": "zs-images",
    "dataVolumePoolName": "zs-data-volume",
    "imageCachePoolName": "zs-image-cache",
    "name": "My Ceph Primary Storage",
    "zoneUuid": "d42197a462c34a44989bdf38d5aa2424"
  },
  "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":{"monUrls":["root:password@localhost/?monPort=7777"],"rootVolumePoolName":"zs-images","dataVolumePoolName":"zs-data-volume","imageCachePoolName":"zs-image-cache","name":"My Ceph Primary Storage","zoneUuid":"251a3dffccaf39fc8d190eedcf4395bf"}}' \
http://localhost:8080/zstack/v1/primary-storage/ceph

Parameter List

NameTypeLocationDescriptionAllowed ValuesStarting Version
monUrlsListbody (nested in params structure)List of distributed storage mon addresses 0.6
rootVolumePoolName (optional)Stringbody (nested in params structure)Name of the distributed storage pool for Root Volume 0.6
dataVolumePoolName (optional)Stringbody (nested in params structure)Name of the distributed storage pool for Data Volume 0.6
imageCachePoolName (optional)Stringbody (nested in params structure)Name of the distributed storage pool for Image Cache 0.6
urlStringbody (nested in params structure)Not used 0.6
nameStringbody (nested in params structure)Name of the distributed storage 0.6
description (optional)Stringbody (nested in params structure)Detailed description of the distributed storage 0.6
type (optional)Stringbody (nested in params structure)Type of distributed storage, which is Ceph 0.6
zoneUuidStringbody (nested in params structure)Data Center UUID 0.6
resourceUuid (optional)Stringbody (nested in params structure)Resource UUID. If specified, the distributed storage will use this value as its UUID. 0.6
systemTags (optional)ListbodySystem tags 0.6
userTags (optional)ListbodyUser tags 0.6
  • ZSvirt When adding distributed storage, you can identify the type as xsky, sandstone, or open-source by adding the manufacturer option to SystemTags.
  • Option format: ceph::manufacturer::Platform
  • For example: ceph::manufacturer::xsky
  • ZSvirt When adding distributed storage, you can identify the type as xsky and support the SDK for xsky type distributed storage by adding the thirdPartyPlatform option to SystemTags.
    • Option format: ceph::thirdPartyPlatform::TOKEN
    • For example: ceph::thirdPartyPlatform::68b329da9893e34099c7d8ad5cb9c940

API Response

Response Example

{
  "inventory": {
    "name": "Ceph-1",
    "url": "not used",
    "type": "Ceph",
    "state": "Enabled",
    "status": "Connected",
    "attachedClusterUuids": [
      "2d8583d86bd1472e8ec0e04e26ea273f"
    ]
  }
}
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

AddCephPrimaryStorageAction action = new AddCephPrimaryStorageAction();
action.monUrls = asList("root:password@localhost/?monPort=7777");
action.rootVolumePoolName = "zs-images";
action.dataVolumePoolName = "zs-data-volume";
action.imageCachePoolName = "zs-image-cache";
action.name = "My Ceph Primary Storage";
action.zoneUuid = "88b49879acd34e11afa5bb3ea9164d5a";
action.sessionId = "33a01ee65ac64450940359dc3181f9b1";
AddCephPrimaryStorageAction.Result res = action.call();

Python SDK

AddCephPrimaryStorageAction action = AddCephPrimaryStorageAction()
action.monUrls = [root:password@localhost/?monPort=7777]
action.rootVolumePoolName = "zs-images"
action.dataVolumePoolName = "zs-data-volume"
action.imageCachePoolName = "zs-image-cache"
action.name = "My Ceph Primary Storage"
action.zoneUuid = "0f05052514554462b437f9cfa272f57f"
action.sessionId = "cb3d5ecb63634ca093ea223c55e6a30a"
AddCephPrimaryStorageAction.Result res = action.call()