@Override public void execute() { boolean result = _configService.deleteDiskOffering(this); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete disk offering"); } } }
@Override public void execute() { boolean result = _configService.deleteServiceOffering(this); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete service offering"); } } }
@Override @ActionEvent(eventType = EventTypes.EVENT_DISK_OFFERING_CREATE, eventDescription = "creating disk offering") public DiskOffering createDiskOffering(final CreateDiskOfferingCmd cmd) { final String name = cmd.getOfferingName(); final String description = cmd.getDisplayText(); final String provisioningType = cmd.getProvisioningType(); final Long numGibibytes = cmd.getDiskSize(); final boolean isDisplayOfferingEnabled = cmd.getDisplayOffering() != null ? cmd.getDisplayOffering() : true; final boolean isCustomized = cmd.isCustomized() != null ? cmd.isCustomized() : false; // false final String tags = cmd.getTags(); final Long domainId = cmd.getDomainId(); final String storageType = cmd.getStorageType(); if (storageType != null) { if (storageType.equalsIgnoreCase(ServiceOffering.StorageType.local.toString())) { final Boolean isCustomizedIops = cmd.isCustomizedIops(); final Long minIops = cmd.getMinIops(); final Long maxIops = cmd.getMaxIops(); final Long bytesReadRate = cmd.getBytesReadRate(); final Long bytesWriteRate = cmd.getBytesWriteRate(); final Long iopsReadRate = cmd.getIopsReadRate(); final Long iopsWriteRate = cmd.getIopsWriteRate(); final Integer hypervisorSnapshotReserve = cmd.getHypervisorSnapshotReserve();
final String name = cmd.getServiceOfferingName(); if (name == null || name.length() == 0) { throw new InvalidParameterValueException("Failed to create service offering: specify the name that has non-zero length"); final String displayText = cmd.getDisplayText(); if (displayText == null || displayText.length() == 0) { throw new InvalidParameterValueException("Failed to create service offering " + name + ": specify the display text that has non-zero length"); final Integer cpuNumber = cmd.getCpuNumber(); final Integer cpuSpeed = cmd.getCpuSpeed(); final Integer memory = cmd.getMemory(); if (cmd.getDomainId() != null && _domainDao.findById(cmd.getDomainId()) == null) { throw new InvalidParameterValueException("Please specify a valid domain id"); final Boolean offerHA = cmd.isOfferHa(); final String storageType = cmd.getStorageType(); if (storageType != null) { if (storageType.equalsIgnoreCase(ServiceOffering.StorageType.local.toString())) { final Boolean limitCpuUse = cmd.isLimitCpuUse(); final Boolean volatileVm = cmd.isVolatileVm(); final String vmTypeString = cmd.getSystemVmType(); VirtualMachine.Type vmType = null; boolean allowNetworkRate = false; if (cmd.isSystem()) {
@Override @ActionEvent(eventType = EventTypes.EVENT_DISK_OFFERING_EDIT, eventDescription = "updating disk offering") public DiskOffering updateDiskOffering(final UpdateDiskOfferingCmd cmd) { final Long diskOfferingId = cmd.getId(); final String name = cmd.getDiskOfferingName(); final String displayText = cmd.getDisplayText(); final Integer sortKey = cmd.getSortKey(); final Boolean displayDiskOffering = cmd.getDisplayOffering();
@Override @ActionEvent(eventType = EventTypes.EVENT_SERVICE_OFFERING_EDIT, eventDescription = "updating service offering") public ServiceOffering updateServiceOffering(final UpdateServiceOfferingCmd cmd) { final String displayText = cmd.getDisplayText(); final Long id = cmd.getId(); final String name = cmd.getServiceOfferingName(); final Integer sortKey = cmd.getSortKey(); Long userId = CallContext.current().getCallingUserId();
@Override public void execute() { DiskOffering offering = _configService.createDiskOffering(this); if (offering != null) { DiskOfferingResponse response = _responseGenerator.createDiskOfferingResponse(offering); response.setResponseName(getCommandName()); this.setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create disk offering"); } } }
@Override public void execute() { ServiceOffering result = _configService.createServiceOffering(this); if (result != null) { ServiceOfferingResponse response = _responseGenerator.createServiceOfferingResponse(result); response.setResponseName(getCommandName()); this.setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create service offering"); } } }
@Override public void execute() { DiskOffering result = _configService.updateDiskOffering(this); if (result != null) { DiskOfferingResponse response = _responseGenerator.createDiskOfferingResponse(result); response.setResponseName(getCommandName()); this.setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update disk offering"); } } }
@Override public void execute() { //Note //Once an offering is created, we cannot update the domainId field (keeping consistent with zones logic) ServiceOffering result = _configService.updateServiceOffering(this); if (result != null) { ServiceOfferingResponse response = _responseGenerator.createServiceOfferingResponse(result); response.setResponseName(getCommandName()); this.setResponseObject(response); } else { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update service offering"); } } }
@Override @ActionEvent(eventType = EventTypes.EVENT_DISK_OFFERING_DELETE, eventDescription = "deleting disk offering") public boolean deleteDiskOffering(final DeleteDiskOfferingCmd cmd) { final Long diskOfferingId = cmd.getId();
public boolean deleteServiceOffering(final DeleteServiceOfferingCmd cmd) { final Long offeringId = cmd.getId(); Long userId = CallContext.current().getCallingUserId();