mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-6785: Allow async jobs to supply an injectedjobid
This commit is contained in:
parent
d0c249bc9e
commit
2a5bf65c78
|
|
@ -36,6 +36,13 @@ public abstract class BaseAsyncCmd extends BaseCmd {
|
|||
@Parameter(name = "starteventid", type = CommandType.LONG)
|
||||
private Long startEventId;
|
||||
|
||||
@Parameter(name= "injectedjobid", type = CommandType.STRING)
|
||||
private String injectedJobId;
|
||||
|
||||
public String getInjectedJobId() {
|
||||
return this.injectedJobId;
|
||||
}
|
||||
|
||||
/**
|
||||
* For proper tracking of async commands through the system, events must be generated when the command is
|
||||
* scheduled, started, and completed. Commands should specify the type of event so that when the scheduled,
|
||||
|
|
|
|||
|
|
@ -136,12 +136,12 @@ public class AsyncJobVO implements AsyncJob, JobInfo {
|
|||
status = Status.IN_PROGRESS;
|
||||
}
|
||||
|
||||
public AsyncJobVO(String related, long userId, long accountId, String cmd, String cmdInfo, Long instanceId, String instanceType) {
|
||||
public AsyncJobVO(String related, long userId, long accountId, String cmd, String cmdInfo, Long instanceId, String instanceType, String injectedUuid) {
|
||||
this.userId = userId;
|
||||
this.accountId = accountId;
|
||||
this.cmd = cmd;
|
||||
this.cmdInfo = cmdInfo;
|
||||
uuid = UUID.randomUUID().toString();
|
||||
uuid = ( injectedUuid == null ? UUID.randomUUID().toString() : injectedUuid );
|
||||
this.related = related;
|
||||
this.instanceId = instanceId;
|
||||
this.instanceType = instanceType;
|
||||
|
|
|
|||
|
|
@ -661,7 +661,8 @@ public class ApiServer extends ManagerBase implements HttpRequestHandler, ApiSer
|
|||
Long instanceId = (objectId == null) ? asyncCmd.getInstanceId() : objectId;
|
||||
AsyncJobVO job = new AsyncJobVO("", callerUserId, caller.getId(), cmdObj.getClass().getName(),
|
||||
ApiGsonHelper.getBuilder().create().toJson(params), instanceId,
|
||||
asyncCmd.getInstanceType() != null ? asyncCmd.getInstanceType().toString() : null);
|
||||
asyncCmd.getInstanceType() != null ? asyncCmd.getInstanceType().toString() : null,
|
||||
asyncCmd.getInjectedJobId());
|
||||
job.setDispatcher(_asyncDispatcher.getName());
|
||||
|
||||
final long jobId = _asyncMgr.submitAsyncJob(job);
|
||||
|
|
|
|||
|
|
@ -4360,7 +4360,7 @@ public class VirtualNetworkApplianceManagerImpl extends ManagerBase implements V
|
|||
params.put("ctxStartEventId", "1");
|
||||
AsyncJobVO job = new AsyncJobVO("", User.UID_SYSTEM, router.getAccountId(), RebootRouterCmd.class.getName(),
|
||||
ApiGsonHelper.getBuilder().create().toJson(params), router.getId(),
|
||||
cmd.getInstanceType() != null ? cmd.getInstanceType().toString() : null);
|
||||
cmd.getInstanceType() != null ? cmd.getInstanceType().toString() : null, null);
|
||||
job.setDispatcher(_asyncDispatcher.getName());
|
||||
long jobId = _asyncMgr.submitAsyncJob(job);
|
||||
jobIds.add(jobId);
|
||||
|
|
|
|||
|
|
@ -264,7 +264,7 @@ public class SnapshotSchedulerImpl extends ManagerBase implements SnapshotSchedu
|
|||
|
||||
AsyncJobVO job = new AsyncJobVO("", User.UID_SYSTEM, volume.getAccountId(), CreateSnapshotCmd.class.getName(),
|
||||
ApiGsonHelper.getBuilder().create().toJson(params), cmd.getEntityId(),
|
||||
cmd.getInstanceType() != null ? cmd.getInstanceType().toString() : null);
|
||||
cmd.getInstanceType() != null ? cmd.getInstanceType().toString() : null, null);
|
||||
job.setDispatcher(_asyncDispatcher.getName());
|
||||
|
||||
final long jobId = _asyncMgr.submitAsyncJob(job);
|
||||
|
|
|
|||
Loading…
Reference in New Issue