diff --git a/server/src/com/cloud/configuration/Config.java b/server/src/com/cloud/configuration/Config.java index a486d3db5ef..091a3e9740c 100755 --- a/server/src/com/cloud/configuration/Config.java +++ b/server/src/com/cloud/configuration/Config.java @@ -1783,7 +1783,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", @@ -1791,10 +1791,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 14d782a47ef..7f2b52ab4cb 100755 --- 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; @@ -1254,13 +1250,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 86d94df9e8a..25e5b85b599 100755 --- a/services/secondary-storage/controller/src/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java +++ b/services/secondary-storage/controller/src/org/apache/cloudstack/secondarystorage/SecondaryStorageManagerImpl.java @@ -842,14 +842,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 60c3e45f957..b268eca1df4 100644 --- a/setup/db/db/schema-442to450.sql +++ b/setup/db/db/schema-442to450.sql @@ -990,3 +990,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'; +