diff --git a/server/src/com/cloud/configuration/Config.java b/server/src/com/cloud/configuration/Config.java index af4da6a16a1..f9e9bddc30e 100644 --- a/server/src/com/cloud/configuration/Config.java +++ b/server/src/com/cloud/configuration/Config.java @@ -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( diff --git a/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java b/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java index 65930aa767f..bb64fa3a12c 100644 --- a/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java +++ b/server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java @@ -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"); } } diff --git a/services/secondary-storage/controller/src/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java b/services/secondary-storage/controller/src/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java index 3ba4242e0d3..ccf3dcd73c7 100644 --- a/services/secondary-storage/controller/src/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java +++ b/services/secondary-storage/controller/src/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java @@ -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())); diff --git a/setup/db/db/schema-442to450.sql b/setup/db/db/schema-442to450.sql index b5006c23e8b..94984816fe4 100644 --- a/setup/db/db/schema-442to450.sql +++ b/setup/db/db/schema-442to450.sql @@ -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'; +