rohityadavcloud commented on code in PR #8484:
URL: https://github.com/apache/cloudstack/pull/8484#discussion_r1481325240
##########
server/src/main/java/com/cloud/vm/UserVmManagerImpl.java:
##########
@@ -4547,6 +4550,43 @@ private UserVmVO commitUserVm(final boolean isImport,
final DataCenter zone, fin
DiskOfferingVO rootDiskOfferingVO =
_diskOfferingDao.findById(rootDiskOfferingId);
rootDiskTags.add(rootDiskOfferingVO.getTags());
+ orchestrateVirtualMachineCreate(vm, guestOSCategory, computeTags,
rootDiskTags, plan, rootDiskSize, template, hostName, displayName, owner,
+ diskOfferingId, diskSize, offering, isIso,networkNicMap,
hypervisorType, extraDhcpOptionMap, dataDiskTemplateToDiskOfferingMap,
+ rootDiskOfferingId);
+
+ }
+ CallContext.current().setEventDetails("Vm Id: " + vm.getUuid());
+
+ if (!isImport) {
+ if (!offering.isDynamic()) {
+ UsageEventUtils.publishUsageEvent(EventTypes.EVENT_VM_CREATE,
accountId, zone.getId(), vm.getId(), vm.getHostName(), offering.getId(),
template.getId(),
+ hypervisorType.toString(),
VirtualMachine.class.getName(), vm.getUuid(), vm.isDisplayVm());
+ } else {
+ UsageEventUtils.publishUsageEvent(EventTypes.EVENT_VM_CREATE,
accountId, zone.getId(), vm.getId(), vm.getHostName(), offering.getId(),
template.getId(),
+ hypervisorType.toString(),
VirtualMachine.class.getName(), vm.getUuid(), customParameters,
vm.isDisplayVm());
+ }
+
+ try {
+ //Update Resource Count for the given account
+ resourceCountIncrement(accountId, isDisplayVm, new
Long(offering.getCpu()), new Long(offering.getRamSize()));
+ } catch (CloudRuntimeException cre) {
+ ArrayList<ExceptionProxyObject> epoList =
cre.getIdProxyList();
+ if (epoList == null || !epoList.stream().anyMatch( e ->
e.getUuid().equals(vm.getUuid()))) {
+ cre.addProxyObject(vm.getUuid(), "vmId");
+ }
+ throw cre;
+ }
+ }
+ return vm;
+ }
+
+ private void OrchestrateVirtualMachineCreate(UserVmVO vm,
GuestOSCategoryVO guestOSCategory, List<String> computeTags, List<String>
rootDiskTags, DataCenterDeployment plan, Long rootDiskSize,
VirtualMachineTemplate template, String hostName, String displayName, Account
owner,
Review Comment:
```suggestion
private void orchestrateVirtualMachineCreate(UserVmVO vm,
GuestOSCategoryVO guestOSCategory, List<String> computeTags, List<String>
rootDiskTags, DataCenterDeployment plan, Long rootDiskSize,
VirtualMachineTemplate template, String hostName, String displayName, Account
owner,
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]