CLOUDSTACK-8140: CS fails to start after secstorage/consoleproxy.service.offering is set to uuid

This commit is contained in:
Wei Zhou 2015-01-06 10:23:44 +01:00
parent 2c9cc1ecde
commit 84c44b6314
4 changed files with 26 additions and 20 deletions

View File

@ -1804,7 +1804,7 @@ public enum Config {
ConsoleProxyServiceOffering(
"Advanced",
ManagementServer.class,
Long.class,
String.class,
"consoleproxy.service.offering",
null,
"Uuid of the service offering used by console proxy; if NULL - system offering will be used",
@ -1812,10 +1812,10 @@ public enum Config {
SecondaryStorageServiceOffering(
"Advanced",
ManagementServer.class,
Long.class,
String.class,
"secstorage.service.offering",
null,
"Service offering used by secondary storage; if NULL - system offering will be used",
"Uuid of the 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),
ImplicitHostTags(

View File

@ -91,7 +91,6 @@ import com.cloud.network.dao.IPAddressVO;
import com.cloud.network.dao.NetworkDao;
import com.cloud.network.dao.NetworkVO;
import com.cloud.network.rules.RulesManager;
import com.cloud.offering.DiskOffering;
import com.cloud.offering.NetworkOffering;
import com.cloud.offering.ServiceOffering;
import com.cloud.offerings.dao.NetworkOfferingDao;
@ -105,7 +104,6 @@ import com.cloud.storage.Storage;
import com.cloud.storage.StoragePoolStatus;
import com.cloud.storage.VMTemplateStorageResourceAssoc.Status;
import com.cloud.storage.VMTemplateVO;
import com.cloud.storage.dao.DiskOfferingDao;
import com.cloud.storage.dao.VMTemplateDao;
import com.cloud.user.Account;
import com.cloud.user.AccountManager;
@ -196,8 +194,6 @@ public class ConsoleProxyManagerImpl extends ManagerBase implements ConsoleProxy
@Inject
private ServiceOfferingDao _offeringDao;
@Inject
private DiskOfferingDao _diskOfferingDao;
@Inject
private NetworkOfferingDao _networkOfferingDao;
@Inject
private PrimaryDataStoreDao _storagePoolDao;
@ -1267,13 +1263,15 @@ public class ConsoleProxyManagerImpl extends ManagerBase implements ConsoleProxy
//check if there is a default service offering configured
String cpvmSrvcOffIdStr = configs.get(Config.ConsoleProxyServiceOffering.key());
if (cpvmSrvcOffIdStr != null) {
DiskOffering diskOffering = _diskOfferingDao.findByUuid(cpvmSrvcOffIdStr);
if (diskOffering == null) {
diskOffering = _diskOfferingDao.findById(Long.parseLong(cpvmSrvcOffIdStr));
_serviceOffering = _offeringDao.findByUuid(cpvmSrvcOffIdStr);
if (_serviceOffering == null) {
try {
_serviceOffering = _offeringDao.findById(Long.parseLong(cpvmSrvcOffIdStr));
} catch (NumberFormatException ex) {
s_logger.debug("The system service offering specified by global config is not id, but uuid=" + cpvmSrvcOffIdStr + " for console proxy vm");
}
}
if (diskOffering != null) {
_serviceOffering = _offeringDao.findById(diskOffering.getId());
} else {
if (_serviceOffering == null) {
s_logger.warn("Can't find system service offering specified by global config, uuid=" + cpvmSrvcOffIdStr + " for console proxy vm");
}
}

View File

@ -853,14 +853,20 @@ public class SecondaryStorageManagerImpl extends ManagerBase implements Secondar
//check if there is a default service offering configured
String ssvmSrvcOffIdStr = configs.get(Config.SecondaryStorageServiceOffering.key());
if (ssvmSrvcOffIdStr != null) {
Long ssvmSrvcOffId = Long.parseLong(ssvmSrvcOffIdStr);
_serviceOffering = _offeringDao.findById(ssvmSrvcOffId);
if (_serviceOffering == null || !_serviceOffering.getSystemUse()) {
String msg = "Can't find system service offering id=" + ssvmSrvcOffId + " for secondary storage vm";
s_logger.error(msg);
throw new ConfigurationException(msg);
_serviceOffering = _offeringDao.findByUuid(ssvmSrvcOffIdStr);
if (_serviceOffering == null) {
try {
_serviceOffering = _offeringDao.findById(Long.parseLong(ssvmSrvcOffIdStr));
} catch (NumberFormatException ex) {
s_logger.debug("The system service offering specified by global config is not id, but uuid=" + ssvmSrvcOffIdStr + " for secondary storage vm");
}
}
} else {
if (_serviceOffering == null) {
s_logger.warn("Can't find system service offering specified by global config, uuid=" + ssvmSrvcOffIdStr + " for secondary storage vm");
}
}
if(_serviceOffering == null || !_serviceOffering.getSystemUse()){
int ramSize = NumbersUtil.parseInt(_configDao.getValue("ssvm.ram.size"), DEFAULT_SS_VM_RAMSIZE);
int cpuFreq = NumbersUtil.parseInt(_configDao.getValue("ssvm.cpu.mhz"), DEFAULT_SS_VM_CPUMHZ);
_useLocalStorage = Boolean.parseBoolean(configs.get(Config.SystemVMUseLocalStorage.key()));

View File

@ -1005,3 +1005,5 @@ INSERT IGNORE INTO `cloud`.`guest_os_hypervisor` (uuid,hypervisor_type, hypervis
INSERT IGNORE INTO `cloud`.`configuration` (`category`, `instance`, `component`, `name`, `value`, `default_value`, `description`) VALUES ('Advanced', 'DEFAULT', 'ManagementServer', 'xen.heartbeat.timeout' , '180', '120', 'Timeout value to send to the xenheartbeat script for guarding the self fencing functionality');
UPDATE `cloud`.`configuration` SET description='Uuid of the service offering used by secondary storage; if NULL - system offering will be used' where name='secstorage.service.offering';