public ServiceOfferingVO createServiceOffering(long userId, boolean isSystem, VirtualMachine.Type vm_type,
String name, int cpu, int ramSize, int speed, String displayText, boolean localStorageRequired,
boolean offerHA, boolean limitResourceUse, boolean volatileVm, String tags, Long domainId, String hostTag,
Integer networkRate, String deploymentPlanner, Map<String, String> details, Long bytesReadRate, Long bytesWriteRate, Long iopsReadRate, Long iopsWriteRate) {
tags = cleanupTags(tags);
ServiceOfferingVO offering = new ServiceOfferingVO(name, cpu, ramSize, speed, networkRate, null, offerHA,
limitResourceUse, volatileVm, displayText, localStorageRequired, false, tags, isSystem, vm_type,
domainId, hostTag, deploymentPlanner);
if ((bytesReadRate != null) && (bytesReadRate > 0)) {
offering.setBytesReadRate(bytesReadRate);
}
if ((bytesWriteRate != null) && (bytesWriteRate > 0)) {
offering.setBytesWriteRate(bytesWriteRate);
}
if ((iopsReadRate != null) && (iopsReadRate > 0)) {
offering.setIopsReadRate(iopsReadRate);
}
if ((iopsWriteRate != null) && (iopsWriteRate > 0)) {
offering.setIopsWriteRate(iopsWriteRate);
}
if ((offering = _serviceOfferingDao.persist(offering)) != null) {
if (details != null) {
_serviceOfferingDetailsDao.persist(offering.getId(), details);
}
UserContext.current().setEventDetails("Service offering id=" + offering.getId());
return offering;
} else {
return null;
}
}