Submit Long Job (SubmitLongJob)

API Request

URLs
POST zstack/v1/longjobs
Headers
Authorization: OAuth the-session-uuid
Body
{   "params": {     "name": "migrate-volume",     "description": "migrate volume to another Ceph primary storage",     "jobName": "APIPrimaryStorageMigrateVolumeMsg",     "jobData": "{\"volumeUuid\":\"45a53d3d93384433add8ead7616586cf\", \"dstPrimaryStorageUuid\":\"70a0618804864b3dabe8be9824c8028c\"}",     "targetResourceUuid": "45a53d3d93384433add8ead7616586cf"   },   "systemTags": [],   "userTags": [] }
Note: In the above example, the systemTags and userTags fields are optional. They are listed to indicate that these two fields can be included in the body.
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" \ -H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \ -X POST -d '{"params":{"name":"migrate-volume","description":"migrate volume to another Ceph primary storage","jobName":"APIPrimaryStorageMigrateVolumeMsg","jobData":"{\"volumeUuid\":\"45a53d3d93384433add8ead7616586cf\", \"dstPrimaryStorageUuid\":\"70a0618804864b3dabe8be9824c8028c\"}","targetResourceUuid":"45a53d3d93384433add8ead7616586cf"}}' \ http://localhost:8080/zstack/v1/longjobs
Parameter List
Name Type Location Description Allowed Values Starting Version
name (Optional) String body (contained in the params structure) Resource name 2.3
description (Optional) String body (contained in the params structure) Detailed description of the resource 2.3
jobName String body (contained in the params structure) Job name 2.3
jobData String body (contained in the params structure) Job data 2.3
resourceUuid (Optional) String body (contained in the params structure) Resource UUID 2.3
systemTags (Optional) List body System tags 2.3
userTags (Optional) List body User tags 2.3
targetResourceUuid (Optional) String body (contained in the params structure) 2.3
Note:
  • ZStack ZSphere uses an identifier to mark the upload of a specific image for this longjob. The IMAGE_ID is specified by the user, typically as an md5 value. Add the uploadImage option to SystemTags.
    • Option format: uploadImage::{IMAGE_ID}
    • Example: uploadImage::68b329da9893e34099c7d8ad5cb9c940

API Response

Response example
{   "inventory": {     "uuid": "23598186b9ef35aa89fbebf8f04d497a"   } }
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation failed. This field is null when the operation succeeds. For details, see error 2.3
inventory LongJobInventory For details, see inventory 2.3
#error
Name Type Description Starting Version
code String The error code number. A globally unique identifier for the error, such as SYS.1000, HOST.1001. 2.3
description String A brief description of the error 2.3
details String The detailed error information 2.3
elaboration String A reserved field. Default is null. 2.3
opaque LinkedHashMap A reserved field. Default is null. 2.3
cause ErrorCode The root error. The source error that caused the current error. This field is null if there is no root error. 2.3
#inventory
Name Type Description Starting Version
uuid String The UUID of the resource. Uniquely identifies the resource. 2.3
name String Resource name 2.3
description String Detailed description of the resource 2.3
apiId String The API ID used to associate with TaskProgress 2.3
jobName String Job name 2.3
jobData String Job data 2.3
jobResult String Job result 2.3
targetResourceUuid String Target resource UUID 2.3
managementNodeUuid String Management node UUID 2.3
createDate Timestamp Creation time 2.3
lastOpDate Timestamp Last modification time 2.3
state LongJobState For details, see state 2.3
#state
Name Type Description Starting Version
name String Resource name 2.3
ordinal int 2.3

SDK Examples

Java SDK
SubmitLongJobAction action = new SubmitLongJobAction(); action.name = "migrate-volume"; action.description = "migrate volume to another Ceph primary storage"; action.jobName = "APIPrimaryStorageMigrateVolumeMsg"; action.jobData = "{"volumeUuid":"45a53d3d93384433add8ead7616586cf", "dstPrimaryStorageUuid":"70a0618804864b3dabe8be9824c8028c"}"; action.targetResourceUuid = "45a53d3d93384433add8ead7616586cf"; action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"; SubmitLongJobAction.Result res = action.call();
Python SDK
SubmitLongJobAction action = SubmitLongJobAction() action.name = "migrate-volume" action.description = "migrate volume to another Ceph primary storage" action.jobName = "APIPrimaryStorageMigrateVolumeMsg" action.jobData = "{"volumeUuid":"45a53d3d93384433add8ead7616586cf", "dstPrimaryStorageUuid":"70a0618804864b3dabe8be9824c8028c"}" action.targetResourceUuid = "45a53d3d93384433add8ead7616586cf" action.sessionId = "b86c9016b4f24953a9edefb53ca0678c" SubmitLongJobAction.Result res = action.call()

Delete Long Job (DeleteLongJob)

API Request

URLs
DELETE zstack/v1/longjobs/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" \ -H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \ -X DELETE http://localhost:8080/zstack/v1/longjobs/a87ae356c6583cc7b312412337f96609?
Parameter List
Name Type Location Description Allowed Values Starting Version
uuid String url The UUID of the resource. Uniquely identifies the resource. 2.3
systemTags (Optional) List body System tags 2.3
userTags (Optional) List body User tags 2.3

API Response

On success, this API returns an empty JSON structure {}. On failure, the returned JSON structure contains an error field. For example:
{     "error": {         "code": "SYS.1001",         "description": "A message or a operation timeout",         "details": "Create VM on KVM timeout after 300s"     } }

SDK Examples

