CLOUDSTACK-204 Setting global config 'consoleproxy.service.offering' causes mgmt failed to start
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/bbb72dc0 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/bbb72dc0 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/bbb72dc0 Branch: refs/heads/4.0 Commit: bbb72dc036d78aa409039b3ef42531f35598476b Parents: a111d11 Author: Mice Xia <[email protected]> Authored: Wed Sep 26 13:59:19 2012 +0800 Committer: Edison Su <[email protected]> Committed: Wed Sep 26 21:31:39 2012 -0700 ---------------------------------------------------------------------- server/src/com/cloud/configuration/Config.java | 2 +- .../consoleproxy/ConsoleProxyManagerImpl.java | 15 ++++++++++----- setup/db/db/schema-302to40.sql | 2 +- 3 files changed, 12 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bbb72dc0/server/src/com/cloud/configuration/Config.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/configuration/Config.java b/server/src/com/cloud/configuration/Config.java index 764e5ee..dbcc97a 100755 --- a/server/src/com/cloud/configuration/Config.java +++ b/server/src/com/cloud/configuration/Config.java @@ -345,7 +345,7 @@ public enum Config { EIPWithMultipleNetScalersEnabled("Advanced", ManagementServer.class, Boolean.class, "eip.use.multiple.netscalers", "false", "Should be set to true, if there will be multiple NetScaler devices providing EIP service in a zone", null), CustomDiskOfferingMinSize("Advanced", ManagementServer.class, Long.class, "custom.diskoffering.size.min", "1", "Minimum size in GB for custom disk offering", null), CustomDiskOfferingMaxSize("Advanced", ManagementServer.class, Long.class, "custom.diskoffering.size.max", "1024", "Maximum size in GB for custom disk offering", null), - ConsoleProxyServiceOffering("Advanced", ManagementServer.class, Long.class, "consoleproxy.service.offering", null, "Service offering used by console proxy; if NULL - system offering will be used", null), + ConsoleProxyServiceOffering("Advanced", ManagementServer.class, Long.class, "consoleproxy.service.offering", null, "Uuid of the service offering used by console proxy; if NULL - system offering will be used", null), SecondaryStorageServiceOffering("Advanced", ManagementServer.class, Long.class, "secstorage.service.offering", null, "Service offering used by secondary storage; if NULL - system offering will be used", null), HaTag("Advanced", ManagementServer.class, String.class, "ha.tag", null, "HA tag defining that the host marked with this tag can be used for HA purposes only", null), VpcCleanupInterval("Advanced", ManagementServer.class, Integer.class, "vpc.cleanup.interval", "3600", "The interval (in seconds) between cleanup for Inactive VPCs", null), http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bbb72dc0/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java b/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java index 38dfb06..381b67c 100755 --- a/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java +++ b/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java @@ -28,6 +28,7 @@ import java.util.UUID; import javax.ejb.Local; import javax.naming.ConfigurationException; +import javax.persistence.Table; import org.apache.log4j.Logger; @@ -105,6 +106,7 @@ import com.cloud.resource.UnableDeleteHostException; import com.cloud.service.ServiceOfferingVO; import com.cloud.service.dao.ServiceOfferingDao; import com.cloud.servlet.ConsoleProxyServlet; +import com.cloud.storage.DiskOfferingVO; import com.cloud.storage.StorageManager; import com.cloud.storage.StoragePoolStatus; import com.cloud.storage.StoragePoolVO; @@ -1515,14 +1517,17 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, ConsoleProx //check if there is a default service offering configured String cpvmSrvcOffIdStr = configs.get(Config.ConsoleProxyServiceOffering.key()); if (cpvmSrvcOffIdStr != null) { - Long cpvmSrvcOffId = Long.parseLong(cpvmSrvcOffIdStr); - _serviceOffering = _offeringDao.findById(cpvmSrvcOffId); + + Long cpvmSrvcOffId = _identityDao.getIdentityId(DiskOfferingVO.class.getAnnotation(Table.class).name(),cpvmSrvcOffIdStr); + if(cpvmSrvcOffId != null) + _serviceOffering = _offeringDao.findById(cpvmSrvcOffId); if (_serviceOffering == null || !_serviceOffering.getSystemUse()) { - String msg = "Can't find system service offering id=" + cpvmSrvcOffId + " for console proxy vm"; + String msg = "Can't find system service offering specified by global config, id=" + cpvmSrvcOffId + " for console proxy vm"; s_logger.error(msg); - throw new ConfigurationException(msg); } - } else { + } + + if(_serviceOffering == null){ int ramSize = NumbersUtil.parseInt(_configDao.getValue("console.ram.size"), DEFAULT_PROXY_VM_RAMSIZE); int cpuFreq = NumbersUtil.parseInt(_configDao.getValue("console.cpu.mhz"), DEFAULT_PROXY_VM_CPUMHZ); _serviceOffering = new ServiceOfferingVO("System Offering For Console Proxy", 1, ramSize, cpuFreq, 0, 0, false, null, useLocalStorage, true, null, true, VirtualMachine.Type.ConsoleProxy, true); http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/bbb72dc0/setup/db/db/schema-302to40.sql ---------------------------------------------------------------------- diff --git a/setup/db/db/schema-302to40.sql b/setup/db/db/schema-302to40.sql index 0916156..130203d 100644 --- a/setup/db/db/schema-302to40.sql +++ b/setup/db/db/schema-302to40.sql @@ -474,4 +474,4 @@ INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Network', 'DEFAULT', 'manage INSERT IGNORE INTO `cloud`.`guest_os_category` VALUES ('11','None',NULL); ALTER TABLE `cloud`.`user` ADD COLUMN `incorrect_login_attempts` integer unsigned NOT NULL DEFAULT '0'; INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'incorrect.login.attempts.allowed', '5', 'Incorrect login attempts allowed before the user is disabled'); - +UPDATE `cloud`.`configuration` set description ='Uuid of the service offering used by console proxy; if NULL - system offering will be used' where name ='consoleproxy.service.offering';
