Skip to content

Commit bbb72dc

Browse files
Mice XiaEdison Su
authored andcommitted
CLOUDSTACK-204 Setting global config 'consoleproxy.service.offering' causes mgmt failed to start
1 parent a111d11 commit bbb72dc

3 files changed

Lines changed: 12 additions & 7 deletions

File tree

‎server/src/com/cloud/configuration/Config.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ public enum Config {
345345
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),
346346
CustomDiskOfferingMinSize("Advanced", ManagementServer.class, Long.class, "custom.diskoffering.size.min", "1", "Minimum size in GB for custom disk offering", null),
347347
CustomDiskOfferingMaxSize("Advanced", ManagementServer.class, Long.class, "custom.diskoffering.size.max", "1024", "Maximum size in GB for custom disk offering", null),
348-
ConsoleProxyServiceOffering("Advanced", ManagementServer.class, Long.class, "consoleproxy.service.offering", null, "Service offering used by console proxy; if NULL - system offering will be used", null),
348+
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),
349349
SecondaryStorageServiceOffering("Advanced", ManagementServer.class, Long.class, "secstorage.service.offering", null, "Service offering used by secondary storage; if NULL - system offering will be used", null),
350350
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),
351351
VpcCleanupInterval("Advanced", ManagementServer.class, Integer.class, "vpc.cleanup.interval", "3600", "The interval (in seconds) between cleanup for Inactive VPCs", null),

‎server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
import javax.ejb.Local;
3030
import javax.naming.ConfigurationException;
31+
import javax.persistence.Table;
3132

3233
import org.apache.log4j.Logger;
3334

@@ -105,6 +106,7 @@
105106
import com.cloud.service.ServiceOfferingVO;
106107
import com.cloud.service.dao.ServiceOfferingDao;
107108
import com.cloud.servlet.ConsoleProxyServlet;
109+
import com.cloud.storage.DiskOfferingVO;
108110
import com.cloud.storage.StorageManager;
109111
import com.cloud.storage.StoragePoolStatus;
110112
import com.cloud.storage.StoragePoolVO;
@@ -1515,14 +1517,17 @@ public boolean configure(String name, Map<String, Object> params) throws Configu
15151517
//check if there is a default service offering configured
15161518
String cpvmSrvcOffIdStr = configs.get(Config.ConsoleProxyServiceOffering.key());
15171519
if (cpvmSrvcOffIdStr != null) {
1518-
Long cpvmSrvcOffId = Long.parseLong(cpvmSrvcOffIdStr);
1519-
_serviceOffering = _offeringDao.findById(cpvmSrvcOffId);
1520+
1521+
Long cpvmSrvcOffId = _identityDao.getIdentityId(DiskOfferingVO.class.getAnnotation(Table.class).name(),cpvmSrvcOffIdStr);
1522+
if(cpvmSrvcOffId != null)
1523+
_serviceOffering = _offeringDao.findById(cpvmSrvcOffId);
15201524
if (_serviceOffering == null || !_serviceOffering.getSystemUse()) {
1521-
String msg = "Can't find system service offering id=" + cpvmSrvcOffId + " for console proxy vm";
1525+
String msg = "Can't find system service offering specified by global config, id=" + cpvmSrvcOffId + " for console proxy vm";
15221526
s_logger.error(msg);
1523-
throw new ConfigurationException(msg);
15241527
}
1525-
} else {
1528+
}
1529+
1530+
if(_serviceOffering == null){
15261531
int ramSize = NumbersUtil.parseInt(_configDao.getValue("console.ram.size"), DEFAULT_PROXY_VM_RAMSIZE);
15271532
int cpuFreq = NumbersUtil.parseInt(_configDao.getValue("console.cpu.mhz"), DEFAULT_PROXY_VM_CPUMHZ);
15281533
_serviceOffering = new ServiceOfferingVO("System Offering For Console Proxy", 1, ramSize, cpuFreq, 0, 0, false, null, useLocalStorage, true, null, true, VirtualMachine.Type.ConsoleProxy, true);

‎setup/db/db/schema-302to40.sql‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,4 +474,4 @@ INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Network', 'DEFAULT', 'manage
474474
INSERT IGNORE INTO `cloud`.`guest_os_category` VALUES ('11','None',NULL);
475475
ALTER TABLE `cloud`.`user` ADD COLUMN `incorrect_login_attempts` integer unsigned NOT NULL DEFAULT '0';
476476
INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server', 'incorrect.login.attempts.allowed', '5', 'Incorrect login attempts allowed before the user is disabled');
477-
477+
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';

0 commit comments

Comments
 (0)