From 34cec61ff78a770d7f5d71e40c79bcc96986cc22 Mon Sep 17 00:00:00 2001 From: Kelven Yang Date: Mon, 27 Dec 2010 14:01:09 -0800 Subject: [PATCH] Don't blindly switch to XenServer in premium build if database is pre-populated with a hypervisor tyoe other then FOSS default KVM --- .../src/com/cloud/server/ConfigurationServerImpl.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/server/src/com/cloud/server/ConfigurationServerImpl.java b/server/src/com/cloud/server/ConfigurationServerImpl.java index 995d781a471..9ebdceebc1b 100644 --- a/server/src/com/cloud/server/ConfigurationServerImpl.java +++ b/server/src/com/cloud/server/ConfigurationServerImpl.java @@ -53,6 +53,7 @@ import com.cloud.domain.DomainVO; import com.cloud.domain.dao.DomainDao; import com.cloud.exception.InternalErrorException; import com.cloud.exception.InvalidParameterValueException; +import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.network.Network.State; import com.cloud.network.NetworkVO; import com.cloud.network.Networks.Availability; @@ -151,8 +152,13 @@ public class ConfigurationServerImpl implements ConfigurationServer { // _configDao.update("network.type", "vlan"); // s_logger.debug("ConfigurationServer changed the network type to \"vlan\"."); - _configDao.update("hypervisor.type", "xenserver"); - s_logger.debug("ConfigurationServer changed the hypervisor type to \"xenserver\"."); + // Default value is set as KVM because of FOSS build, when we are + // running under premium, autoset to XenServer if we know it is from FOSS settings + String value = _configDao.getValue(Config.HypervisorDefaultType.key()); + if (value == null || value.equalsIgnoreCase(HypervisorType.KVM.toString())) { + _configDao.update("hypervisor.type", "xenserver"); + s_logger.debug("ConfigurationServer changed the hypervisor type to \"xenserver\"."); + } _configDao.update("secondary.storage.vm", "true"); s_logger.debug("ConfigurationServer made secondary storage vm required.");