@Override public void execute() throws ResourceAllocationException { CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId())); ServiceOffering serviceOffering = _entityMgr.findById(ServiceOffering.class, serviceOfferingId); if (serviceOffering == null) { throw new InvalidParameterValueException("Unable to find service offering: " + serviceOfferingId); } UserVm result = _userVmService.upgradeVirtualMachine(this); if (result != null){ UserVmResponse response = _responseGenerator.createUserVmResponse(ResponseView.Restricted, "virtualmachine", result).get(0); response.setResponseName(getCommandName()); setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to upgrade vm"); } } }
Long vmId = cmd.getId(); Long svcOffId = cmd.getServiceOfferingId(); Account caller = CallContext.current().getCallingAccount(); Map<String, String> customParameters = cmd.getDetails(); ServiceOfferingVO newServiceOffering = _offeringDao.findById(svcOffId); if (newServiceOffering.isDynamic()) { newServiceOffering.setDynamicFlag(true); validateCustomParameters(newServiceOffering, cmd.getDetails()); newServiceOffering = _offeringDao.getcomputeOffering(newServiceOffering, customParameters);
@Override public long getEntityOwnerId() { UserVm userVm = _entityMgr.findById(UserVm.class, getId()); if (userVm != null) { return userVm.getAccountId(); } return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked }