From 84c44b63140e8acf2336549040bda9c0a8f2ff66 Mon Sep 17 00:00:00 2001 From: Wei Zhou Date: Tue, 6 Jan 2015 10:23:44 +0100 Subject: [PATCH 1/6] CLOUDSTACK-8140: CS fails to start after secstorage/consoleproxy.service.offering is set to uuid --- .../src/com/cloud/configuration/Config.java | 6 +++--- .../consoleproxy/ConsoleProxyManagerImpl.java | 18 ++++++++--------- .../SecondaryStorageManagerImpl.java | 20 ++++++++++++------- setup/db/db/schema-442to450.sql | 2 ++ 4 files changed, 26 insertions(+), 20 deletions(-) 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'; + From ec32ea30f7b3e5351e661786955d9fa0929047bd Mon Sep 17 00:00:00 2001 From: Hugo Trippaers Date: Tue, 6 Jan 2015 11:58:58 +0100 Subject: [PATCH 2/6] Housekeeping, properly declare required maven version and update build plugin versions to recent versions --- plugins/hypervisors/hyperv/pom.xml | 3 -- plugins/user-authenticators/ldap/pom.xml | 2 +- pom.xml | 40 ++++++++++++++++-------- tools/checkstyle/pom.xml | 8 ++++- 4 files changed, 35 insertions(+), 18 deletions(-) diff --git a/plugins/hypervisors/hyperv/pom.xml b/plugins/hypervisors/hyperv/pom.xml index 9e658f63f96..e09fb43f861 100644 --- a/plugins/hypervisors/hyperv/pom.xml +++ b/plugins/hypervisors/hyperv/pom.xml @@ -70,7 +70,6 @@ org.codehaus.mojo exec-maven-plugin - 1.2.1 java com.cloud.agent.AgentShell @@ -124,7 +123,6 @@ org.codehaus.mojo exec-maven-plugin - 1.2.1 compile @@ -144,7 +142,6 @@ org.apache.maven.plugins maven-surefire-plugin - 2.12 none diff --git a/plugins/user-authenticators/ldap/pom.xml b/plugins/user-authenticators/ldap/pom.xml index 22cdeb722d6..d24a5be5ab3 100644 --- a/plugins/user-authenticators/ldap/pom.xml +++ b/plugins/user-authenticators/ldap/pom.xml @@ -24,7 +24,7 @@ org.codehaus.gmaven gmaven-plugin - 1.3 + 1.5 1.7 diff --git a/pom.xml b/pom.xml index e63769e9428..d3694bcd9a2 100644 --- a/pom.xml +++ b/pom.xml @@ -32,6 +32,10 @@ jira https://issues.apache.org/jira/browse/CLOUDSTACK + + + 3.0.4 + 1.7 @@ -92,10 +96,10 @@ target 1.0.15 4.0.0 - 2.11 - 2.5 - 2.5.3 - 2.9.1 + 2.13 + 2.7 + 3.0.0 + 2.10.1 2.6.1 @@ -612,7 +616,7 @@ org.apache.maven.plugins maven-release-plugin - 2.2.1 + 2.5.1 default @@ -695,12 +699,12 @@ org.apache.tomcat.maven tomcat7-maven-plugin - 2.0 + 2.2 org.apache.maven.plugins maven-antrun-plugin - 1.7 + 1.8 org.apache.rat @@ -837,7 +841,7 @@ org.apache.maven.plugins maven-compiler-plugin - 2.5.1 + 3.2 ${cs.jdk.version} ${cs.jdk.version} @@ -850,7 +854,7 @@ org.apache.maven.plugins maven-jar-plugin - 2.4 + 2.5 @@ -863,7 +867,7 @@ org.codehaus.mojo build-helper-maven-plugin - 1.7 + 1.9.1 remove-old-installers @@ -879,7 +883,7 @@ org.apache.maven.plugins maven-dependency-plugin - 2.5.1 + 2.9 org.codehaus.mojo @@ -922,7 +926,7 @@ org.apache.maven.plugins maven-pmd-plugin - 3.1 + 3.3 org.apache.cloudstack @@ -946,6 +950,16 @@ + + org.apache.maven.plugins + maven-surefire-plugin + 2.18.1 + + + org.apache.maven.plugins + maven-failsafe-plugin + 2.18.1 + @@ -983,7 +997,7 @@ org.apache.maven.plugins maven-site-plugin - 3.3 + 3.4 diff --git a/tools/checkstyle/pom.xml b/tools/checkstyle/pom.xml index a993237f212..afba4a5520e 100644 --- a/tools/checkstyle/pom.xml +++ b/tools/checkstyle/pom.xml @@ -25,12 +25,18 @@ org.apache.cloudstack checkstyle 4.6.0-SNAPSHOT + + + + 3.0.4 + + org.apache.maven.plugins maven-checkstyle-plugin - 2.11 + 2.13 none From eb9fba4feaded3cb18e64e44f7d601e82653f39b Mon Sep 17 00:00:00 2001 From: Hugo Trippaers Date: Tue, 6 Jan 2015 14:03:34 +0100 Subject: [PATCH 3/6] Seems we are hitting bug MCHECKSTYLE-250 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index d3694bcd9a2..66fe7f7b4f8 100644 --- a/pom.xml +++ b/pom.xml @@ -96,7 +96,7 @@ target 1.0.15 4.0.0 - 2.13 + 2.11 2.7 3.0.0 2.10.1 From e8a54f471c3c2b8c0dc7bc0105646456ad7c317a Mon Sep 17 00:00:00 2001 From: Daan Hoogland Date: Tue, 6 Jan 2015 16:24:29 +0100 Subject: [PATCH 4/6] CID-1114606 use of MAX_VALUE and longValue() on Integer --- .../configuration/ConfigurationManagerImpl.java | 12 ++++++------ server/src/com/cloud/vm/UserVmManagerImpl.java | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java index 3d5214d85c5..d1a0887b28a 100644 --- a/server/src/com/cloud/configuration/ConfigurationManagerImpl.java +++ b/server/src/com/cloud/configuration/ConfigurationManagerImpl.java @@ -2020,14 +2020,14 @@ public class ConfigurationManagerImpl extends ManagerBase implements Configurati } } - if ((cpuNumber != null) && ((cpuNumber.intValue() <= 0) || (cpuNumber.intValue() > 2147483647))) { - throw new InvalidParameterValueException("Failed to create service offering " + name + ": specify the cpu number value between 1 and 2147483647"); + if ((cpuNumber != null) && ((cpuNumber.intValue() <= 0) || (cpuNumber.longValue() > Integer.MAX_VALUE))) { + throw new InvalidParameterValueException("Failed to create service offering " + name + ": specify the cpu number value between 1 and " + Integer.MAX_VALUE); } - if ((cpuSpeed != null) && ((cpuSpeed.intValue() < 0) || (cpuSpeed.intValue() > 2147483647))) { - throw new InvalidParameterValueException("Failed to create service offering " + name + ": specify the cpu speed value between 1 and 2147483647"); + if ((cpuSpeed != null) && ((cpuSpeed.intValue() < 0) || (cpuSpeed.longValue() > Integer.MAX_VALUE))) { + throw new InvalidParameterValueException("Failed to create service offering " + name + ": specify the cpu speed value between 0 and " + Integer.MAX_VALUE); } - if ((memory != null) && ((memory.intValue() < 32) || (memory.intValue() > 2147483647))) { - throw new InvalidParameterValueException("Failed to create service offering " + name + ": specify the memory value between 32 and 2147483647 MB"); + if ((memory != null) && ((memory.intValue() < 32) || (memory.longValue() > Integer.MAX_VALUE))) { + throw new InvalidParameterValueException("Failed to create service offering " + name + ": specify the memory value between 32 and " + Integer.MAX_VALUE + " MB"); } // check if valid domain diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java index 605306e02fc..170c612a7de 100644 --- a/server/src/com/cloud/vm/UserVmManagerImpl.java +++ b/server/src/com/cloud/vm/UserVmManagerImpl.java @@ -882,7 +882,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir if (serviceOffering.getCpu() == null) { String cpuNumber = customParameters.get(UsageEventVO.DynamicParameters.cpuNumber.name()); if ((cpuNumber == null) || (NumbersUtil.parseInt(cpuNumber, -1) <= 0)) { - throw new InvalidParameterValueException("Invalid cpu cores value, specify a value between 1 and 2147483647"); + throw new InvalidParameterValueException("Invalid cpu cores value, specify a value between 1 and " + Integer.MAX_VALUE); } } else if (customParameters.containsKey(UsageEventVO.DynamicParameters.cpuNumber.name())) { throw new InvalidParameterValueException("The cpu cores of this offering id:" + serviceOffering.getId() @@ -892,7 +892,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir if (serviceOffering.getSpeed() == null) { String cpuSpeed = customParameters.get(UsageEventVO.DynamicParameters.cpuSpeed.name()); if ((cpuSpeed == null) || (NumbersUtil.parseInt(cpuSpeed, -1) <= 0)) { - throw new InvalidParameterValueException("Invalid cpu speed value, specify a value between 1 and 2147483647"); + throw new InvalidParameterValueException("Invalid cpu speed value, specify a value between 1 and " + Integer.MAX_VALUE); } } else if (customParameters.containsKey(UsageEventVO.DynamicParameters.cpuSpeed.name())) { throw new InvalidParameterValueException("The cpu speed of this offering id:" + serviceOffering.getId() @@ -902,7 +902,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir if (serviceOffering.getRamSize() == null) { String memory = customParameters.get(UsageEventVO.DynamicParameters.memory.name()); if (memory == null || (NumbersUtil.parseInt(memory, -1) < 32)) { - throw new InvalidParameterValueException("Invalid memory value, specify a value between 32 and 2147483647 MB"); + throw new InvalidParameterValueException("Invalid memory value, specify a value between 32 and " + Integer.MAX_VALUE + " MB"); } } else if (customParameters.containsKey(UsageEventVO.DynamicParameters.memory.name())) { throw new InvalidParameterValueException("The memory of this offering id:" + serviceOffering.getId() + " is not customizable. This is predefined in the template."); From 682c3af710ef002d49153f6e8b9db273378ab78d Mon Sep 17 00:00:00 2001 From: Daan Hoogland Date: Tue, 6 Jan 2015 16:38:41 +0100 Subject: [PATCH 5/6] CID-1114613 dead code removed --- .../src/com/cloud/deploy/ImplicitDedicationPlanner.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/plugins/deployment-planners/implicit-dedication/src/com/cloud/deploy/ImplicitDedicationPlanner.java b/plugins/deployment-planners/implicit-dedication/src/com/cloud/deploy/ImplicitDedicationPlanner.java index bc3ff0ab575..9500cac7a75 100644 --- a/plugins/deployment-planners/implicit-dedication/src/com/cloud/deploy/ImplicitDedicationPlanner.java +++ b/plugins/deployment-planners/implicit-dedication/src/com/cloud/deploy/ImplicitDedicationPlanner.java @@ -308,8 +308,6 @@ public class ImplicitDedicationPlanner extends FirstFitPlanner implements Deploy // But the host where system vms are running is marked as shared and still be part of empty Hosts. // The scenario will fail where actual Empty hosts and uservms not running host. return PlannerResourceUsage.Dedicated; - } else if (!preferred) { - return PlannerResourceUsage.Dedicated; } else { if (!allOtherHosts.isEmpty() && (hostsToAvoid == null || !hostsToAvoid.containsAll(allOtherHosts))) { return PlannerResourceUsage.Shared; From 3cba1c41fbcbae6612940714ad9e2e2a7ce4d7bf Mon Sep 17 00:00:00 2001 From: Daan Hoogland Date: Tue, 6 Jan 2015 16:47:32 +0100 Subject: [PATCH 6/6] CID-1114614 dead code removed --- .../src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java b/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java index f9a15865efe..3c0188d6486 100644 --- a/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java +++ b/server/src/com/cloud/network/vpn/RemoteAccessVpnManagerImpl.java @@ -266,9 +266,6 @@ public class RemoteAccessVpnManagerImpl extends ManagerBase implements RemoteAcc Integer pskLength = _pskLength; if (pskLength != null && (pskLength < 8 || pskLength > 256)) { throw new ConfigurationException("Remote Access VPN: IPSec preshared key length should be between 8 and 256"); - } else if (pskLength == null) { - s_logger.warn("Remote Access VPN configuration missing Preshared Key Length -- ignoring"); - return; } String[] range = ipRange.split("-");