bug 10305: for a systemvm only applicable system vm offering should be displayed

status 10305: resolved fixed
While creating a system vm offering specify the type. If no type specified the default to domainrouter.
While requesting a set of system offering specify the paramter systemvmtype.
This commit is contained in:
Abhinandan Prateek 2011-06-20 20:01:40 +05:30 committed by root
parent 87573cad52
commit 79e38f0a1f
21 changed files with 111 additions and 44 deletions

View File

@ -25,6 +25,7 @@ import com.cloud.api.BaseCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.BaseCmd.CommandType;
import com.cloud.api.response.ServiceOfferingResponse;
import com.cloud.offering.ServiceOffering;
import com.cloud.user.Account;
@ -74,6 +75,8 @@ public class CreateServiceOfferingCmd extends BaseCmd {
@Parameter(name=ApiConstants.IS_SYSTEM_OFFERING, type=CommandType.BOOLEAN, description="is this a system vm offering")
private Boolean isSystem;
@Parameter(name=ApiConstants.SYSTEM_VM_TYPE, type=CommandType.STRING, description="the system VM type. Possible types are \"consoleproxy\" and \"secondarystoragevm\".")
private String systemVmType;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
@ -127,6 +130,10 @@ public class CreateServiceOfferingCmd extends BaseCmd {
return isSystem == null ? false : isSystem;
}
public String getSystemVmType() {
return systemVmType;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////

View File

@ -26,6 +26,7 @@ import com.cloud.api.ApiConstants;
import com.cloud.api.BaseListCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.BaseCmd.CommandType;
import com.cloud.api.response.ListResponse;
import com.cloud.api.response.ServiceOfferingResponse;
import com.cloud.offering.ServiceOffering;
@ -52,10 +53,12 @@ public class ListServiceOfferingsCmd extends BaseListCmd {
@Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.LONG, description="the ID of the domain associated with the service offering")
private Long domainId;
@Parameter(name=ApiConstants.IS_SYSTEM_OFFERING, type=CommandType.BOOLEAN, description="is this a system vm offering")
private Boolean isSystem;
@Parameter(name=ApiConstants.SYSTEM_VM_TYPE, type=CommandType.STRING, description="the system VM type. Possible types are \"consoleproxy\", \"secondarystoragevm\" or \"domainrouter\".")
private String systemVmType;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
@ -81,6 +84,10 @@ public class ListServiceOfferingsCmd extends BaseListCmd {
return isSystem == null ? false : isSystem;
}
public String getSystemVmType(){
return systemVmType;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////

View File

@ -72,6 +72,9 @@ public class ServiceOfferingResponse extends BaseResponse {
@SerializedName(ApiConstants.IS_DEFAULT_USE) @Param(description="is this a default system vm offering")
private Boolean defaultUse;
@SerializedName(ApiConstants.SYSTEM_VM_TYPE) @Param(description="is this a the systemvm type for system vm offering")
private String vm_type;
public Long getId() {
return id;
@ -107,6 +110,15 @@ public class ServiceOfferingResponse extends BaseResponse {
}
public String getSystemVmType() {
return vm_type;
}
public void setSystemVmType(String vmtype) {
this.vm_type = vmtype;
}
public String getDisplayText() {
return displayText;
}

View File

@ -91,4 +91,6 @@ public interface ServiceOffering {
String getHostTag();
boolean getDefaultUse();
String getSystemVmType();
}

View File

@ -261,14 +261,14 @@ public class UserConcentratedAllocator implements PodAllocator {
}
so = _offeringDao.findById(userVm.getServiceOfferingId());
} else if (vm.getType() == VirtualMachine.Type.ConsoleProxy) {
so = new ServiceOfferingVO("Fake Offering For DomP", 1, _proxyRamSize, 0, 0, 0, false, null, false, true, null, true, false);
so = new ServiceOfferingVO("Fake Offering For DomP", 1, _proxyRamSize, 0, 0, 0, false, null, false, true, null, true, VirtualMachine.Type.ConsoleProxy, false);
} else if (vm.getType() == VirtualMachine.Type.SecondaryStorageVm) {
so = new ServiceOfferingVO("Fake Offering For Secondary Storage VM", 1, _secStorageVmRamSize, 0, 0, 0, true, null, false, true, null, true, false);
so = new ServiceOfferingVO("Fake Offering For Secondary Storage VM", 1, _secStorageVmRamSize, 0, 0, 0, true, null, false, true, null, true, VirtualMachine.Type.SecondaryStorageVm, false);
} else if (vm.getType() == VirtualMachine.Type.DomainRouter) {
so = new ServiceOfferingVO("Fake Offering For DomR", 1, _routerRamSize, 0, 0, 0, true, null, false, true, null, true, false);
so = new ServiceOfferingVO("Fake Offering For DomR", 1, _routerRamSize, 0, 0, 0, true, null, false, true, null, true, VirtualMachine.Type.DomainRouter, false);
} else {
assert (false) : "Unsupported system vm type";
so = new ServiceOfferingVO("Fake Offering For unknow system VM", 1, 128, 0, 0, 0, false, null, false, true, null, true, false);
so = new ServiceOfferingVO("Fake Offering For unknow system VM", 1, 128, 0, 0, 0, false, null, false, true, null, true, null, false);
}
if (capacityType == CapacityVO.CAPACITY_TYPE_MEMORY) {

View File

@ -427,6 +427,7 @@ public class ApiResponseHelper implements ResponseGenerator {
offeringResponse.setName(offering.getName());
offeringResponse.setIsSystemOffering(offering.getSystemUse());
offeringResponse.setDefaultUse(offering.getDefaultUse());
offeringResponse.setSystemVmType(offering.getSystemVmType());
offeringResponse.setDisplayText(offering.getDisplayText());
offeringResponse.setCpuNumber(offering.getCpu());
offeringResponse.setCpuSpeed(offering.getSpeed());

View File

@ -40,6 +40,7 @@ import com.cloud.service.ServiceOfferingVO;
import com.cloud.storage.DiskOfferingVO;
import com.cloud.user.Account;
import com.cloud.utils.component.Manager;
import com.cloud.vm.VirtualMachine;
/**
* ConfigurationManager handles adding pods/zones, changing IP ranges, enabling external firewalls, and editing configuration values
@ -70,7 +71,7 @@ public interface ConfigurationManager extends ConfigurationService, Manager {
* @param hostTag
* @return ID
*/
ServiceOfferingVO createServiceOffering(long userId, boolean isSystem, String name, int cpu, int ramSize, int speed, String displayText, boolean localStorageRequired, boolean offerHA, boolean limitResourceUse, String tags, Long domainId, String hostTag);
ServiceOfferingVO createServiceOffering(long userId, boolean isSystem, VirtualMachine.Type vm_typeType, String name, int cpu, int ramSize, int speed, String displayText, boolean localStorageRequired, boolean offerHA, boolean limitResourceUse, String tags, Long domainId, String hostTag);
/**
* Creates a new disk offering

View File

@ -1496,17 +1496,33 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
if (limitCpuUse == null) {
limitCpuUse = false;
}
String vm_type_string = cmd.getSystemVmType();
VirtualMachine.Type vm_type = null;
if (cmd.getIsSystem() && vm_type_string == null){
vm_type = VirtualMachine.Type.DomainRouter;
}
else {
if (VirtualMachine.Type.ConsoleProxy.toString().toLowerCase().equals(vm_type_string)){
vm_type = VirtualMachine.Type.ConsoleProxy;
}
else if (VirtualMachine.Type.SecondaryStorageVm.toString().toLowerCase().equals(vm_type_string)){
vm_type = VirtualMachine.Type.SecondaryStorageVm;
}
else if (VirtualMachine.Type.DomainRouter.toString().toLowerCase().equals(vm_type_string)){
vm_type = VirtualMachine.Type.DomainRouter;
}
}
return createServiceOffering(userId, cmd.getIsSystem(), cmd.getServiceOfferingName(), cpuNumber.intValue(), memory.intValue(), cpuSpeed.intValue(), cmd.getDisplayText(), localStorageRequired, offerHA,
return createServiceOffering(userId, cmd.getIsSystem(), vm_type, cmd.getServiceOfferingName(), cpuNumber.intValue(), memory.intValue(), cpuSpeed.intValue(), cmd.getDisplayText(), localStorageRequired, offerHA,
limitCpuUse, cmd.getTags(), cmd.getDomainId(), cmd.getHostTag());
}
@Override
@ActionEvent(eventType = EventTypes.EVENT_SERVICE_OFFERING_CREATE, eventDescription = "creating service offering")
public ServiceOfferingVO createServiceOffering(long userId, boolean isSystem, String name, int cpu, int ramSize, int speed, String displayText, boolean localStorageRequired, boolean offerHA, boolean limitResourceUse, String tags,
Long domainId, String hostTag) {
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, String tags, Long domainId, String hostTag) {
tags = cleanupTags(tags);
ServiceOfferingVO offering = new ServiceOfferingVO(name, cpu, ramSize, speed, null, null, offerHA, limitResourceUse, displayText, localStorageRequired, false, tags, isSystem, domainId, hostTag);
ServiceOfferingVO offering = new ServiceOfferingVO(name, cpu, ramSize, speed, null, null, offerHA, limitResourceUse, displayText, localStorageRequired, false, tags, isSystem, vm_type, domainId, hostTag);
if ((offering = _serviceOfferingDao.persist(offering)) != null) {
UserContext.current().setEventDetails("Service offering id=" + offering.getId());

View File

@ -1245,7 +1245,7 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, ConsoleProx
_itMgr.registerGuru(VirtualMachine.Type.ConsoleProxy, this);
boolean useLocalStorage = Boolean.parseBoolean(configs.get(Config.SystemVMUseLocalStorage.key()));
_serviceOffering = new ServiceOfferingVO("System Offering For Console Proxy", 1, _proxyRamSize, _proxyCpuMHz, 0, 0, false, null, useLocalStorage, true, null, true, true);
_serviceOffering = new ServiceOfferingVO("System Offering For Console Proxy", 1, _proxyRamSize, _proxyCpuMHz, 0, 0, false, null, useLocalStorage, true, null, true, VirtualMachine.Type.ConsoleProxy, true);
_serviceOffering.setUniqueName("Cloud.com-ConsoleProxy");
_serviceOffering = _offeringDao.persistSystemServiceOffering(_serviceOffering);

View File

@ -171,4 +171,9 @@ public class ServiceOffering21VO extends DiskOffering21VO implements ServiceOffe
public boolean getDefaultUse() {
return false;
}
@Override
public String getSystemVmType() {
return null;
}
}

View File

@ -569,7 +569,7 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
_itMgr.registerGuru(VirtualMachine.Type.DomainRouter, this);
boolean useLocalStorage = Boolean.parseBoolean(configs.get(Config.SystemVMUseLocalStorage.key()));
_offering = new ServiceOfferingVO("System Offering For Software Router", 1, _routerRamSize, _routerCpuMHz, null, null, true, null, useLocalStorage, true, null, true, true);
_offering = new ServiceOfferingVO("System Offering For Software Router", 1, _routerRamSize, _routerCpuMHz, null, null, true, null, useLocalStorage, true, null, true, VirtualMachine.Type.DomainRouter, true);
_offering.setUniqueName("Cloud.Com-SoftwareRouter");
_offering = _serviceOfferingDao.persistSystemServiceOffering(_offering);

View File

@ -805,7 +805,7 @@ public class ConfigurationServerImpl implements ConfigurationServer {
private ServiceOfferingVO createServiceOffering(long userId, String name, int cpu, int ramSize, int speed, String displayText, boolean localStorageRequired, boolean offerHA, String tags) {
tags = cleanupTags(tags);
ServiceOfferingVO offering = new ServiceOfferingVO(name, cpu, ramSize, speed, null, null, offerHA, displayText, localStorageRequired, false, tags, false, false);
ServiceOfferingVO offering = new ServiceOfferingVO(name, cpu, ramSize, speed, null, null, offerHA, displayText, localStorageRequired, false, tags, false, null, false);
if ((offering = _serviceOfferingDao.persist(offering)) != null) {
return offering;

View File

@ -1007,6 +1007,7 @@ public class ManagementServerImpl implements ManagementServer {
Long vmId = cmd.getVirtualMachineId();
Long domainId = cmd.getDomainId();
Boolean issystem = cmd.getIsSystem();
String vm_type_str = cmd.getSystemVmType();
// Keeping this logic consistent with domain specific zones
// if a domainId is provided, we just return the so associated with this domain
@ -1015,7 +1016,7 @@ public class ManagementServerImpl implements ManagementServer {
if (account.getDomainId() != 1 && issystem){ //NON ROOT admin
throw new InvalidParameterValueException("Non ROOT admins cannot access system's offering");
}
return _offeringsDao.findServiceOfferingByDomainIdAndIsSystem(domainId, issystem);// no perm check
return _offeringsDao.findSystemOffering(domainId, issystem, vm_type_str);// no perm check
} else {
if (issystem){
throw new InvalidParameterValueException("Non root users cannot access system's offering");
@ -1023,7 +1024,7 @@ public class ManagementServerImpl implements ManagementServer {
// check if the user's domain == so's domain || user's domain is a child of so's domain
if (isPermissible(account.getDomainId(), domainId)) {
// perm check succeeded
return _offeringsDao.findServiceOfferingByDomainIdAndIsSystem(domainId, false);
return _offeringsDao.findSystemOffering(domainId, false, vm_type_str);
} else {
throw new PermissionDeniedException("The account:" + account.getAccountName() + " does not fall in the same domain hierarchy as the service offering");
}
@ -1067,7 +1068,6 @@ public class ManagementServerImpl implements ManagementServer {
// sc.addAnd("guestIpType", SearchCriteria.Op.EQ, offering.getGuestIpType());
sc.addAnd("useLocalStorage", SearchCriteria.Op.EQ, offering.getUseLocalStorage());
}
if (id != null) {
sc.addAnd("id", SearchCriteria.Op.EQ, id);
}
@ -1075,8 +1075,10 @@ public class ManagementServerImpl implements ManagementServer {
if (name != null) {
sc.addAnd("name", SearchCriteria.Op.LIKE, "%" + name + "%");
}
if (vm_type_str != null){
sc.addAnd("vm_type", SearchCriteria.Op.EQ, vm_type_str);
}
sc.addAnd("systemUse", SearchCriteria.Op.EQ, issystem);
return _offeringsDao.search(sc, searchFilter);
}

View File

@ -27,6 +27,7 @@ import javax.persistence.Transient;
import com.cloud.offering.ServiceOffering;
import com.cloud.storage.DiskOfferingVO;
import com.cloud.vm.VirtualMachine;
@Entity
@Table(name="service_offering")
@ -60,11 +61,14 @@ public class ServiceOfferingVO extends DiskOfferingVO implements ServiceOffering
@Column(name="default_use")
private boolean default_use;
@Column(name="vm_type")
private String vm_type;
protected ServiceOfferingVO() {
super();
}
public ServiceOfferingVO(String name, int cpu, int ramSize, int speed, Integer rateMbps, Integer multicastRateMbps, boolean offerHA, String displayText, boolean useLocalStorage, boolean recreatable, String tags, boolean systemUse, boolean defaultUse) {
public ServiceOfferingVO(String name, int cpu, int ramSize, int speed, Integer rateMbps, Integer multicastRateMbps, boolean offerHA, String displayText, boolean useLocalStorage, boolean recreatable, String tags, boolean systemUse, VirtualMachine.Type vm_type, boolean defaultUse) {
super(name, displayText, false, tags, recreatable, useLocalStorage, systemUse, true);
this.cpu = cpu;
this.ramSize = ramSize;
@ -74,9 +78,10 @@ public class ServiceOfferingVO extends DiskOfferingVO implements ServiceOffering
this.offerHA = offerHA;
this.limitCpuUse = false;
this.default_use = defaultUse;
this.vm_type = vm_type == null ? null : vm_type.toString().toLowerCase();
}
public ServiceOfferingVO(String name, int cpu, int ramSize, int speed, Integer rateMbps, Integer multicastRateMbps, boolean offerHA, boolean limitCpuUse, String displayText, boolean useLocalStorage, boolean recreatable, String tags, boolean systemUse, Long domainId) {
public ServiceOfferingVO(String name, int cpu, int ramSize, int speed, Integer rateMbps, Integer multicastRateMbps, boolean offerHA, boolean limitCpuUse, String displayText, boolean useLocalStorage, boolean recreatable, String tags, boolean systemUse, VirtualMachine.Type vm_type, Long domainId) {
super(name, displayText, false, tags, recreatable, useLocalStorage, systemUse, true, domainId);
this.cpu = cpu;
this.ramSize = ramSize;
@ -85,11 +90,11 @@ public class ServiceOfferingVO extends DiskOfferingVO implements ServiceOffering
this.multicastRateMbps = multicastRateMbps;
this.offerHA = offerHA;
this.limitCpuUse = limitCpuUse;
this.default_use = false;
this.vm_type = vm_type == null ? null : vm_type.toString().toLowerCase();
}
public ServiceOfferingVO(String name, int cpu, int ramSize, int speed, Integer rateMbps, Integer multicastRateMbps, boolean offerHA, boolean limitResourceUse, String displayText, boolean useLocalStorage, boolean recreatable, String tags, boolean systemUse, Long domainId, String hostTag) {
this(name, cpu, ramSize, speed, rateMbps, multicastRateMbps, offerHA, limitResourceUse, displayText, useLocalStorage, recreatable, tags, systemUse, domainId);
public ServiceOfferingVO(String name, int cpu, int ramSize, int speed, Integer rateMbps, Integer multicastRateMbps, boolean offerHA, boolean limitResourceUse, String displayText, boolean useLocalStorage, boolean recreatable, String tags, boolean systemUse, VirtualMachine.Type vm_type, Long domainId, String hostTag) {
this(name, cpu, ramSize, speed, rateMbps, multicastRateMbps, offerHA, limitResourceUse, displayText, useLocalStorage, recreatable, tags, systemUse, vm_type, domainId);
this.hostTag = hostTag;
}
@ -179,4 +184,9 @@ public class ServiceOfferingVO extends DiskOfferingVO implements ServiceOffering
public String getHostTag() {
return hostTag;
}
public String getSystemVmType(){
return vm_type;
}
}

View File

@ -31,5 +31,5 @@ public interface ServiceOfferingDao extends GenericDao<ServiceOfferingVO, Long>
ServiceOfferingVO persistSystemServiceOffering(ServiceOfferingVO vo);
List<ServiceOfferingVO> findPublicServiceOfferings();
List<ServiceOfferingVO> findServiceOfferingByDomainId(Long domainId);
List<ServiceOfferingVO> findServiceOfferingByDomainIdAndIsSystem(Long domainId, Boolean isSystem);
List<ServiceOfferingVO> findSystemOffering(Long domainId, Boolean isSystem, String vm_type);
}

View File

@ -37,7 +37,7 @@ public class ServiceOfferingDaoImpl extends GenericDaoBase<ServiceOfferingVO, Lo
protected final SearchBuilder<ServiceOfferingVO> UniqueNameSearch;
protected final SearchBuilder<ServiceOfferingVO> ServiceOfferingsByDomainIdSearch;
protected final SearchBuilder<ServiceOfferingVO> ServiceOfferingsByDomainIdAndUseSystemSearch;
protected final SearchBuilder<ServiceOfferingVO> SystemServiceOffering;
protected final SearchBuilder<ServiceOfferingVO> ServiceOfferingsByKeywordSearch;
protected final SearchBuilder<ServiceOfferingVO> PublicServiceOfferingSearch;
@ -53,10 +53,11 @@ public class ServiceOfferingDaoImpl extends GenericDaoBase<ServiceOfferingVO, Lo
ServiceOfferingsByDomainIdSearch.and("domainId", ServiceOfferingsByDomainIdSearch.entity().getDomainId(), SearchCriteria.Op.EQ);
ServiceOfferingsByDomainIdSearch.done();
ServiceOfferingsByDomainIdAndUseSystemSearch = createSearchBuilder();
ServiceOfferingsByDomainIdAndUseSystemSearch.and("domainId", ServiceOfferingsByDomainIdAndUseSystemSearch.entity().getDomainId(), SearchCriteria.Op.EQ);
ServiceOfferingsByDomainIdAndUseSystemSearch.and("system", ServiceOfferingsByDomainIdAndUseSystemSearch.entity().getSystemUse(), SearchCriteria.Op.EQ);
ServiceOfferingsByDomainIdAndUseSystemSearch.done();
SystemServiceOffering = createSearchBuilder();
SystemServiceOffering.and("domainId", SystemServiceOffering.entity().getDomainId(), SearchCriteria.Op.EQ);
SystemServiceOffering.and("system", SystemServiceOffering.entity().getSystemUse(), SearchCriteria.Op.EQ);
SystemServiceOffering.and("vm_type", SystemServiceOffering.entity().getSpeed(), SearchCriteria.Op.EQ);
SystemServiceOffering.done();
PublicServiceOfferingSearch = createSearchBuilder();
@ -112,10 +113,11 @@ public class ServiceOfferingDaoImpl extends GenericDaoBase<ServiceOfferingVO, Lo
@Override
public List<ServiceOfferingVO> findServiceOfferingByDomainIdAndIsSystem(Long domainId, Boolean isSystem){
SearchCriteria<ServiceOfferingVO> sc = ServiceOfferingsByDomainIdAndUseSystemSearch.create();
public List<ServiceOfferingVO> findSystemOffering(Long domainId, Boolean isSystem, String vm_type){
SearchCriteria<ServiceOfferingVO> sc = SystemServiceOffering.create();
sc.setParameters("domainId", domainId);
sc.setParameters("system", isSystem);
sc.setParameters("vm_type", vm_type);
return listBy(sc);
}

View File

@ -143,14 +143,14 @@ public class LocalStoragePoolAllocator extends FirstFitStoragePoolAllocator {
}
} else if (vm.getType() == VirtualMachine.Type.ConsoleProxy) {
so = new ServiceOfferingVO("Fake Offering For DomP", 1, _proxyRamSize, 0, 0, 0, false, null, false, true, null, true, false);
so = new ServiceOfferingVO("Fake Offering For DomP", 1, _proxyRamSize, 0, 0, 0, false, null, false, true, null, true, VirtualMachine.Type.ConsoleProxy, false);
} else if (vm.getType() == VirtualMachine.Type.SecondaryStorageVm) {
so = new ServiceOfferingVO("Fake Offering For Secondary Storage VM", 1, _secStorageVmRamSize, 0, 0, 0, true, null, false, true, null, true, false);
so = new ServiceOfferingVO("Fake Offering For Secondary Storage VM", 1, _secStorageVmRamSize, 0, 0, 0, true, null, false, true, null, true, VirtualMachine.Type.SecondaryStorageVm, false);
} else if (vm.getType() == VirtualMachine.Type.DomainRouter) {
so = new ServiceOfferingVO("Fake Offering For DomR", 1, _routerRamSize, 0, 0, 0, true, null, false, true, null, true, false);
so = new ServiceOfferingVO("Fake Offering For DomR", 1, _routerRamSize, 0, 0, 0, true, null, false, true, null, true, VirtualMachine.Type.DomainRouter, false);
} else {
assert (false) : "Unsupported system vm type";
so = new ServiceOfferingVO("Fake Offering For unknow system VM", 1, 128, 0, 0, 0, false, null, false, true, null, false, false);
so = new ServiceOfferingVO("Fake Offering For unknow system VM", 1, 128, 0, 0, 0, false, null, false, true, null, false, null, false);
}
long usedMemory = calcHostAllocatedCpuMemoryCapacity(vmOnHost, CapacityVO.CAPACITY_TYPE_MEMORY);
@ -247,14 +247,14 @@ public class LocalStoragePoolAllocator extends FirstFitStoragePoolAllocator {
}
so = _offeringDao.findById(userVm.getServiceOfferingId());
} else if (vm.getType() == VirtualMachine.Type.ConsoleProxy) {
so = new ServiceOfferingVO("Fake Offering For DomP", 1, _proxyRamSize, 0, 0, 0, false, null, false, true, null, true, false);
so = new ServiceOfferingVO("Fake Offering For DomP", 1, _proxyRamSize, 0, 0, 0, false, null, false, true, null, true, VirtualMachine.Type.ConsoleProxy, false);
} else if (vm.getType() == VirtualMachine.Type.SecondaryStorageVm) {
so = new ServiceOfferingVO("Fake Offering For Secondary Storage VM", 1, _secStorageVmRamSize, 0, 0, 0, true, null, false, true, null, true, false);
so = new ServiceOfferingVO("Fake Offering For Secondary Storage VM", 1, _secStorageVmRamSize, 0, 0, 0, true, null, false, true, null, true, VirtualMachine.Type.SecondaryStorageVm, false);
} else if (vm.getType() == VirtualMachine.Type.DomainRouter) {
so = new ServiceOfferingVO("Fake Offering For DomR", 1, _routerRamSize, 0, 0, 0, true, null, false, true, null, true, false);
so = new ServiceOfferingVO("Fake Offering For DomR", 1, _routerRamSize, 0, 0, 0, true, null, false, true, null, true, VirtualMachine.Type.DomainRouter, false);
} else {
assert (false) : "Unsupported system vm type";
so = new ServiceOfferingVO("Fake Offering For unknow system VM", 1, 128, 0, 0, 0, false, null, false, true, null, false, false);
so = new ServiceOfferingVO("Fake Offering For unknow system VM", 1, 128, 0, 0, 0, false, null, false, true, null, false, null, false);
}
if (capacityType == CapacityVO.CAPACITY_TYPE_MEMORY) {

View File

@ -781,7 +781,7 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
_itMgr.registerGuru(VirtualMachine.Type.SecondaryStorageVm, this);
_useLocalStorage = Boolean.parseBoolean(configs.get(Config.SystemVMUseLocalStorage.key()));
_serviceOffering = new ServiceOfferingVO("System Offering For Secondary Storage VM", 1, _secStorageVmRamSize, _secStorageVmCpuMHz, null, null, false, null, _useLocalStorage, true, null, true, true);
_serviceOffering = new ServiceOfferingVO("System Offering For Secondary Storage VM", 1, _secStorageVmRamSize, _secStorageVmCpuMHz, null, null, false, null, _useLocalStorage, true, null, true, VirtualMachine.Type.SecondaryStorageVm, true);
_serviceOffering.setUniqueName("Cloud.com-SecondaryStorage");
_serviceOffering = _offeringDao.persistSystemServiceOffering(_serviceOffering);

View File

@ -805,7 +805,7 @@ public class DatabaseConfig {
useLocalStorage = false;
}
ServiceOfferingVO serviceOffering = new ServiceOfferingVO(name, cpu, ramSize, speed, null, null, ha, displayText, useLocalStorage, false, null, false, false);
ServiceOfferingVO serviceOffering = new ServiceOfferingVO(name, cpu, ramSize, speed, null, null, ha, displayText, useLocalStorage, false, null, false, null, false);
ServiceOfferingDaoImpl dao = ComponentLocator.inject(ServiceOfferingDaoImpl.class);
try {
dao.persist(serviceOffering);

View File

@ -1150,6 +1150,7 @@ CREATE TABLE `cloud`.`service_offering` (
`limit_cpu_use` tinyint(1) unsigned NOT NULL DEFAULT 0 COMMENT 'Limit the CPU usage to service offering',
`host_tag` varchar(255) COMMENT 'host tag specified by the service_offering',
`default_use` tinyint(1) unsigned NOT NULL DEFAULT 0 COMMENT 'is this offering a default system offering',
`vm_type` varchar(32) COMMENT 'type of offering specified for system offerings',
PRIMARY KEY (`id`),
CONSTRAINT `fk_service_offering__id` FOREIGN KEY (`id`) REFERENCES `disk_offering`(`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

View File

@ -7,6 +7,7 @@ ALTER TABLE `cloud`.`mshost` ADD COLUMN `state` varchar(10) NOT NULL default 'Do
ALTER TABLE `cloud`.`vm_instance` ADD COLUMN `limit_cpu_use` tinyint(1) NOT NULL DEFAULT 0 ;
ALTER TABLE `cloud`.`service_offering` ADD COLUMN `limit_cpu_use` tinyint(1) NOT NULL DEFAULT 0 ;
ALTER TABLE `cloud`.`service_offering` ADD COLUMN `default_use` tinyint(1) NOT NULL DEFAULT 0 ;
ALTER TABLE `cloud`.`service_offering` ADD COLUMN `vm_type` varchar(32) COMMENT 'type of offering specified for system offerings';
ALTER TABLE `cloud`.`storage_pool` MODIFY `host_address` varchar(255) NOT NULL;
DROP TABLE IF EXISTS `cloud`.`certificate`;