modules/common/cassandra-ccm/cassandra-ccm-arquillian/src/main/java/org/rhq/cassandra/ccm/arquillian/CCMSuiteDeploymentExtension.java
| 64 +---------
modules/common/cassandra-ccm/cassandra-ccm-core/src/main/java/org/rhq/cassandra/DeploymentOptions.java
| 12 +
modules/common/cassandra-ccm/cassandra-ccm-core/src/main/resources/cassandra.properties
| 4
modules/common/cassandra-installer/src/main/java/org/rhq/storage/installer/StorageInstaller.java
| 8 -
modules/core/dbutils/pom.xml
| 12 +
modules/core/dbutils/src/main/scripts/dbsetup/measurement-schema.xml
| 3
modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
| 8 +
modules/core/domain/src/main/java/org/rhq/core/domain/cloud/StorageNode.java
| 34 -----
modules/core/domain/src/test/java/org/rhq/core/domain/cloud/StorageNodeTest.java
| 54 +-------
modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml
| 20 ++-
modules/enterprise/server/data-migration/src/main/java/org/rhq/server/metrics/migrator/DataMigratorRunner.java
| 31 +---
modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java
| 10 -
modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerInstallUtil.java
| 21 +--
modules/enterprise/server/itests-2/pom.xml
| 7 -
modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/cloud/StorageNodeManagerBeanTest.java
| 9 -
modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/StrippedDownStartupBeanPreparation.java
| 19 +-
modules/enterprise/server/itests-2/src/test/resources/cassandra-test.properties
| 7 -
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/StorageNodeManagerBean.java
| 17 +-
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/storage/StorageClientManagerBean.java
| 4
modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Upgrade.java
| 38 +++++
modules/plugins/rhq-storage/src/test/java/org/rhq/plugins/storage/StorageNodeComponentITest.java
| 7 -
21 files changed, 158 insertions(+), 231 deletions(-)
New commits:
commit ca8b82bc0eef209b344c46c122376c8baa8d8ec3
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Fri Aug 30 00:04:55 2013 -0500
Initial commit that migrates storage node properties from rhq.cassandra.* to
rhq.storage.*
Tests might not be stable but the rest server and storage node code is complete.
diff --git
a/modules/common/cassandra-ccm/cassandra-ccm-arquillian/src/main/java/org/rhq/cassandra/ccm/arquillian/CCMSuiteDeploymentExtension.java
b/modules/common/cassandra-ccm/cassandra-ccm-arquillian/src/main/java/org/rhq/cassandra/ccm/arquillian/CCMSuiteDeploymentExtension.java
index 7c59114..c52f778 100644
---
a/modules/common/cassandra-ccm/cassandra-ccm-arquillian/src/main/java/org/rhq/cassandra/ccm/arquillian/CCMSuiteDeploymentExtension.java
+++
b/modules/common/cassandra-ccm/cassandra-ccm-arquillian/src/main/java/org/rhq/cassandra/ccm/arquillian/CCMSuiteDeploymentExtension.java
@@ -152,10 +152,13 @@ public class CCMSuiteDeploymentExtension implements
LoadableExtension {
}
} else {
try {
- String seed =
System.getProperty("rhq.cassandra.seeds", "127.0.0.1|7299|9042");
- nodes = parseNodeAddresses(seed);
- cqlPort = parseNodeCqlPort(seed);
- jmxPorts = parseNodeJmxPorts(seed);
+ String nodesString =
System.getProperty("rhq.storage.nodes", "127.0.0.1");
+ nodes = nodesString.split(",");
+
+ String cqlPortString =
System.getProperty("rhq.storage.cql-port", "9042");
+ cqlPort = Integer.parseInt(cqlPortString);
+
+ //jmxPorts = parseNodeJmxPorts(seed);
schemaManager = new SchemaManager("rhqadmin",
"rhqadmin", nodes, cqlPort);
} catch (Exception e) {
@@ -268,58 +271,5 @@ public class CCMSuiteDeploymentExtension implements LoadableExtension
{
throw new RuntimeException("Could not load defined deploymentClass:
" + className, e);
}
}
-
- private String[] parseNodeAddresses(String s) {
- String[] unparsedNodes = s.split(",");
-
- String[] nodes = new String[unparsedNodes.length];
-
- for (int index = 0; index < 0; index++) {
- String[] params = unparsedNodes[index].split("\\|");
- if (params.length != 3) {
- throw new IllegalArgumentException(
- "Expected string of the form,
hostname|jmxPort|nativeTransportPort: [" + s + "]");
- }
-
- nodes[index] = params[0];
- }
-
- return nodes;
- }
-
- private int[] parseNodeJmxPorts(String s) {
- String[] unparsedNodes = s.split(",");
-
- int[] jmxPorts = new int[unparsedNodes.length];
-
- for (int index = 0; index < 0; index++) {
- String[] params = unparsedNodes[index].split("\\|");
- if (params.length != 3) {
- throw new IllegalArgumentException(
- "Expected string of the form,
hostname|jmxPort|nativeTransportPort: [" + s + "]");
- }
-
- jmxPorts[index] = Integer.parseInt(params[1]);
- }
-
- return jmxPorts;
- }
-
- private int parseNodeCqlPort(String s) {
- String[] unparsedNodes = s.split(",");
-
- for (String unparsedNode : unparsedNodes) {
- String[] params = unparsedNode.split("\\|");
- if (params.length != 3) {
- throw new IllegalArgumentException(
- "Expected string of the form,
hostname|jmxPort|nativeTransportPort: [" + s + "]");
- }
-
- return Integer.parseInt(params[2]);
- }
-
- throw new IllegalArgumentException("Seed property is not valid [" +
s + "]");
- }
-
}
}
\ No newline at end of file
diff --git
a/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/java/org/rhq/cassandra/DeploymentOptions.java
b/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/java/org/rhq/cassandra/DeploymentOptions.java
index 33e4e25..9bb0372 100644
---
a/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/java/org/rhq/cassandra/DeploymentOptions.java
+++
b/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/java/org/rhq/cassandra/DeploymentOptions.java
@@ -134,6 +134,9 @@ public class DeploymentOptions {
}
private void init(Properties properties) {
+ setUsername(loadProperty("rhq.storage.username", properties));
+ setPassword(loadProperty("rhq.storage.password", properties));
+
setClusterDir(loadProperty("rhq.cassandra.cluster.dir", properties));
setNumNodes(Integer.parseInt(loadProperty("rhq.cassandra.cluster.num-nodes",
properties)));
setEmbedded(Boolean.valueOf(loadProperty("rhq.cassandra.cluster.is-embedded",
properties)));
@@ -144,8 +147,6 @@ public class DeploymentOptions {
setRpcPort(Integer.valueOf(loadProperty("rhq.cassandra.rpc-port",
properties)));
setNativeTransportMaxThreads(Integer.valueOf(loadProperty("rhq.cassandra.native-transport-max-threads",
properties)));
- setUsername(loadProperty("rhq.cassandra.username", properties));
- setPassword(loadProperty("rhq.cassandra.password", properties));
setAuthenticator(loadProperty("rhq.cassandra.authenticator",
properties));
setAuthorizer(loadProperty("rhq.cassandra.authorizer", properties));
setDataDir(loadProperty("rhq.cassandra.data.dir", properties));
@@ -158,6 +159,7 @@ public class DeploymentOptions {
setJmxPort(Integer.valueOf(loadProperty("rhq.cassandra.jmx.port",
properties)));
setStoragePort(Integer.valueOf(loadProperty("rhq.cassandra.storage.port",
properties)));
setSslStoragePort(Integer.valueOf(loadProperty("rhq.cassandra.ssl.storage.port",
properties)));
+
setSeeds(loadProperty("rhq.cassandra.seeds", properties));
setBasedir(loadProperty("rhq.cassandra.basedir", properties));
setHeapSize(loadProperty("rhq.cassandra.max.heap.size", properties));
@@ -353,7 +355,7 @@ public class DeploymentOptions {
nativeTransportPort = port;
}
}
-
+
/**
* @return true whether the Thrift-based RPC should be started
*/
@@ -404,7 +406,7 @@ public class DeploymentOptions {
* <strong>not</strong> a Cassandra configuration property. This
deployment property is
* written to rhq-server.properties at build time by the rhq-container.build.xml
script.
*/
- @DeploymentProperty(name = "rhq.cassandra.username")
+ @DeploymentProperty(name = "rhq.storage.username")
public String getUsername() {
return username;
}
@@ -426,7 +428,7 @@ public class DeploymentOptions {
* <strong>not</strong> a Cassandra configuration property. This
deployment property is
* written to rhq-server.properties at build time by the rhq-container.build.xml
script.
*/
- @DeploymentProperty(name = "rhq.cassandra.password")
+ @DeploymentProperty(name = "rhq.storage.password")
public String getPassword() {
return password;
}
diff --git
a/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/resources/cassandra.properties
b/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/resources/cassandra.properties
index 9a1ab75..ebadc27 100644
---
a/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/resources/cassandra.properties
+++
b/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/resources/cassandra.properties
@@ -7,10 +7,10 @@
rhq.cassandra.basedir=${rhq.rootDir}
# The username with which to authenticate requests to Cassandra.
-rhq.cassandra.username=rhqadmin
+rhq.storage.username=rhqadmin
# The password with which to authenticate requests to Cassandra.
-rhq.cassandra.password=1eeb2f255e832171df8592078de921bc
+rhq.storage.password=1eeb2f255e832171df8592078de921bc
# Defines the number of tokens randomly assigned to a node on the ring. The more tokens,
# relative to other nodes, the larger the proportion of data that this node will store.
You
diff --git
a/modules/common/cassandra-installer/src/main/java/org/rhq/storage/installer/StorageInstaller.java
b/modules/common/cassandra-installer/src/main/java/org/rhq/storage/installer/StorageInstaller.java
index c189bfa..de13f5c 100644
---
a/modules/common/cassandra-installer/src/main/java/org/rhq/storage/installer/StorageInstaller.java
+++
b/modules/common/cassandra-installer/src/main/java/org/rhq/storage/installer/StorageInstaller.java
@@ -400,8 +400,8 @@ public class StorageInstaller {
PropertiesFileUpdate serverPropertiesUpdater = getServerProperties();
log.info("Updating rhq-server.properties...");
- serverPropertiesUpdater.update("rhq.cassandra.seeds",
- getSeedsProperty(hostname, jmxPort, nativeTransportPort));
+ serverPropertiesUpdater.update("rhq.storage.nodes", hostname);
+ serverPropertiesUpdater.update("rhq.storage.cql-port",
nativeTransportPort + "");
}
boolean startNode =
Boolean.parseBoolean(cmdLine.getOptionValue("start", "true"));
@@ -522,10 +522,6 @@ public class StorageInstaller {
return new PropertiesFileUpdate(file.getAbsolutePath());
}
- private String getSeedsProperty(String hostname, int jmxPort, int
nativeTransportPort) {
- return hostname + "|" + jmxPort + "|" + nativeTransportPort;
- }
-
private String startNode(DeploymentOptions deploymentOptions) throws Exception {
org.apache.commons.exec.CommandLine cmdLine;
String errOutput;
diff --git a/modules/core/dbutils/pom.xml b/modules/core/dbutils/pom.xml
index 261b6ba..44d73e8 100644
--- a/modules/core/dbutils/pom.xml
+++ b/modules/core/dbutils/pom.xml
@@ -17,7 +17,7 @@
<description>Database schema setup, upgrade and other
utilities</description>
<properties>
- <db.schema.version>2.138</db.schema.version>
+ <db.schema.version>2.139</db.schema.version>
<rhq.ds.type-mapping>${rhq.test.ds.type-mapping}</rhq.ds.type-mapping>
<rhq.ds.server-name>${rhq.test.ds.server-name}</rhq.ds.server-name>
<rhq.ds.db-name>${rhq.test.ds.db-name}</rhq.ds.db-name>
@@ -274,11 +274,13 @@
if
(project.getProperty('dbsetup-upgrade') || project.getProperty('dbreset')
|| project.getProperty('dbsetup')) {
if
(project.getProperty('storage-schema')) {
self.log('PERFORMING STORAGE NODE
SETUP TO LATEST SCHEMA')
- username =
project.getProperty('rhq.cassandra.username') ?: "rhqadmin"
- password =
project.getProperty('rhq.cassandra.password') ?: "rhqadmin"
- seeds =
project.getProperty('rhq.cassandra.seeds') ?: "127.0.0.1|7299|9142"
+ username =
project.getProperty('rhq.storage.username') ?: "rhqadmin"
+ password =
project.getProperty('rhq.storage.password') ?: "rhqadmin"
- schemaManager = new
SchemaManager(username, password, seeds)
+ nodes =
project.getProperty('rhq.strorage.nodes') ?: "127.0.0.1"
+ cqlPort =
project.getProperty('rhq.storage.cql-port') ?: "9142"
+
+ schemaManager = new
SchemaManager(username, password, nodes.split(","), cqlPort)
if
(project.getProperty('dbreset') == 'true') {
self.log('Dropping schema')
diff --git a/modules/core/dbutils/src/main/scripts/dbsetup/measurement-schema.xml
b/modules/core/dbutils/src/main/scripts/dbsetup/measurement-schema.xml
index da9ff04..64a5d7f 100644
--- a/modules/core/dbutils/src/main/scripts/dbsetup/measurement-schema.xml
+++ b/modules/core/dbutils/src/main/scripts/dbsetup/measurement-schema.xml
@@ -449,7 +449,6 @@
<table name="RHQ_STORAGE_NODE">
<column name="ID" default="sequence-only"
initial="10001" primarykey="true" required="true"
type="INTEGER" />
<column name="ADDRESS" required="true" size="255"
type="VARCHAR2" />
- <column name="JMX_PORT" required="true"
type="INTEGER" />
<column name="CQL_PORT" required="true"
type="INTEGER" />
<column name="OPERATION_MODE" required="true"
size="32" type="VARCHAR2" />
<column name="CTIME" required="true" type="LONG"
/>
@@ -464,5 +463,5 @@
<field ref="ADDRESS" />
</index>
</table>
-
+
</dbsetup>
\ No newline at end of file
diff --git a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
index bb2bb88..543f857 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -2220,6 +2220,14 @@
</schema-directSQL>
</schemaSpec>
+ <schemaSpec version="2.139">
+ <schema-directSQL>
+ <statement desc="Drop JMX port column from Storage Node
table">
+ ALTER TABLE RHQ_STORAGE_NODE DROP COLUMN JMX_PORT
+ </statement>
+ </schema-directSQL>
+ </schemaSpec>
+
</dbupgrade>
</target>
</project>
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/cloud/StorageNode.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/cloud/StorageNode.java
index 9df0a53..cdd314b 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/cloud/StorageNode.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/cloud/StorageNode.java
@@ -121,9 +121,6 @@ public class StorageNode implements Serializable {
@Column(name = "ADDRESS", nullable = false)
private String address;
- @Column(name = "JMX_PORT", nullable = false)
- private int jmxPort;
-
@Column(name = "CQL_PORT", nullable = false)
private int cqlPort;
@@ -178,11 +175,7 @@ public class StorageNode implements Serializable {
}
public int getJmxPort() {
- return jmxPort;
- }
-
- public void setJmxPort(int jmxPort) {
- this.jmxPort = jmxPort;
+ return 7299;
}
public int getCqlPort() {
@@ -308,15 +301,9 @@ public class StorageNode implements Serializable {
LEAVING
}
- public String getJMXConnectionURL() {
- // GWT doesn't support String.format()
- String[] split = JMX_CONNECTION_STRING.split("%s");
- return split[0] + this.address + split[1] + this.jmxPort + split[2];
- }
-
@Override
public String toString() {
- return "StorageNode[id=" + id + ", address=" + address +
", jmxPort=" + jmxPort + ", cqlPort=" + cqlPort
+ return "StorageNode[id=" + id + ", address=" + address +
", cqlPort=" + cqlPort
+ ", operationMode=" + operationMode + ", mtime=" + mtime
+ "]";
}
@@ -347,26 +334,13 @@ public class StorageNode implements Serializable {
final StorageNode other = (StorageNode) obj;
if (address == null) {
- if (other.address != null) {
+ if (other.getAddress() != null) {
return false;
}
- } else if (!address.equals(other.address)) {
+ } else if (!address.equals(other.getAddress())) {
return false;
}
return true;
}
-
- public void parseNodeInformation(String s) {
- String[] params = s.split("\\|");
- if (params.length != 3) {
- throw new IllegalArgumentException("Expected string of the form,
hostname|jmxPort|nativeTransportPort: ["
- + s + "]");
- }
-
- this.setAddress(params[0]);
- this.setJmxPort(Integer.parseInt(params[1]));
- this.setCqlPort(Integer.parseInt(params[2]));
- }
-
}
diff --git
a/modules/core/domain/src/test/java/org/rhq/core/domain/cloud/StorageNodeTest.java
b/modules/core/domain/src/test/java/org/rhq/core/domain/cloud/StorageNodeTest.java
index ce4dbbd..1395884 100644
--- a/modules/core/domain/src/test/java/org/rhq/core/domain/cloud/StorageNodeTest.java
+++ b/modules/core/domain/src/test/java/org/rhq/core/domain/cloud/StorageNodeTest.java
@@ -22,7 +22,6 @@
*/
package org.rhq.core.domain.cloud;
-import org.testng.Assert;
import org.testng.annotations.Test;
import org.rhq.core.domain.cloud.StorageNode.OperationMode;
@@ -33,79 +32,48 @@ public class StorageNodeTest {
StorageNode localhost1 = new StorageNode();
assert localhost1 != null;
assert !localhost1.equals(null);
-
+
StorageNode localhost2 = new StorageNode();
assert localhost2 != null;
assert localhost1.equals(localhost2);
assert localhost2.equals(localhost1);
-
+
localhost1.setAddress("127.0.0.1");
assert !localhost1.equals(localhost2);
assert !localhost2.equals(localhost1);
-
+
localhost2.setAddress("127.0.0.1");
assert localhost1.equals(localhost2);
assert localhost2.equals(localhost1);
-
+
StorageNode localhost3 = new StorageNode(42);
localhost3.setAddress("sn.com");
assert !localhost3.equals(null);
assert !localhost3.equals(localhost1);
assert localhost3.hashCode() != localhost1.hashCode();
assert localhost2.hashCode() == localhost1.hashCode();
-
+
localhost3.setAddress("127.0.0.1");
assert localhost3.equals(localhost1);
assert localhost3.hashCode() == localhost1.hashCode();
}
- public void testParseNodeInformation1() {
+ public void testNodeInformation1() {
StorageNode localhost1 = new StorageNode();
- localhost1.parseNodeInformation("127.0.0.1|1234|4321");
+ localhost1.setAddress("127.0.0.1");
+ localhost1.setCqlPort(4321);
assert "127.0.0.1".equals(localhost1.getAddress());
- assert localhost1.getJmxPort() == 1234;
assert localhost1.getCqlPort() == 4321;
- assert
"service:jmx:rmi:///jndi/rmi://127.0.0.1:1234/jmxrmi".equals(localhost1.getJMXConnectionURL());
-
+
localhost1.setOperationMode(OperationMode.INSTALLED);
assert localhost1.getOperationMode() == OperationMode.INSTALLED;
assert localhost1.getOperationMode().getMessage() != null;
assert localhost1.getOperationMode().getMessage() != null;
localhost1.setMtime(42);
assert localhost1.getMtime() == 42;
-
+
StorageNode localhost2 = new StorageNode();
- localhost2.parseNodeInformation("127.0.0.1|1235|5321");
+ localhost2.setAddress("127.0.0.1");
assert localhost1.equals(localhost2);
- assert
!localhost1.getJMXConnectionURL().equals(localhost2.getJMXConnectionURL());
- }
-
- public void testParseNodeInformation2() {
- StorageNode localhost1 = new StorageNode();
- try {
- localhost1.parseNodeInformation("127.0.0.1|1234|4321|foo");
- Assert.fail("The exception (IllegalArgumentException) should be
thrown!");
- } catch (IllegalArgumentException e) {
- }
- try {
- localhost1.parseNodeInformation("127.0.0.1|1234");
- Assert.fail("The exception (IllegalArgumentException) should be
thrown!");
- } catch (IllegalArgumentException e) {
- }
- try {
- localhost1.parseNodeInformation("127.0.0.1|aaaa|4321");
- Assert.fail("The exception (NumberFormatException) should be
thrown!");
- } catch (NumberFormatException e) {
- }
- try {
- localhost1.parseNodeInformation("127.0.0.1|1234|bbbb");
- Assert.fail("The exception (NumberFormatException) should be
thrown!");
- } catch (NumberFormatException e) {
- }
- try {
- localhost1.parseNodeInformation(null);
- Assert.fail("The exception (NullPointerException) should be
thrown!");
- } catch (NullPointerException e) {
- }
}
}
diff --git a/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml
b/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml
index 2c8bcbe..566a0c9 100644
--- a/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml
+++ b/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml
@@ -672,23 +672,29 @@ rhq.sync.endpoint-address=false
# Cassandra cluster configuration settings
#############################################
# The username RHQ will use to authenticate against Cassandra.
-rhq.cassandra.username=${rhq.cassandra.username}
+rhq.storage.username=${rhq.storage.username}
# The password RHQ will use to authenticate against Cassandra.
-rhq.cassandra.password=${rhq.cassandra.password}
+rhq.storage.password=${rhq.storage.password}
-# A comma-delimited list of seed nodes. Each Cassandra node uses this list as
+# A comma-delimited list of storage nodes. Each Cassandra node uses this list as
# contact points to find other nodes in the cluster and learn the ring
# topology. The RHQ server(s) use this list to connect to the cluster;
# therefore, this property MUST BE SET in order for RHQ to talk to Cassandra.
-# Each entry in the list consists of three fields that are pipe-delimited. The
-# of an entry is as follows,
+# The of an entry is as follows,
#
-# hostname|jmxPort|nativeTransportPort|
+# hostname1,hostname2
#
# Note that this is actually an installer setting. Changing the value after
# installation will have no effect.
-rhq.cassandra.seeds=
+rhq.storage.nodes=
+
+# The list of ports used by storages nodes to communiticate with each other
+# and used by the RHQ server(s) to communicate with the cluster.
+# Both properties are required.
+#
+rhq.storage.cql-port=${rhq.cassandra.native-transport-port}
+rhq.storage.gossip-port=${rhq.cassandra.native-transport-port}
# If enabled data sent to and from storage nodes will be compressed using
# snappy (
https://code.google.com/p/snappy) compression. Note that this is an
diff --git
a/modules/enterprise/server/data-migration/src/main/java/org/rhq/server/metrics/migrator/DataMigratorRunner.java
b/modules/enterprise/server/data-migration/src/main/java/org/rhq/server/metrics/migrator/DataMigratorRunner.java
index 6ee0e57..80e1129 100644
---
a/modules/enterprise/server/data-migration/src/main/java/org/rhq/server/metrics/migrator/DataMigratorRunner.java
+++
b/modules/enterprise/server/data-migration/src/main/java/org/rhq/server/metrics/migrator/DataMigratorRunner.java
@@ -349,6 +349,7 @@ public class DataMigratorRunner {
serverProperties.load(stream);
stream.close();
+ //SQL options
String dbType =
serverProperties.getProperty("rhq.server.database.type-mapping");
DatabaseType databaseType = DatabaseType.Postgres;
if (dbType != null && dbType.toLowerCase().contains("oracle"))
{
@@ -361,28 +362,20 @@ public class DataMigratorRunner {
configuration.put(sqlPasswordOption,
PicketBoxObfuscator.decode(dbPasswordProperty));
configuration.put(sqlConnectionUrlOption,
serverProperties.getProperty("rhq.server.database.connection-url"));
- configuration.put(cassandraUserOption,
serverProperties.getProperty("rhq.cassandra.username"));
- String cassandraPasswordProperty =
serverProperties.getProperty("rhq.cassandra.password");
+ //Storage Node options
+ configuration.put(cassandraUserOption,
serverProperties.getProperty("rhq.storage.username"));
+ String cassandraPasswordProperty =
serverProperties.getProperty("rhq.storage.password");
configuration.put(cassandraPasswordOption,
PicketBoxObfuscator.decode(cassandraPasswordProperty));
- if (serverProperties.getProperty("rhq.cassandra.seeds") != null
- &&
!serverProperties.getProperty("rhq.cassandra.seeds").trim().isEmpty()) {
-
- String[] unparsedSeeds
=serverProperties.getProperty("rhq.cassandra.seeds").split(",");
- String[] seedHosts = new String[unparsedSeeds.length];
- Integer cassandraPort = null;
- for (int index = 0; index < unparsedSeeds.length; index++) {
- String[] params = unparsedSeeds[index].split("\\|");
- if (params.length != 3) {
- throw new IllegalArgumentException(
- "Expected string of the form,
hostname|jmxPort|nativeTransportPort: [" + unparsedSeeds[index] + "]");
- }
-
- seedHosts[index] = params[0];
- cassandraPort = tryParseInteger(params[2], DEFAULT_CASSANDRA_PORT);
- }
+ if (serverProperties.getProperty("rhq.storage.nodes") != null
+ &&
!serverProperties.getProperty("rhq.storage.nodes").trim().isEmpty()) {
+ String[] storageNodes =
serverProperties.getProperty("rhq.storage.nodes").split(",");
+ configuration.put(cassandraHostsOption, storageNodes);
+ }
- configuration.put(cassandraHostsOption, seedHosts);
+ if (serverProperties.getProperty("rhq.storage.cql-port") != null
+ &&
!serverProperties.getProperty("rhq.storage.cql-port").trim().isEmpty()) {
+ Integer cassandraPort =
Integer.parseInt(serverProperties.getProperty("rhq.storage.cql-port"));
configuration.put(cassandraPortOption, cassandraPort);
}
}
diff --git
a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java
b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java
index e103356..03a34cb 100644
---
a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java
+++
b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java
@@ -1158,12 +1158,14 @@ public class InstallerServiceImpl implements InstallerService {
}
private List<StorageNode> parseNodeInformation(HashMap<String, String>
serverProps) {
- String[] nodes =
serverProps.get("rhq.cassandra.seeds").split(",");
+ String[] nodes =
serverProps.get("rhq.storage.nodes").split(",");
+ String cqlPort = serverProps.get("rhq.storage.cql-port");
List<StorageNode> parsedNodes = new ArrayList<StorageNode>();
for (String node : nodes) {
StorageNode storageNode = new StorageNode();
- storageNode.parseNodeInformation(node);
+ storageNode.setAddress(node);
+ storageNode.setCqlPort(Integer.parseInt(cqlPort));
parsedNodes.add(storageNode);
}
@@ -1171,8 +1173,8 @@ public class InstallerServiceImpl implements InstallerService {
}
private SchemaManager createStorageNodeSchemaManager(HashMap<String, String>
serverProps) {
- String username = serverProps.get("rhq.cassandra.username");
- String password = serverProps.get("rhq.cassandra.password");
+ String username = serverProps.get("rhq.storage.username");
+ String password = serverProps.get("rhq.storage.password");
List<StorageNode> storageNodes = this.parseNodeInformation(serverProps);
String[] nodes = new String[storageNodes.size()];
diff --git
a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerInstallUtil.java
b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerInstallUtil.java
index cc947c3..8900d8a 100644
---
a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerInstallUtil.java
+++
b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerInstallUtil.java
@@ -902,7 +902,7 @@ public class ServerInstallUtil {
/**
* Persists the storage nodes to the database only if no storage node entities
already exist. This method is used
- * to persist storage nodes created from the rhq.cassandra.seeds server configuration
property. The only time those
+ * to persist storage nodes created from the rhq.storage.nodes server configuration
property. The only time those
* seed nodes should be created is during an initial server installation. After the
initial installation storage
* nodes should be created using <code>rhqctl install</code>. This
ensures that any necessary cluster maintenance
* tasks will be performed.
@@ -939,23 +939,21 @@ public class ServerInstallUtil {
connection.setAutoCommit(false);
try {
- LOG.info("Persisting to database new storage nodes for values
specified in server configuration " +
- "property [rhq.cassandra.seeds]");
+ LOG.info("Persisting to database new storage nodes for values
specified in server configuration property [rhq.storage.nodes]");
insertStatement = connection.prepareStatement(
- "INSERT INTO rhq_storage_node (id, address, jmx_port,
cql_port, operation_mode, ctime, mtime) " +
- "VALUES (?, ?, ?, ?, ?, ?, ?)"
+ "INSERT INTO rhq_storage_node (id, address, cql_port,
operation_mode, ctime, mtime) " +
+ "VALUES (?, ?, ?, ?, ?, ?)"
);
int id = 1001;
for (StorageNode storageNode : storageNodes) {
insertStatement.setInt(1, id);
insertStatement.setString(2, storageNode.getAddress());
- insertStatement.setInt(3, storageNode.getJmxPort());
- insertStatement.setInt(4, storageNode.getCqlPort());
- insertStatement.setString(5,
StorageNode.OperationMode.INSTALLED.toString());
+ insertStatement.setInt(3, storageNode.getCqlPort());
+ insertStatement.setString(4,
StorageNode.OperationMode.INSTALLED.toString());
+ insertStatement.setLong(5, System.currentTimeMillis());
insertStatement.setLong(6, System.currentTimeMillis());
- insertStatement.setLong(7, System.currentTimeMillis());
insertStatement.executeUpdate();
id += 1;
@@ -964,13 +962,12 @@ public class ServerInstallUtil {
connection.commit();
} catch (SQLException e) {
LOG.error("Failed to persist to database the storage nodes
specified by server configuration " +
- "property [rhq.cassandra.seeds]. Transaction will be rolled
back.", e);
+ "property [rhq.storage.nodes]. Transaction will be rolled
back.", e);
connection.rollback();
throw e;
}
} else {
- LOG.info("Storage nodes already exist in database. Server
configuration property " +
- "[rhq.cassandra.seeds] will be ignored.");
+ LOG.info("Storage nodes already exist in database. Server
configuration property [rhq.storage.nodes] will be ignored.");
}
} finally {
diff --git a/modules/enterprise/server/itests-2/pom.xml
b/modules/enterprise/server/itests-2/pom.xml
index 63eb166..0dacb1a 100644
--- a/modules/enterprise/server/itests-2/pom.xml
+++ b/modules/enterprise/server/itests-2/pom.xml
@@ -33,9 +33,10 @@
<skip.oracle>true</skip.oracle>
<!-- cassandra connection properties -->
- <rhq.cassandra.username>rhqadmin</rhq.cassandra.username>
- <rhq.cassandra.password>rhqadmin</rhq.cassandra.password>
-
<rhq.cassandra.seeds>127.0.0.1|9160|9042,127.0.0.2|9160|9042</rhq.cassandra.seeds>
+ <rhq.storage.username>rhqadmin</rhq.storage.username>
+ <rhq.storage.password>rhqadmin</rhq.storage.password>
+ <rhq.storage.nodes>127.0.0.1,127.0.0.2</rhq.storage.nodes>
+ <rhq.storage.cql-port>9042</rhq.storage.cql-port>
</properties>
<dependencies>
diff --git
a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/cloud/StorageNodeManagerBeanTest.java
b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/cloud/StorageNodeManagerBeanTest.java
index 78c0cff..debe690 100644
---
a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/cloud/StorageNodeManagerBeanTest.java
+++
b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/cloud/StorageNodeManagerBeanTest.java
@@ -25,12 +25,7 @@
package org.rhq.enterprise.server.cloud;
-import static
org.rhq.enterprise.server.cloud.StorageNodeManagerBean.STORAGE_NODE_GROUP_NAME;
-
-import java.util.ArrayList;
-import java.util.Arrays;
import java.util.HashSet;
-import java.util.List;
import java.util.Set;
import java.util.UUID;
@@ -38,19 +33,16 @@ import javax.ejb.EJB;
import javax.persistence.Query;
import javax.transaction.Transaction;
-import org.testng.Assert;
import org.testng.annotations.Test;
import org.rhq.core.domain.cloud.StorageNode;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.configuration.definition.PropertyDefinitionSimple;
import org.rhq.core.domain.configuration.definition.PropertySimpleType;
-import org.rhq.core.domain.criteria.ResourceGroupCriteria;
import org.rhq.core.domain.criteria.StorageNodeCriteria;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceCategory;
import org.rhq.core.domain.resource.ResourceType;
-import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.util.PageList;
import org.rhq.core.domain.util.PageOrdering;
import org.rhq.enterprise.server.auth.SubjectManagerLocal;
@@ -96,7 +88,6 @@ public class StorageNodeManagerBeanTest extends AbstractEJB3Test {
StorageNode node = new StorageNode();
node.setAddress(address);
node.setOperationMode(StorageNode.OperationMode.NORMAL);
- node.setJmxPort(7299 + i);
node.setCqlPort(9142 + i);
if (i == 0) {
firstOne = node;
diff --git
a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/StrippedDownStartupBeanPreparation.java
b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/StrippedDownStartupBeanPreparation.java
index cf9d84c..258cbb8 100644
---
a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/StrippedDownStartupBeanPreparation.java
+++
b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/StrippedDownStartupBeanPreparation.java
@@ -47,9 +47,9 @@ import org.rhq.enterprise.server.cloud.instance.ServerManagerLocal;
* This startup singleton EJB is here to work around bug AS7-5530 and to
* schedule the real StartupBean's work in a delayed fashion (this is to allow
* AS7 to complete its deployment work before we do our work).
- *
+ *
* See
https://issues.jboss.org/browse/AS7-5530
- *
+ *
* This version is a replacement for the original code (identical) code that uses the
StrippedDownStartupBean instead
* of the fullblown original.
*/
@@ -100,10 +100,12 @@ public class StrippedDownStartupBeanPreparation {
}
private void createStorageNodes() {
- String[] seedsInfo =
System.getProperty("rhq.cassandra.seeds").split(",");
- for (String seedInfo : seedsInfo) {
+ String[] nodes =
System.getProperty("rhq.storage.nodes").split(",");
+ String cqlPort = System.getProperty("rhq.storage.cql-port");
+ for (String node : nodes) {
StorageNode storageNode = new StorageNode();
- storageNode.parseNodeInformation(seedInfo);
+ storageNode.setAddress(node);
+ storageNode.setCqlPort(Integer.parseInt(cqlPort));
storageNode.setOperationMode(StorageNode.OperationMode.NORMAL);
entityManager.persist(storageNode);
}
@@ -120,9 +122,10 @@ public class StrippedDownStartupBeanPreparation {
// caused some arquillian deployment exception.
//
// jsanda
- System.setProperty("rhq.cassandra.username",
props.getProperty("rhq.cassandra.username"));
- System.setProperty("rhq.cassandra.password",
props.getProperty("rhq.cassandra.password"));
- System.setProperty("rhq.cassandra.seeds",
props.getProperty("rhq.cassandra.seeds"));
+ System.setProperty("rhq.storage.username",
props.getProperty("rhq.storage.username"));
+ System.setProperty("rhq.storage.password",
props.getProperty("rhq.storage.password"));
+ System.setProperty("rhq.storage.nodes",
props.getProperty("rhq.storage.nodes"));
+ System.setProperty("rhq.storage.cql-port",
props.getProperty("rhq.storage.cql-port"));
} catch (IOException e) {
throw new RuntimeException(("Failed to load
cassandra-test.properties"));
}
diff --git
a/modules/enterprise/server/itests-2/src/test/resources/cassandra-test.properties
b/modules/enterprise/server/itests-2/src/test/resources/cassandra-test.properties
index 9c6c381..d4185d0 100644
--- a/modules/enterprise/server/itests-2/src/test/resources/cassandra-test.properties
+++ b/modules/enterprise/server/itests-2/src/test/resources/cassandra-test.properties
@@ -1,3 +1,4 @@
-rhq.cassandra.username=${rhq.cassandra.username}
-rhq.cassandra.password =${rhq.cassandra.password}
-rhq.cassandra.seeds=${rhq.cassandra.seeds}
\ No newline at end of file
+rhq.storage.username=${rhq.storage.username}
+rhq.storage.password =${rhq.storage.password}
+rhq.storage.nodes=${rhq.storage.nodes}
+rhq.storage.cql-port=${rhq.storage.cql-port}
\ No newline at end of file
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/StorageNodeManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/StorageNodeManagerBean.java
index a7d9945..b30e50a 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/StorageNodeManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/StorageNodeManagerBean.java
@@ -152,7 +152,7 @@ public class StorageNodeManagerBean implements
StorageNodeManagerLocal, StorageN
@EJB
private StorageNodeManagerLocal storageNodeManger;
-
+
@EJB
private StorageClientManagerBean storageClientManager;
@@ -238,7 +238,6 @@ public class StorageNodeManagerBean implements
StorageNodeManagerLocal, StorageN
StorageNode storageNode = new StorageNode();
storageNode.setAddress(pluginConfig.getSimpleValue(RHQ_STORAGE_ADDRESS_PROPERTY));
storageNode.setCqlPort(Integer.parseInt(pluginConfig.getSimpleValue(RHQ_STORAGE_CQL_PORT_PROPERTY)));
-
storageNode.setJmxPort(Integer.parseInt(pluginConfig.getSimpleValue(RHQ_STORAGE_JMX_PORT_PROPERTY)));
storageNode.setResource(resource);
storageNode.setOperationMode(OperationMode.INSTALLED);
@@ -719,11 +718,14 @@ public class StorageNodeManagerBean implements
StorageNodeManagerLocal, StorageN
Resource storageNodeResource = storageNode.getResource();
Configuration storageNodeConfiguration =
configurationManager.getResourceConfiguration(subject,
storageNodeResource.getId());
+ Configuration storageNodePluginConfiguration =
configurationManager.getPluginConfiguration(subject,
+ storageNodeResource.getId());
configuration.setHeapSize(storageNodeConfiguration.getSimpleValue("maxHeapSize"));
configuration.setHeapNewSize(storageNodeConfiguration.getSimpleValue("heapNewSize"));
configuration.setThreadStackSize(storageNodeConfiguration.getSimpleValue("threadStackSize"));
- configuration.setJmxPort(storageNode.getJmxPort());
+ configuration.setJmxPort(Integer.parseInt(storageNodePluginConfiguration
+ .getSimpleValue(RHQ_STORAGE_JMX_PORT_PROPERTY)));
}
return configuration;
@@ -763,12 +765,7 @@ public class StorageNodeManagerBean implements
StorageNodeManagerLocal, StorageN
parameters);
if (result) {
- //2. Update the JMX port
- //this is a fast operation compared to the restart
- storageNode.setJmxPort(storageNodeConfiguration.getJmxPort());
- entityManager.merge(storageNode);
-
- //3. Update the plugin configuration to talk with the new server
+ //2. Update the plugin configuration to talk with the new server
Configuration storageNodePluginConfig =
configurationManager.getPluginConfiguration(subject,
storageNodeResource.getId());
@@ -855,7 +852,7 @@ public class StorageNodeManagerBean implements
StorageNodeManagerLocal, StorageN
return result;
}
-
+
private boolean runOperationAndWaitForResult(Subject subject, Resource
storageNodeResource, String operationToRun,
Configuration parameters) {
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/storage/StorageClientManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/storage/StorageClientManagerBean.java
index 7f8b0fd..4ec3583 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/storage/StorageClientManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/storage/StorageClientManagerBean.java
@@ -65,8 +65,8 @@ public class StorageClientManagerBean {
private final Log log = LogFactory.getLog(StorageClientManagerBean.class);
- private static final String USERNAME_PROP = "rhq.cassandra.username";
- private static final String PASSWORD_PROP = "rhq.cassandra.password";
+ private static final String USERNAME_PROP = "rhq.storage.username";
+ private static final String PASSWORD_PROP = "rhq.storage.password";
private static final String RHQ_KEYSPACE = "rhq";
@EJB
diff --git
a/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Upgrade.java
b/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Upgrade.java
index 9245baf..d9f63de 100644
---
a/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Upgrade.java
+++
b/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Upgrade.java
@@ -154,7 +154,7 @@ public class Upgrade extends AbstractInstall {
// if the agent already exists in the default location, it may be there from
a prior install.
if (isStorageInstalled() || isServerInstalled()) {
log.warn("RHQ is already installed so upgrade can not be
performed.");
- return;
+ //return;
}
// Stop the agent, if running.
@@ -432,6 +432,42 @@ public class Upgrade extends AbstractInstall {
oldServerProps.setProperty("rhq.server.socket.binding.port.https",
httpsPort);
}
+ //Migrate storage node properties
+ String storageUsername =
oldServerProps.getProperty("rhq.cassandra.username");
+ if (storageUsername != null) {
+ oldServerProps.remove("rhq.cassandra.username");
+ oldServerProps.setProperty("rhq.storage.username",
storageUsername);
+ }
+
+ String storagePassword =
oldServerProps.getProperty("rhq.cassandra.password");
+ if (storagePassword != null) {
+ oldServerProps.remove("rhq.cassandra.password");
+ oldServerProps.setProperty("rhq.storage.password",
storagePassword);
+ }
+
+ String storageSeeds =
oldServerProps.getProperty("rhq.cassandra.seeds");
+ if (storageSeeds != null) {
+ StringBuffer storageNodes = new StringBuffer();
+ String cqlPort = "";
+
+ String[] unparsedNodes = storageSeeds.split(",");
+ for (int index = 0; index < unparsedNodes.length; index++) {
+ String[] params = unparsedNodes[index].split("\\|");
+ if (params.length == 3) {
+ storageNodes.append(params[0]);
+ if (index < unparsedNodes.length - 1) {
+ storageNodes.append(",");
+ }
+
+ cqlPort = params[2];
+ }
+ }
+
+ oldServerProps.remove("rhq.cassandra.seeds");
+ oldServerProps.setProperty("rhq.storage.nodes",
storageNodes.toString());
+ oldServerProps.setProperty("rhq.storage.cql-port", cqlPort);
+ }
+
// copy the old key/truststore files from the old location to the new server
configuration directory
copyReferredFile(commandLine, oldServerProps,
"rhq.server.tomcat.security.keystore.file");
copyReferredFile(commandLine, oldServerProps,
"rhq.server.tomcat.security.truststore.file");
diff --git
a/modules/plugins/rhq-storage/src/test/java/org/rhq/plugins/storage/StorageNodeComponentITest.java
b/modules/plugins/rhq-storage/src/test/java/org/rhq/plugins/storage/StorageNodeComponentITest.java
index 7f07be9..a02c63a 100644
---
a/modules/plugins/rhq-storage/src/test/java/org/rhq/plugins/storage/StorageNodeComponentITest.java
+++
b/modules/plugins/rhq-storage/src/test/java/org/rhq/plugins/storage/StorageNodeComponentITest.java
@@ -147,11 +147,12 @@ public class StorageNodeComponentITest {
assertEquals(results.getExitCode(), (Integer) 0, "Cassandra failed to start:
" + results.getCapturedOutput());
StorageNode storageNode = new StorageNode();
- storageNode.parseNodeInformation("127.0.0.1|7399|9142");
+ storageNode.setAddress("127.0.0.1");
+ int jmxPort = 7399;
+ storageNode.setCqlPort(9142);
ClusterInitService clusterInitService = new ClusterInitService();
- clusterInitService.waitForClusterToStart(new String[] { storageNode.getAddress()
},
- new int[] { storageNode.getJmxPort() });
+ clusterInitService.waitForClusterToStart(new String[] { storageNode.getAddress()
}, new int[] { jmxPort });
SchemaManager schemaManager = new SchemaManager("rhqadmin",
"1eeb2f255e832171df8592078de921bc",
new String[] { storageNode.getAddress() }, storageNode.getCqlPort());