modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeComponent.java
| 15 +++++---
modules/plugins/rhq-storage/src/main/java/org/rhq/plugins/storage/StorageNodeComponent.java
| 18 ++++++++++
2 files changed, 28 insertions(+), 5 deletions(-)
New commits:
commit 1231cc220f34fc804e17f99156138973b8a0c6e1
Author: John Sanda <jsanda(a)redhat.com>
Date: Sun Jun 2 23:39:35 2013 -0400
adding support to update seeds property in addNodeMaintenance resource operation
There is an issue in how the yaml document is serialized. It fails to parse.
I am relying on the Cassandra config classes for reading/writing the yaml
config file; so, we may have to explore an alternative approach. Cassandra
reads but does not write the yaml file, and we are having problems with
how the file is being written.
diff --git
a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeComponent.java
b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeComponent.java
index b756f10..9bfb1b0 100644
---
a/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeComponent.java
+++
b/modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeComponent.java
@@ -234,12 +234,8 @@ public class CassandraNodeComponent extends
JMXServerComponent<ResourceComponent
}
protected OperationResult updateSeedsList(Configuration params) {
- List<String> addresses = new ArrayList<String>();
PropertyList list = params.getList("seedsList");
- for (Property property : list.getList()) {
- PropertySimple simple = (PropertySimple) property;
- addresses.add(simple.getStringValue());
- }
+ List<String> addresses = getAddresses(list);
OperationResult result = new OperationResult();
try {
@@ -252,6 +248,15 @@ public class CassandraNodeComponent extends
JMXServerComponent<ResourceComponent
return result;
}
+ protected List<String> getAddresses(PropertyList seedsList) {
+ List<String> addresses = new ArrayList<String>();
+ for (Property property : seedsList.getList()) {
+ PropertySimple simple = (PropertySimple) property;
+ addresses.add(simple.getStringValue());
+ }
+ return addresses;
+ }
+
protected void updateSeedsList(List<String> addresses) throws IOException {
ResourceContext<?> context = getResourceContext();
Configuration pluginConfig = context.getPluginConfiguration();
diff --git
a/modules/plugins/rhq-storage/src/main/java/org/rhq/plugins/storage/StorageNodeComponent.java
b/modules/plugins/rhq-storage/src/main/java/org/rhq/plugins/storage/StorageNodeComponent.java
index 88b76c1..a6b5e48 100644
---
a/modules/plugins/rhq-storage/src/main/java/org/rhq/plugins/storage/StorageNodeComponent.java
+++
b/modules/plugins/rhq-storage/src/main/java/org/rhq/plugins/storage/StorageNodeComponent.java
@@ -25,6 +25,8 @@
package org.rhq.plugins.storage;
+import java.util.List;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.mc4j.ems.connection.EmsConnection;
@@ -99,6 +101,22 @@ public class StorageNodeComponent extends CassandraNodeComponent
implements Oper
resultsList.add(toPropertyMap(opResult));
// update seeds list...
+ List<String> addresses =
getAddresses(params.getList("seedsList"));
+ try {
+ opResult = new OpResult();
+ opResult.operation = "Update seeds list";
+ updateSeedsList(addresses);
+ opResult.succeeded = true;
+ } catch (Exception e) {
+ log.error("An error occurred while updating the seeds lists for " +
getResourceContext().getResourceKey(),
+ e);
+ opResult.succeeded = false;
+
+ Throwable rootCause = ThrowableUtil.getRootCause(e);
+ opResult.details = "An error occurred while updating the seeds list:
" +
+ ThrowableUtil.getStackAsString(rootCause);
+ }
+ resultsList.add(toPropertyMap(opResult));
resultConfig.put(resultsList);
Show replies by date