UploadSoftwarePackage

POST/zstack/v1/software-packages/upload

Headers

Authorization: OAuth the-session-uuid

Body

{
  "params": {
    "name": "software-package-name",
    "type": "storage",
    "managementNodeUuid": "ff000842a4673ab39dad7a3990df5300",
    "hostUuid": "ff0192fa70113da886101145c084bd00",
    "url": "http://192.168.1.1/disk/images/test.qcow2",
    "installPath": "/root/sds/storage.tar.gz"
  },
  "systemTags": [],
  "userTags": []
}

In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.

Curl Sample

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"name":"software-package-name","type":"storage","managementNodeUuid":"ff000842a4673ab39dad7a3990df5300","hostUuid":"ff0192fa70113da886101145c084bd00","url":"http://192.168.1.1/disk/images/test.qcow2","installPath":"/root/sds/storage.tar.gz"}}' \
http://localhost:8080/zstack/v1/software-packages/upload

Parameter List

NameTypeLocationDescriptionAllowed ValuesStarting Version
nameStringbody (contained in the params structure)The software package name. 4.10.20
typeStringbody (contained in the params structure)The software package type. 4.10.20
managementNodeUuidStringbody (contained in the params structure)The Management Node UUID. 4.10.20
hostUuidStringbody (contained in the params structure)The Host UUID. 4.10.20
urlStringbody (contained in the params structure)The software package URL. 4.10.20
installPathStringbody (contained in the params structure)The software package installation path. 4.10.20
resourceUuid (Optional)Stringbody (contained in the params structure)The resource UUID. 4.10.20
tagUuids (Optional)Listbody (contained in the params structure)The tag UUID list. 4.10.20
systemTags (Optional)ListbodyThe system tags. 4.10.20
userTags (Optional)ListbodyThe user tags. 4.10.20
  • Local upload software supports specifying the hash of the software package.
  • SystemTag format: uploadSoftwarePackage::{%s}
  • SystemTag example: uploadSoftwarePackage::1271232183768712367812361287
  • Local upload host returns the URL for UI to upload software package slices.
    • SystemTag format: uploadUrl::{%s}
    • SystemTag example: uploadUrl::http://172.1.1.1:7070/host/file/direct-upload
  • Parameters for uploading the software package.
    • SystemTag format: uploadConfig::{%s}
    • SystemTag example: APIUploadSoftwarePackageMsg converted to json string

API Response

Sample Response

{
  "inventory": {
    "size": 0
  }
}
NameTypeDescriptionStarting Version
successbooleanThe operation success. True if success, false otherwise.4.10.20
errorErrorCodeSee error.4.10.20
inventorySoftwarePackageInventorySee inventory.4.10.20

error

NameTypeDescriptionStarting Version
codeStringThe error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001.0.6
descriptionStringThe brief description of the error.0.6
detailsStringThe details about the error.0.6
elaborationStringReserved field. Default value: null.0.6
opaqueLinkedHashMapReserved field. Default value: null.0.6
causeErrorCodeThe root error, which is the associated root cause of the current error. If no root error exists, this parameter is null.0.6

inventory

NameTypeDescriptionStarting Version
uuidStringThe resource UUID.4.10.20
nameStringThe resource name.4.10.20
hostUuidStringThe Host UUID.4.10.20
managementNodeUuidStringThe Management Node UUID.4.10.20
installPathStringThe installation path.4.10.20
unzipInstallPathStringThe unzip installation path.4.10.20
typeStringThe installation package type.4.10.20
md5sumStringThe installation package MD5 checksum value.4.10.20
statusStringThe installation package status.4.10.20
sizelongThe installation package size.4.10.20
createDateTimestampThe creation date.4.10.20
lastOpDateTimestampThe last operation date.4.10.20

SDK Sample

Java SDK

UploadSoftwarePackageAction action = new UploadSoftwarePackageAction();
action.name = "software-package-name";
action.type = "storage";
action.managementNodeUuid = "ff000842a4673ab39dad7a3990df5300";
action.hostUuid = "ff0192fa70113da886101145c084bd00";
action.url = "http://192.168.1.1/disk/images/test.qcow2";
action.installPath = "/root/sds/storage.tar.gz";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UploadSoftwarePackageAction.Result res = action.call();

Python SDK

action = UploadSoftwarePackageAction()
action.name = "software-package-name"
action.type = "storage"
action.managementNodeUuid = "ff000842a4673ab39dad7a3990df5300"
action.hostUuid = "ff0192fa70113da886101145c084bd00"
action.url = "http://192.168.1.1/disk/images/test.qcow2"
action.installPath = "/root/sds/storage.tar.gz"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()