mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
hybrid
This commit is contained in:
parent
b8c8aacca3
commit
211b4c5da2
@ -52,7 +52,10 @@ public class ServiceOfferingVO extends DiskOfferingVO implements ServiceOffering
|
||||
private int multicastRateMbps;
|
||||
|
||||
@Column(name="ha_enabled")
|
||||
private boolean offerHA;
|
||||
private boolean offerHA;
|
||||
|
||||
@Column(name="hypervisor_type")
|
||||
private String hypervisorType;
|
||||
|
||||
@Column(name="guest_ip_type")
|
||||
@Enumerated(EnumType.STRING)
|
||||
@ -62,7 +65,7 @@ public class ServiceOfferingVO extends DiskOfferingVO implements ServiceOffering
|
||||
super();
|
||||
}
|
||||
|
||||
public ServiceOfferingVO(String name, int cpu, int ramSize, int speed, int rateMbps, int multicastRateMbps, boolean offerHA, String displayText, NetworkOffering.GuestIpType guestIpType, boolean useLocalStorage, boolean recreatable, String tags) {
|
||||
public ServiceOfferingVO(String name, int cpu, int ramSize, int speed, int rateMbps, int multicastRateMbps, boolean offerHA, String displayText, NetworkOffering.GuestIpType guestIpType, boolean useLocalStorage, boolean recreatable, String tags, String hyperVirsoType) {
|
||||
super(name, displayText, false, tags, recreatable, useLocalStorage);
|
||||
this.cpu = cpu;
|
||||
this.ramSize = ramSize;
|
||||
@ -70,7 +73,8 @@ public class ServiceOfferingVO extends DiskOfferingVO implements ServiceOffering
|
||||
this.rateMbps = rateMbps;
|
||||
this.multicastRateMbps = multicastRateMbps;
|
||||
this.offerHA = offerHA;
|
||||
this.guestIpType = guestIpType;
|
||||
this.guestIpType = guestIpType;
|
||||
this.hypervisorType = hyperVirsoType;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -142,5 +146,9 @@ public class ServiceOfferingVO extends DiskOfferingVO implements ServiceOffering
|
||||
|
||||
public NetworkOffering.GuestIpType getGuestIpType() {
|
||||
return guestIpType;
|
||||
}
|
||||
|
||||
public String gethypervisorType() {
|
||||
return hypervisorType;
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,6 +25,7 @@ import com.cloud.dc.VlanVO;
|
||||
import com.cloud.dc.Vlan.VlanType;
|
||||
import com.cloud.exception.InternalErrorException;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.hypervisor.Hypervisor;
|
||||
import com.cloud.service.ServiceOfferingVO;
|
||||
import com.cloud.storage.DiskOfferingVO;
|
||||
import com.cloud.utils.component.Manager;
|
||||
@ -56,7 +57,7 @@ public interface ConfigurationManager extends Manager {
|
||||
* @param useVirtualNetwork
|
||||
* @return ID
|
||||
*/
|
||||
ServiceOfferingVO createServiceOffering(long userId, String name, int cpu, int ramSize, int speed, String displayText, boolean localStorageRequired, boolean offerHA, boolean useVirtualNetwork, String tags);
|
||||
ServiceOfferingVO createServiceOffering(long userId, String name, int cpu, int ramSize, int speed, String displayText, boolean localStorageRequired, boolean offerHA, boolean useVirtualNetwork, String tags, Hypervisor.Type hyperVisor);
|
||||
|
||||
/**
|
||||
* Updates a service offering
|
||||
|
||||
@ -50,6 +50,7 @@ import com.cloud.event.EventVO;
|
||||
import com.cloud.event.dao.EventDao;
|
||||
import com.cloud.exception.InternalErrorException;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.hypervisor.Hypervisor;
|
||||
import com.cloud.network.dao.IPAddressDao;
|
||||
import com.cloud.offering.NetworkOffering;
|
||||
import com.cloud.service.ServiceOfferingVO;
|
||||
@ -831,15 +832,14 @@ public class ConfigurationManagerImpl implements ConfigurationManager {
|
||||
return zone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServiceOfferingVO createServiceOffering(long userId, String name, int cpu, int ramSize, int speed, String displayText, boolean localStorageRequired, boolean offerHA, boolean useVirtualNetwork, String tags) {
|
||||
public ServiceOfferingVO createServiceOffering(long userId, String name, int cpu, int ramSize, int speed, String displayText, boolean localStorageRequired, boolean offerHA, boolean useVirtualNetwork, String tags, Hypervisor.Type hyperVisor) {
|
||||
String networkRateStr = _configDao.getValue("network.throttling.rate");
|
||||
String multicastRateStr = _configDao.getValue("multicast.throttling.rate");
|
||||
int networkRate = ((networkRateStr == null) ? 200 : Integer.parseInt(networkRateStr));
|
||||
int multicastRate = ((multicastRateStr == null) ? 10 : Integer.parseInt(multicastRateStr));
|
||||
NetworkOffering.GuestIpType guestIpType = useVirtualNetwork ? NetworkOffering.GuestIpType.Virtualized : NetworkOffering.GuestIpType.DirectSingle;
|
||||
tags = cleanupTags(tags);
|
||||
ServiceOfferingVO offering = new ServiceOfferingVO(name, cpu, ramSize, speed, networkRate, multicastRate, offerHA, displayText, guestIpType, localStorageRequired, false, tags);
|
||||
ServiceOfferingVO offering = new ServiceOfferingVO(name, cpu, ramSize, speed, networkRate, multicastRate, offerHA, displayText, guestIpType, localStorageRequired, false, tags, hyperVisor.toString());
|
||||
|
||||
if ((offering = _serviceOfferingDao.persist(offering)) != null) {
|
||||
saveConfigurationEvent(userId, null, EventTypes.EVENT_SERVICE_OFFERING_CREATE, "Successfully created new service offering with name: " + name + ".", "soId=" + offering.getId(), "name=" + name, "numCPUs=" + cpu, "ram=" + ramSize, "cpuSpeed=" + speed,
|
||||
|
||||
@ -48,6 +48,7 @@ import com.cloud.dc.DataCenterVO;
|
||||
import com.cloud.domain.DomainVO;
|
||||
import com.cloud.exception.InternalErrorException;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.hypervisor.Hypervisor;
|
||||
import com.cloud.storage.SnapshotPolicyVO;
|
||||
import com.cloud.storage.dao.SnapshotPolicyDao;
|
||||
import com.cloud.user.User;
|
||||
@ -136,11 +137,25 @@ public class ConfigurationServerImpl implements ConfigurationServer {
|
||||
}
|
||||
|
||||
// Save Direct Networking service offerings
|
||||
_configMgr.createServiceOffering(User.UID_SYSTEM, "Small Instance, Direct Networking", 1, 512, 500, "Small Instance, Direct Networking, $0.05 per hour", false, false, false, null);
|
||||
_configMgr.createServiceOffering(User.UID_SYSTEM, "Medium Instance, Direct Networking", 1, 1024, 1000, "Medium Instance, Direct Networking, $0.10 per hour", false, false, false, null);
|
||||
_configMgr.createServiceOffering(User.UID_SYSTEM, "Small Instance, Direct Networking", 1, 512, 500, "Small Instance, Direct Networking, $0.05 per hour", false, false, false, null, Hypervisor.Type.KVM);
|
||||
_configMgr.createServiceOffering(User.UID_SYSTEM, "Medium Instance, Direct Networking", 1, 1024, 1000, "Medium Instance, Direct Networking, $0.10 per hour", false, false, false, null,Hypervisor.Type.KVM);
|
||||
// Save Virtual Networking service offerings
|
||||
_configMgr.createServiceOffering(User.UID_SYSTEM, "Small Instance, Virtual Networking", 1, 512, 500, "Small Instance, Virtual Networking, $0.05 per hour", false, false, true, null);
|
||||
_configMgr.createServiceOffering(User.UID_SYSTEM, "Medium Instance, Virtual Networking", 1, 1024, 1000, "Medium Instance, Virtual Networking, $0.10 per hour", false, false, true, null);
|
||||
_configMgr.createServiceOffering(User.UID_SYSTEM, "Small Instance, Virtual Networking", 1, 512, 500, "Small Instance, Virtual Networking, $0.05 per hour", false, false, true, null, Hypervisor.Type.KVM);
|
||||
_configMgr.createServiceOffering(User.UID_SYSTEM, "Medium Instance, Virtual Networking", 1, 1024, 1000, "Medium Instance, Virtual Networking, $0.10 per hour", false, false, true, null, Hypervisor.Type.KVM);
|
||||
|
||||
// Save Direct Networking service offerings
|
||||
_configMgr.createServiceOffering(User.UID_SYSTEM, "Small Instance, Direct Networking", 1, 512, 500, "Small Instance, Direct Networking, $0.05 per hour", false, false, false, null, Hypervisor.Type.XenServer);
|
||||
_configMgr.createServiceOffering(User.UID_SYSTEM, "Medium Instance, Direct Networking", 1, 1024, 1000, "Medium Instance, Direct Networking, $0.10 per hour", false, false, false, null,Hypervisor.Type.XenServer);
|
||||
// Save Virtual Networking service offerings
|
||||
_configMgr.createServiceOffering(User.UID_SYSTEM, "Small Instance, Virtual Networking", 1, 512, 500, "Small Instance, Virtual Networking, $0.05 per hour", false, false, true, null, Hypervisor.Type.XenServer);
|
||||
_configMgr.createServiceOffering(User.UID_SYSTEM, "Medium Instance, Virtual Networking", 1, 1024, 1000, "Medium Instance, Virtual Networking, $0.10 per hour", false, false, true, null, Hypervisor.Type.XenServer);
|
||||
|
||||
// Save Direct Networking service offerings
|
||||
_configMgr.createServiceOffering(User.UID_SYSTEM, "Small Instance, Direct Networking", 1, 512, 500, "Small Instance, Direct Networking, $0.05 per hour", false, false, false, null, Hypervisor.Type.VMware);
|
||||
_configMgr.createServiceOffering(User.UID_SYSTEM, "Medium Instance, Direct Networking", 1, 1024, 1000, "Medium Instance, Direct Networking, $0.10 per hour", false, false, false, null, Hypervisor.Type.VMware);
|
||||
// Save Virtual Networking service offerings
|
||||
_configMgr.createServiceOffering(User.UID_SYSTEM, "Small Instance, Virtual Networking", 1, 512, 500, "Small Instance, Virtual Networking, $0.05 per hour", false, false, true, null, Hypervisor.Type.VMware);
|
||||
_configMgr.createServiceOffering(User.UID_SYSTEM, "Medium Instance, Virtual Networking", 1, 1024, 1000, "Medium Instance, Virtual Networking, $0.10 per hour", false, false, true, null, Hypervisor.Type.VMware);
|
||||
// Save default disk offerings
|
||||
_configMgr.createDiskOffering(User.UID_SYSTEM, DomainVO.ROOT_DOMAIN, "Small", "Small Disk, 5 GB", 5, null);
|
||||
_configMgr.createDiskOffering(User.UID_SYSTEM, DomainVO.ROOT_DOMAIN, "Medium", "Medium Disk, 20 GB", 20, null);
|
||||
|
||||
@ -870,6 +870,7 @@ CREATE TABLE `cloud`.`service_offering` (
|
||||
`mc_rate` smallint unsigned default 10 COMMENT 'mcast rate throttle mbits/s',
|
||||
`ha_enabled` tinyint(1) unsigned NOT NULL DEFAULT 0 COMMENT 'Enable HA',
|
||||
`guest_ip_type` varchar(255) NOT NULL DEFAULT 'Virtualized' COMMENT 'Type of guest network -- direct or virtualized',
|
||||
`hypervisor_type` varchar(255) NOT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user