Java SDK
DeleteLongJobAction action = new DeleteLongJobAction(); action.uuid = "a87ae356c6583cc7b312412337f96609"; action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"; DeleteLongJobAction.Result res = action.call();
Python SDK
DeleteLongJobAction action = DeleteLongJobAction() action.uuid = "a87ae356c6583cc7b312412337f96609" action.sessionId = "b86c9016b4f24953a9edefb53ca0678c" DeleteLongJobAction.Result res = action.call()

Update Long Job (UpdateLongJob)

API Request

URLs
PUT zstack/v1/longjobs/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{   "updateLongJob": {     "name": "new-name",     "description": "new-description"   },   "systemTags": [],   "userTags": [] }
Note: In the above example, the systemTags and userTags fields are optional. They are listed to indicate that these two fields can be included in the body.
Curl Example
curl -H "Content-Type: application/json;charset=UTF-8" \ -H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \ -X PUT -d '{"updateLongJob":{"name":"new-name","description":"new-description"}}' http://localhost:8080/zstack/v1/longjobs/dee3e1e3706f3e52a2cb9a47850508e7/actions
Parameter List
Name Type Location Description Allowed Values Starting Version
uuid String url The UUID of the resource. Uniquely identifies the resource. 3.9.0
name (Optional) String body (contained in the updateLongJob structure) Resource name 3.9.0
description (Optional) String body (contained in the updateLongJob structure) Detailed description of the resource 3.9.0
systemTags (Optional) List body System tags 3.9.0
userTags (Optional) List body User tags 3.9.0

API Response

Response example
{   "inventory": {     "uuid": "464cdf695427358696dae171544b67ef",     "name": "new-name",     "description": "new-description"   } }
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation failed. This field is null when the operation succeeds. For details, see error 3.9.0
inventory LongJobInventory For details, see inventory 3.9.0
#error
Name Type Description Starting Version
code String The error code number. A globally unique identifier for the error, such as SYS.1000, HOST.1001. 3.9.0
description String A brief description of the error 3.9.0
details String The detailed error information 3.9.0
elaboration String A reserved field. Default is null. 3.9.0
opaque LinkedHashMap A reserved field. Default is null. 3.9.0
cause ErrorCode The root error. The source error that caused the current error. This field is null if there is no root error. 3.9.0
#inventory
Name Type Description Starting Version
uuid String The UUID of the resource. Uniquely identifies the resource. 3.9.0
name String Resource name 3.9.0
description String Detailed description of the resource 3.9.0
apiId String The API ID used to associate with TaskProgress 3.9.0
jobName String Job name 3.9.0
jobData String Job data 3.9.0
jobResult String Job result 3.9.0
targetResourceUuid String Target resource UUID 3.9.0
managementNodeUuid String Management node UUID 3.9.0
createDate Timestamp Creation time 3.9.0
lastOpDate Timestamp Last modification time 3.9.0
state LongJobState For details, see state 3.9.0
#state
Name Type Description Starting Version
Waiting LongJobState 3.9.0
Suspended LongJobState 3.9.0
Running LongJobState 3.9.0
Succeeded LongJobState 3.9.0
Canceling LongJobState 3.9.0
Canceled LongJobState 3.9.0
Failed LongJobState 3.9.0

SDK Examples

Java SDK
UpdateLongJobAction action = new UpdateLongJobAction(); action.uuid = "dee3e1e3706f3e52a2cb9a47850508e7"; action.name = "new-name"; action.description = "new-description"; action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"; UpdateLongJobAction.Result res = action.call();
Python SDK
UpdateLongJobAction action = UpdateLongJobAction() action.uuid = "dee3e1e3706f3e52a2cb9a47850508e7" action.name = "new-name" action.description = "new-description" action.sessionId = "b86c9016b4f24953a9edefb53ca0678c" UpdateLongJobAction.Result res = action.call()



Archives

Download Document Archives

Download

Already filled the basic info?Click here.

Enter at least 2 characters.
Cannot be empty.
Invalid mobile number.
Enter at least 4 characters.
Invalid email address.
Wrong code. Try again. Send Code Resend Code (60s)

An email with a verification code will be sent to you. Make sure the address you provided is valid and correct.

同意 不同意

I have read and concur with the Site TermsPrivacy PolicyRules and Conventions on User Management of ZStack Cloud

Download

Not filled the basic info yet? Click here.

Invalid email address or mobile number.
同意 不同意

I have read and concur with the Site TermsPrivacy PolicyRules and Conventions on User Management of ZStack Cloud

Email Us

contact@zstack.io
ZStack Training and Certification
Enter at least 2 characters.
Invalid mobile number.
Enter at least 4 characters.
Invalid email address.
Wrong code. Try again. Send Code Resend Code (60s)

同意 不同意

I have read and concur with the Site TermsPrivacy PolicyRules and Conventions on User Management of ZStack Cloud

Email Us

contact@zstack.io
Request Trial
Enter at least 2 characters.
Invalid mobile number.
Enter at least 4 characters.
Invalid email address.
Wrong code. Try again. Send Code Resend Code (60s)

同意 不同意

I have read and concur with the Site TermsPrivacy PolicyRules and Conventions on User Management of ZStack Cloud

Email Us

contact@zstack.io

The download link is sent to your email address.

If you don't see it, check your spam folder, subscription folder, or AD folder. After receiving the email, click the URL to download the documentation.

The download link is sent to your email address.

If you don't see it, check your spam folder, subscription folder, or AD folder.
Or click on the URL below. (For Internet Explorer, right-click the URL and save it.)

Thank you for using ZStack products and services.

Submit successfully.

We'll connect soon.

Thank you for using ZStack products and services.