Image Storage Related InterfacesImage Related Interfaces

Create Data Volume Template from Volume Snapshot

POST/zstack/v1/images/data-volume-templates/from/volume-snapshots/{snapshotUuid}

Create a Data Volume Image from a specified Volume Snapshot.

Headers

Authorization: OAuth the-session-uuid

Body

{
  "params": {
    "name": "My Data Volume Template",
    "backupStorageUuids": [
      "dbf107f8efa531f786f243850499e010"
    ],
  },
  "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":["dbf107f8efa531f786f243850499e010"]}}' \
http://localhost:8080/zstack/v1/images/data-volume-templates/from/volume-snapshots/58976137bf95309692762077cd7077e3

Parameter List

NameTypeLocationDescriptionAllowed ValuesStarting Version
snapshotUuidStringurlSnapshot UUID 0.6
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
backupStorageUuidsListbody (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
tagUuids (Optional)Listbody (contained in params structure)Tag UUID List  
systemTags (Optional)ListbodySystem Tags 0.6
userTags (Optional)ListbodyUser Tags 0.6

API Response

Response Example

{
  "inventory": {
    "uuid": "314d80c2feb5352c984b3ffd36108c32",
    "name": "My Data Volume Template",
    "mediaType": "DataVolumeTemplate",
    "platform": "Linux",
    "format": "raw",
    "backupStorageRefs": [
      {
        "id": 0.0,
        "imageUuid": "314d80c2feb5352c984b3ffd36108c32",
        "backupStorageUuid": "d861144baadf31e3b1cbbb282242adcf",
        "installPath": "ceph://zs-images/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
failuresListSee failures0.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
stateStringImage boot state0.6
statusStringImage ready state0.6
sizeLongImage size0.6
actualSizeLongImage actual capacity0.6
md5SumStringImage md5 value0.6
urlStringImage URL address0.6
mediaTypeStringImage type0.6
guestOsTypeStringGuest Operating System type corresponding to the Image0.6
typeStringInternal use field0.6
platformStringImage system platform0.6
formatStringImage format, for example: raw0.6
systemBooleanIndicates whether it is a system Image0.6
createDateTimestampCreation time0.6
lastOpDateTimestampLast modification time0.6
backupStorageRefsListSee backupStorageRefs0.6

backupStorageRefs

NameTypeDescriptionStarting Version
imageUuidStringImage UUID0.6
backupStorageUuidStringImage Storage UUID0.6
installPathStringInstallation path on the Image Storage0.6
exportUrlStringExport Image URL0.6
exportMd5SumStringExport Image md5 value0.6
statusStringImage ready state0.6
createDateTimestampCreation time0.6
lastOpDateTimestampLast modification time0.6

failures

NameTypeDescriptionStarting Version
backupStorageUuidStringImage Storage UUID0.6
errorErrorCodeSee error0.6

SDK Examples

Java SDK

CreateDataVolumeTemplateFromVolumeSnapshotAction action = new CreateDataVolumeTemplateFromVolumeSnapshotAction();
action.snapshotUuid = "58976137bf95309692762077cd7077e3";
action.name = "My Data Volume Template";
action.backupStorageUuids = asList("dbf107f8efa531f786f243850499e010");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateDataVolumeTemplateFromVolumeSnapshotAction.Result res = action.call();

Python SDK

CreateDataVolumeTemplateFromVolumeSnapshotAction action = CreateDataVolumeTemplateFromVolumeSnapshotAction()
action.snapshotUuid = "58976137bf95309692762077cd7077e3"
action.name = "My Data Volume Template"
action.backupStorageUuids = [dbf107f8efa531f786f243850499e010]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
CreateDataVolumeTemplateFromVolumeSnapshotAction.Result res = action.call()