@Override public void checkUuid() { if (getCustomId() != null) { _uuidMgr.checkUuid(getCustomId(), UserVm.class); } } }
validateInputsAndPermissionForUpdateVirtualMachineCommand(cmd); String displayName = cmd.getDisplayName(); String group = cmd.getGroup(); Boolean ha = cmd.getHaEnable(); Boolean isDisplayVm = cmd.getDisplayVm(); Long id = cmd.getId(); Long osTypeId = cmd.getOsTypeId(); String userData = cmd.getUserData(); Boolean isDynamicallyScalable = cmd.isDynamicallyScalable(); String hostName = cmd.getHostName(); Map<String,String> details = cmd.getDetails(); List<Long> securityGroupIdList = getSecurityGroupIdList(cmd); boolean cleanupDetails = cmd.isCleanupDetails(); String extraConfig = cmd.getExtraConfig(); UserVmVO vmInstance = _vmDao.findById(cmd.getId()); long accountId = vmInstance.getAccountId(); cmd.getHttpMethod(), cmd.getCustomId(), hostName, cmd.getInstanceName(), securityGroupIdList, cmd.getDhcpOptionsMap());
@Override public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException { CallContext.current().setEventDetails("Vm Id: " + this._uuidMgr.getUuid(VirtualMachine.class, getId())); UserVm result = _userVmService.updateVirtualMachine(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 update vm"); } }
@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 }
protected void validateInputsAndPermissionForUpdateVirtualMachineCommand(UpdateVMCmd cmd) { UserVmVO vmInstance = _vmDao.findById(cmd.getId()); if (vmInstance == null) { throw new InvalidParameterValueException("unable to find virtual machine with id: " + cmd.getId()); } validateGuestOsIdForUpdateVirtualMachineCommand(cmd); Account caller = CallContext.current().getCallingAccount(); _accountMgr.checkAccess(caller, null, true, vmInstance); }