use of org.apache.cloudstack.api.command.admin.vm.DeployVMCmdByAdmin in project cloudstack by apache.
the class UserVmManagerImpl method startVirtualMachine.
@Override
@ActionEvent(eventType = EventTypes.EVENT_VM_CREATE, eventDescription = "starting Vm", async = true)
public UserVm startVirtualMachine(DeployVMCmd cmd) throws ResourceUnavailableException, InsufficientCapacityException, ConcurrentOperationException, ResourceAllocationException {
long vmId = cmd.getEntityId();
Long podId = null;
Long clusterId = null;
Long hostId = cmd.getHostId();
Map<VirtualMachineProfile.Param, Object> additionalParams = new HashMap<>();
Map<Long, DiskOffering> diskOfferingMap = cmd.getDataDiskTemplateToDiskOfferingMap();
Map<String, String> details = cmd.getDetails();
if (cmd instanceof DeployVMCmdByAdmin) {
DeployVMCmdByAdmin adminCmd = (DeployVMCmdByAdmin) cmd;
podId = adminCmd.getPodId();
clusterId = adminCmd.getClusterId();
}
UserVmDetailVO uefiDetail = userVmDetailsDao.findDetail(cmd.getEntityId(), ApiConstants.BootType.UEFI.toString());
if (uefiDetail != null) {
addVmUefiBootOptionsToParams(additionalParams, uefiDetail.getName(), uefiDetail.getValue());
}
if (cmd.getBootIntoSetup() != null) {
additionalParams.put(VirtualMachineProfile.Param.BootIntoSetup, cmd.getBootIntoSetup());
}
return startVirtualMachine(vmId, podId, clusterId, hostId, diskOfferingMap, additionalParams, cmd.getDeploymentPlanner());
}
Aggregations