Skip to content

Commit eaab991

Browse files
committed
Merge branch '4.18' into 4.19
2 parents 3d8d487 + 7a9bb83 commit eaab991

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

server/src/main/java/com/cloud/template/HypervisorTemplateAdapter.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,14 @@
3535
import org.apache.cloudstack.agent.directdownload.CheckUrlCommand;
3636
import org.apache.cloudstack.annotation.AnnotationService;
3737
import org.apache.cloudstack.annotation.dao.AnnotationDao;
38+
import org.apache.cloudstack.api.ApiCommandResourceType;
3839
import org.apache.cloudstack.api.command.user.iso.DeleteIsoCmd;
3940
import org.apache.cloudstack.api.command.user.iso.GetUploadParamsForIsoCmd;
4041
import org.apache.cloudstack.api.command.user.iso.RegisterIsoCmd;
4142
import org.apache.cloudstack.api.command.user.template.DeleteTemplateCmd;
4243
import org.apache.cloudstack.api.command.user.template.GetUploadParamsForTemplateCmd;
4344
import org.apache.cloudstack.api.command.user.template.RegisterTemplateCmd;
45+
import org.apache.cloudstack.context.CallContext;
4446
import org.apache.cloudstack.direct.download.DirectDownloadManager;
4547
import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
4648
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
@@ -421,6 +423,16 @@ public List<TemplateOrVolumePostUploadCommand> doInTransaction(TransactionStatus
421423
if (zoneIdList.size() > 1)
422424
throw new CloudRuntimeException("Operation is not supported for more than one zone id at a time.");
423425

426+
// Set Event Details for Template/ISO Upload
427+
String eventType = template.getFormat().equals(ImageFormat.ISO) ? "Iso" : "Template";
428+
String eventResourceId = template.getUuid();
429+
CallContext.current().setEventDetails(String.format("%s Id: %s", eventType, eventResourceId));
430+
CallContext.current().putContextParameter(eventType.equals("Iso") ? eventType : VirtualMachineTemplate.class, eventResourceId);
431+
if (template.getFormat().equals(ImageFormat.ISO)) {
432+
CallContext.current().setEventResourceType(ApiCommandResourceType.Iso);
433+
CallContext.current().setEventResourceId(template.getId());
434+
}
435+
424436
Long zoneId = zoneIdList.get(0);
425437
DataStore imageStore = verifyHeuristicRulesForZone(template, zoneId);
426438
List<TemplateOrVolumePostUploadCommand> payloads = new LinkedList<>();

0 commit comments

Comments
 (0)