Image Storage Related InterfacesImage Related Interfaces

Create Data Volume Template from Volume

POST/zstack/v1/images/data-volume-templates/from/volumes/{volumeUuid}

Hearders

Authorization: OAuth the-session-uuid

Body

{
  "params": {
    "name": "My Data Volume Template",
    "backupStorageUuids": [
      "7fd08286addc4b388fac61935892acd7"
    ]
  },
  "systemTags": [],
  "userTags": []
}

In the above example, 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":{"name":"My Data Volume Template","backupStorageUuids":["08e337886b873e8685991d1c7ba4d1ab"]}}' \
http://localhost:8080/zstack/v1/images/data-volume-templates/from/volumes/4c941eb9faeb3976803fce2f3609a475

Parameter List

NameTypeLocationDescriptionAllowed ValuesStarting Version
nameStringbody (contained in params structure)Data Volume Image name 0.6
description (Optional)Stringbody (contained in params structure)Detailed description of the Data Volume Image 0.6
volumeUuidStringbody (contained in params structure)Source Volume UUID 0.6
backupStorageUuids (Optional)Listbody (contained in params structure)Image Storage UUID List 0.6
resourceUuid (Optional)Stringbody (contained in params structure)Data Volume Image UUID. If specified, the Data Volume Image will use this field value as its UUID. 0.6
systemTags (Optional)ListbodySystem Tags 0.6
userTags (Optional)ListbodyUser Tags 0.6

API Response

Response Example

{
  "inventory": {
    "uuid": "7247cf569e2b4104832071822cf845c5",
    "name": "My Data Volume Template",
    "mediaType": "DataVolumeTemplate",
    "platform": "Linux",
    "format": "raw",
    "backupStorageRefs": [
      {
        "id": 0.0,
        "imageUuid": "7247cf569e2b4104832071822cf845c5",
        "backupStorageUuid": "1b8ab68b7e224a30aa31f00f1db2b5a6",
        "installPath": "ceph://zs-data-volume/0cd599ec519249489475112a058bb93a",
        "status": "Ready"
      }
    ]
  }
}
NameTypeDescriptionStarting Version
errorErrorCodeError code. If not null, the operation failed. This field is null when the operation succeeds. See error0.6
inventoryImageInventorySee 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 triggered the current error. This field is null if there is no original error0.6

inventory

NameTypeDescriptionStarting Version
uuidStringResource UUID, uniquely identifies the resource0.6
nameStringResource name0.6
descriptionStringDetailed description of the resource0.6
stateString 0.6
statusString 0.6
sizeLong 0.6
actualSizeLong 0.6
md5SumString 0.6
urlString 0.6
mediaTypeString 0.6
guestOsTypeString 0.6
typeString 0.6
platformString 0.6
formatString 0.6
systemBoolean 0.6
createDateTimestampCreation time0.6
lastOpDateTimestampLast modification time0.6
backupStorageRefsListSee backupStorageRefs0.6

backupStorageRefs

NameTypeDescriptionStarting Version
imageUuidStringImage UUID0.6
backupStorageUuidStringImage Storage UUID0.6
installPathString 0.6
exportUrlString 0.6
exportMd5SumString 0.6
statusString 0.6
createDateTimestampCreation time0.6
lastOpDateTimestampLast modification time0.6

SDK Examples

Java SDK

CreateDataVolumeTemplateFromVolumeAction action = new CreateDataVolumeTemplateFromVolumeAction();
action.name = "My Data Volume Template";
action.volumeUuid = "816fb7184ae2498189000d7c0fe66112";
action.backupStorageUuids = asList("26b9d22ef1af4bdb880c3d77a8b1feda");
action.sessionId = "c17620d57db14c9383fbdd2650c80a73";
CreateDataVolumeTemplateFromVolumeAction.Result res = action.call();

Python SDK

CreateDataVolumeTemplateFromVolumeAction action = CreateDataVolumeTemplateFromVolumeAction()
action.name = "My Data Volume Template"
action.volumeUuid = "38b644a29b2d498ebc5b50d1d212d904"
action.backupStorageUuids = [1954c35eb0a844d8bb6a64f9963be0f5]
action.sessionId = "343ff2f080414010adb1a35957f8b700"
CreateDataVolumeTemplateFromVolumeAction.Result res = action.call()