|
168 | 168 | import com.cloud.utils.db.EntityManager; |
169 | 169 | import com.cloud.utils.db.SearchCriteria; |
170 | 170 | import com.cloud.utils.db.TransactionLegacy; |
| 171 | +import com.cloud.utils.db.UUIDManager; |
171 | 172 | import com.cloud.utils.exception.CloudRuntimeException; |
172 | 173 | import com.cloud.utils.exception.ExceptionProxyObject; |
173 | 174 |
|
@@ -195,7 +196,8 @@ public class ApiServer extends ManagerBase implements HttpRequestHandler, ApiSer |
195 | 196 | private DomainManager _domainMgr; |
196 | 197 | @Inject |
197 | 198 | private DomainDao _domainDao; |
198 | | - |
| 199 | + @Inject |
| 200 | + private UUIDManager _uuidMgr; |
199 | 201 | @Inject |
200 | 202 | private AsyncJobManager _asyncMgr; |
201 | 203 | @Inject |
@@ -659,10 +661,15 @@ private String queueCommand(final BaseCmd cmdObj, final Map<String, String> para |
659 | 661 | params.put("ctxDetails", ApiGsonHelper.getBuilder().create().toJson(ctx.getContextParameters())); |
660 | 662 |
|
661 | 663 | Long instanceId = (objectId == null) ? asyncCmd.getInstanceId() : objectId; |
| 664 | + |
| 665 | + // users can provide the job id they want to use, so log as it is a uuid and is unique |
| 666 | + String injectedJobId = asyncCmd.getInjectedJobId(); |
| 667 | + _uuidMgr.checkUuidSimple(injectedJobId, AsyncJob.class); |
| 668 | + |
662 | 669 | AsyncJobVO job = new AsyncJobVO("", callerUserId, caller.getId(), cmdObj.getClass().getName(), |
663 | 670 | ApiGsonHelper.getBuilder().create().toJson(params), instanceId, |
664 | 671 | asyncCmd.getInstanceType() != null ? asyncCmd.getInstanceType().toString() : null, |
665 | | - asyncCmd.getInjectedJobId()); |
| 672 | + injectedJobId); |
666 | 673 | job.setDispatcher(_asyncDispatcher.getName()); |
667 | 674 |
|
668 | 675 | final long jobId = _asyncMgr.submitAsyncJob(job); |
|
0 commit comments