CLOUDSTACK-204 Setting global config 'consoleproxy.service.offering' causes mgmt failed to start

This commit is contained in:
Mice Xia 2012-09-26 13:59:19 +08:00
parent bfc79f56f6
commit 7e75140537
3 changed files with 12 additions and 7 deletions

View File

@ -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),

View File

@ -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);

View File

@ -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';