etc/scripts/rhq48-storage-patch/rhq48-storage-patch.sh
| 42 +
modules/common/cassandra-ccm/cassandra-ccm-core/src/main/java/org/rhq/cassandra/Deployer.java
| 44 +-
modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/metadata/PluginMetadataParser.java
| 44 +-
modules/core/client-api/src/test/java/org/rhq/core/clientapi/agent/metadata/test/ExtensionModelTest.java
| 2
modules/core/client-api/src/test/java/org/rhq/core/clientapi/agent/metadata/test/NestedSubCategoriesMetadataParserTest.java
| 159 +++++++
modules/core/client-api/src/test/resources/test-hibernate.xml
| 8
modules/core/client-api/src/test/resources/test-jbossas.xml
| 10
modules/core/client-api/src/test/resources/test-subcategories-nested.xml
| 60 ++
modules/core/domain/src/main/java/org/rhq/core/domain/cloud/StorageNodeLoadComposite.java
| 58 +-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/storage/StorageNodeDatasource.java
| 32 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/storage/StorageNodeLoadComponent.java
| 5
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/table/MetricsTableView.java
| 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/table/MetricsViewDataSource.java
| 2
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
| 1
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties
| 1
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
| 1
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties
| 1
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ko.properties
| 1
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties
| 1
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties
| 1
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties
| 1
modules/enterprise/server/appserver/pom.xml
| 11
modules/enterprise/server/appserver/src/main/bin-resources/bin/wrapper/rhq-storage-wrapper.conf
| 36 -
modules/enterprise/server/appserver/src/main/bin-resources/bin/wrapper/rhq-storage-wrapper.env
| 24 +
modules/enterprise/server/appserver/src/main/dev-resources/bin/wrapper/rhq-storage-wrapper.inc
| 6
modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml
| 11
modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/ldap/FakeLdapContext.java
| 37 -
modules/enterprise/server/jar/intentional-api-changes-since-4.8.0.xml
| 14
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/StorageNodeManagerBean.java
| 83 ++-
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/StorageNodeManagerLocal.java
| 42 +
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/StorageNodeManagerRemote.java
| 17
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/LdapGroupManagerBean.java
| 1
modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/AbstractInstall.java
| 66 ++-
modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Install.java
| 18
modules/plugins/cassandra/src/main/java/org/rhq/plugins/cassandra/CassandraNodeComponent.java
| 15
modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml
| 2
modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/domain/DomainServerComponentTest.java
| 7
modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/domain/SecurityModuleOptionsTest.java
| 12
modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/StandaloneServerComponentTest.java
| 7
modules/plugins/rhq-storage/pom.xml
| 113 +++++
modules/plugins/rhq-storage/src/main/java/org/rhq/plugins/storage/StorageNodeComponent.java
| 148 ++++++
modules/plugins/rhq-storage/src/main/java/org/rhq/plugins/storage/StorageNodeConfigDelegate.java
| 142 ++++--
modules/plugins/rhq-storage/src/main/resources/META-INF/rhq-plugin.xml
| 13
modules/plugins/rhq-storage/src/test/java/org/rhq/plugins/storage/StorageNodeComponentITest.java
| 216 ++++++++++
modules/plugins/rhq-storage/src/test/resources/log4j.properties
| 42 +
pom.xml
| 6
46 files changed, 1387 insertions(+), 178 deletions(-)
New commits:
commit 18fd1fb33345694e18ae21d0f3632a8b8a34d376
Merge: 05024a9 b537244
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Tue Jul 23 21:33:31 2013 -0700
Merge branch 'master' into mtho11/consolidated-metrics
commit 05024a983a883423e6680ee0efcaa47445614666
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Tue Jul 23 17:56:20 2013 -0700
i18n the consolidated metrics
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/table/MetricsTableView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/table/MetricsTableView.java
index 8797d59..010e06f 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/table/MetricsTableView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/table/MetricsTableView.java
@@ -116,7 +116,7 @@ public class MetricsTableView extends
Table<MetricsViewDataSource> implements Re
setListGridFields(fields.toArray(new ListGridField[0]));
addTableAction(MSG.view_measureTable_getLive(), new
ShowLiveDataTableAction(this));
- addExtraWidget(addToDashboardMenu, false);
+ //addExtraWidget(addToDashboardMenu, false);
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/table/MetricsViewDataSource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/table/MetricsViewDataSource.java
index 431e076..fbb9bff 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/table/MetricsViewDataSource.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/table/MetricsViewDataSource.java
@@ -78,7 +78,7 @@ public class MetricsViewDataSource extends
RPCDataSource<MetricDisplaySummary, C
public ArrayList<ListGridField> getListGridFields() {
ArrayList<ListGridField> fields = new ArrayList<ListGridField>(7);
- ListGridField sparklineField = new ListGridField(FIELD_SPARKLINE,
"chart");
+ ListGridField sparklineField = new ListGridField(FIELD_SPARKLINE,
MSG.chart_metrics_sparkline_header());
sparklineField.setCellFormatter(new CellFormatter() {
@Override
public String format(Object value, ListGridRecord record, int rowNum, int
colNum) {
diff --git
a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
index cf54939..abcfa62 100644
---
a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
+++
b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
@@ -23,6 +23,7 @@ chart_ie_not_supported = Charting is not available for this browser.
chart_metrics= Metrics
chart_metrics_collapse_tooltip= Click here to see additional tabular availability data.
chart_metrics_expand_tooltip= Click here to collapse additional availability detail.
+chart_metrics_sparkline_header= Chart
chart_no_data_label = No Data
chart_single_value_label = Value
chart_slider_button_bar_day = Day
diff --git
a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties
b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties
index ac8a91e..3a79eeb 100644
---
a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties
+++
b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties
@@ -51,6 +51,7 @@ chart_hover_time_format = %H:%M:%S
##chart_metrics= Metrics
##chart_metrics_collapse_tooltip= Click here to see additional tabular availability
data.
##chart_metrics_expand_tooltip= Click here to collapse additional availability detail.
+##chart_metrics_sparkline_header= Chart
##chart_no_data_label = No Data
##chart_single_value_label = Value
##chart_slider_button_bar_day = Day
diff --git
a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
index a775ed1..e79504c 100644
---
a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
+++
b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
@@ -26,6 +26,7 @@ chart_ie_not_supported = Charting ist bei diesem Browser nicht
unterstützt
##chart_metrics= Metrics
##chart_metrics_collapse_tooltip= Click here to see additional tabular availability
data.
##chart_metrics_expand_tooltip= Click here to collapse additional availability detail.
+##chart_metrics_sparkline_header= Chart
chart_no_data_label = Keine Daten vorhanden
##chart_single_value_label = Value
chart_slider_button_bar_day = Tag
diff --git
a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties
b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties
index cf88ed6..3f1f701 100644
---
a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties
+++
b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties
@@ -27,6 +27,7 @@
##chart_metrics= Metrics
##chart_metrics_collapse_tooltip= Click here to see additional tabular availability
data.
##chart_metrics_expand_tooltip= Click here to collapse additional availability detail.
+##chart_metrics_sparkline_header= Chart
##chart_no_data_label = No Data
##chart_single_value_label = Value
##chart_slider_button_bar_minute = Min
diff --git
a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ko.properties
b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ko.properties
index 1849bb7..3d40d83 100644
---
a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ko.properties
+++
b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ko.properties
@@ -25,6 +25,7 @@
##chart_metrics= Metrics
##chart_metrics_collapse_tooltip= Click here to see additional tabular availability
data.
##chart_metrics_expand_tooltip= Click here to collapse additional availability detail.
+##chart_metrics_sparkline_header= Chart
##chart_no_data_label = No Data
##chart_single_value_label = Value
##chart_slider_button_bar_minute = Min
diff --git
a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties
b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties
index 517c787..de43fa4 100644
---
a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties
+++
b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties
@@ -24,6 +24,7 @@
##chart_metrics= Metrics
##chart_metrics_collapse_tooltip= Click here to see additional tabular availability
data.
##chart_metrics_expand_tooltip= Click here to collapse additional availability detail.
+##chart_metrics_sparkline_header= Chart
##chart_no_data_label = No Data
##chart_single_value_label = Value
##chart_slider_button_bar_minute = Min
diff --git
a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties
b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties
index 6311cef..669d8d6 100644
---
a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties
+++
b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties
@@ -24,6 +24,7 @@
##chart_metrics= Metrics
##chart_metrics_collapse_tooltip= Click here to see additional tabular availability
data.
##chart_metrics_expand_tooltip= Click here to collapse additional availability detail.
+##chart_metrics_sparkline_header= Chart
##chart_no_data_label = No Data
##chart_single_value_label = Value
##chart_slider_button_bar_minute = Min
diff --git
a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties
b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties
index 67006d0..b15023f 100644
---
a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties
+++
b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties
@@ -24,6 +24,7 @@
##chart_metrics= Metrics
##chart_metrics_collapse_tooltip= Click here to see additional tabular availability
data.
##chart_metrics_expand_tooltip= Click here to collapse additional availability detail.
+##chart_metrics_sparkline_header= Chart
##chart_no_data_label = No Data
##chart_single_value_label = Value
##chart_slider_button_bar_minute = Min
commit b537244bad778a80f6fdf92880abc245eed465ec
Author: John Sanda <jsanda(a)redhat.com>
Date: Tue Jul 23 22:23:06 2013 -0400
initial commit for StorageNodeComponentITest
This is a first stab at some integration tests for the storage plugin.
diff --git a/modules/plugins/rhq-storage/pom.xml b/modules/plugins/rhq-storage/pom.xml
index a88f56e..df79e40 100644
--- a/modules/plugins/rhq-storage/pom.xml
+++ b/modules/plugins/rhq-storage/pom.xml
@@ -10,11 +10,16 @@
<groupId>org.rhq</groupId>
<artifactId>rhq-rhqstorage-plugin</artifactId>
- <packaging>jar</packaging>
<name>RHQ Storage Plugin</name>
<description>A plugin for managing RHQ Storage Nodes</description>
+ <properties>
+ <pc.basedir>${project.build.directory}/plugin-container</pc.basedir>
+ <pc.plugins.dir>${pc.basedir}/plugins</pc.plugins.dir>
+ <pc.lib.dir>${pc.basedir}/lib</pc.lib.dir>
+ </properties>
+
<dependencies>
<dependency>
<groupId>${rhq.groupId}</groupId>
@@ -27,7 +32,6 @@
<groupId>${rhq.groupId}</groupId>
<artifactId>rhq-cassandra-plugin</artifactId>
<version>${project.version}</version>
- <!--<scope>provided</scope>-->
</dependency>
<dependency>
@@ -35,8 +39,113 @@
<artifactId>org-mc4j-ems</artifactId>
<scope>provided</scope>
</dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>rhq-cassandra-ccm-core</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>rhq-platform-plugin</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>rhq-cassandra-schema</artifactId>
+ <version>${project.version}</version>
+ </dependency>
</dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <target>
+ <property name="sigar.dir"
value="${project.build.directory/sigar}"/>
+
+ <mkdir dir="${pc.basedir}"/>
+ <mkdir dir="${pc.lib.dir}"/>
+ <mkdir dir="${pc.plugins.dir}"/>
+
+ <copy file="${org.rhq:rhq-platform-plugin:jar}"
todir="${pc.plugins.dir}"/>
+ <copy file="${org.rhq:rhq-jmx-plugin:jar}"
todir="${pc.plugins.dir}"/>
+ <copy file="${org.rhq:rhq-cassandra-plugin:jar}"
todir="${pc.plugins.dir}"/>
+ <copy
file="${project.build.directory}/${project.build.finalName}.jar"
todir="${pc.plugins.dir}"/>
+
+ <unzip src="${org.hyperic:sigar-dist:zip}"
dest="${sigar.dir}">
+ <patternset>
+ <include name="**/lib/sigar.jar" />
+ <include name="**/lib/bcel*.jar" />
+ <include name="**/lib/*.so" />
+ <include name="**/lib/*.sl" />
+ <include name="**/lib/*.dll" />
+ <include name="**/lib/*.dylib" />
+ </patternset>
+ </unzip>
+ <move todir="${pc.lib.dir}" flatten="true">
+ <fileset dir="${sigar.dir}"
includes="**/lib/*"/>
+ </move>
+ <delete dir="${sigar.dir}"/>
+ </target>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <version>2.13</version>
+ <executions>
+ <execution>
+ <id>integration-test</id>
+ <goals>
+ <goal>integration-test</goal>
+ </goals>
+ <configuration>
+ <includes>
+ <include>**/*ITest.java</include>
+ </includes>
+ <argLine>-Djava.library.path=${pc.lib.dir}</argLine>
+ <systemPropertyVariables>
+ <pc.plugins.dir>${pc.plugins.dir}</pc.plugins.dir>
+ </systemPropertyVariables>
+ </configuration>
+ </execution>
+ <execution>
+ <id>verify</id>
+ <goals>
+ <goal>verify</goal>
+ </goals>
+ <configuration>
+ <testFailureIgnore>false</testFailureIgnore>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <excludes>
+ <exclude>**/*ITest.java</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
<profiles>
<profile>
<id>dev</id>
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
new file mode 100644
index 0000000..cd9f148
--- /dev/null
+++
b/modules/plugins/rhq-storage/src/test/java/org/rhq/plugins/storage/StorageNodeComponentITest.java
@@ -0,0 +1,216 @@
+package org.rhq.plugins.storage;
+
+import static java.util.Arrays.asList;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+
+import java.io.File;
+import java.net.InetAddress;
+import java.util.Set;
+
+import com.google.common.collect.Sets;
+
+import org.testng.annotations.AfterSuite;
+import org.testng.annotations.BeforeSuite;
+import org.testng.annotations.Test;
+
+import org.rhq.cassandra.CassandraClusterManager;
+import org.rhq.cassandra.ClusterInitService;
+import org.rhq.cassandra.Deployer;
+import org.rhq.cassandra.DeploymentOptions;
+import org.rhq.cassandra.DeploymentOptionsFactory;
+import org.rhq.cassandra.schema.SchemaManager;
+import org.rhq.core.clientapi.server.discovery.InventoryReport;
+import org.rhq.core.domain.cloud.StorageNode;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.measurement.Availability;
+import org.rhq.core.domain.measurement.AvailabilityType;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.pc.PluginContainer;
+import org.rhq.core.pc.PluginContainerConfiguration;
+import org.rhq.core.pc.inventory.InventoryManager;
+import org.rhq.core.pc.operation.OperationContextImpl;
+import org.rhq.core.pc.operation.OperationManager;
+import org.rhq.core.pc.operation.OperationServicesAdapter;
+import org.rhq.core.pc.plugin.FileSystemPluginFinder;
+import org.rhq.core.pluginapi.operation.OperationServicesResult;
+import org.rhq.core.pluginapi.operation.OperationServicesResultCode;
+import org.rhq.core.pluginapi.util.ProcessExecutionUtility;
+import org.rhq.core.system.ProcessExecution;
+import org.rhq.core.system.ProcessExecutionResults;
+import org.rhq.core.system.SystemInfo;
+import org.rhq.core.system.SystemInfoFactory;
+
+/**
+ * @author John Sanda
+ */
+public class StorageNodeComponentITest {
+
+ private File basedir;
+
+ private Resource storageNode;
+
+ @BeforeSuite
+ public void deployStorageNodeAndPluginContainer() throws Exception {
+ basedir = new File("target", "rhq-storage");
+
+ deployStorageNode();
+
+ initPluginContainer();
+ }
+
+ private void deployStorageNode() throws Exception {
+ DeploymentOptionsFactory factory = new DeploymentOptionsFactory();
+ DeploymentOptions deploymentOptions = factory.newDeploymentOptions();
+ String address = "127.0.0.1";
+
+ deploymentOptions.setSeeds(address);
+ deploymentOptions.setListenAddress(address);
+ deploymentOptions.setRpcAddress(address);
+ deploymentOptions.setBasedir(basedir.getAbsolutePath());
+ deploymentOptions.setCommitLogDir(new File(basedir,
"commit_log").getAbsolutePath());
+ deploymentOptions.setDataDir(new File(basedir,
"data").getAbsolutePath());
+ deploymentOptions.setSavedCachesDir(new File(basedir,
"saved_caches").getAbsolutePath());
+ deploymentOptions.setCommitLogDir(new File(basedir,
"logs").getAbsolutePath());
+ deploymentOptions.setLoggingLevel("DEBUG");
+ deploymentOptions.setNativeTransportPort(9142);
+ deploymentOptions.setJmxPort(7399);
+ deploymentOptions.setHeapSize("256M");
+ deploymentOptions.setHeapNewSize("64M");
+
+ deploymentOptions.load();
+
+ Deployer deployer = new Deployer();
+ deployer.setDeploymentOptions(deploymentOptions);
+
+ deployer.unzipDistro();
+ deployer.applyConfigChanges();
+ deployer.updateFilePerms();
+ deployer.updateStorageAuthConf(Sets.newHashSet(InetAddress.getByName(address)));
+
+ File binDir = new File(basedir, "bin");
+ SystemInfo systemInfo = SystemInfoFactory.createSystemInfo();
+
+ File startScript = new File(binDir, "cassandra");
+ ProcessExecution startScriptExe =
ProcessExecutionUtility.createProcessExecution(startScript);
+
+ startScriptExe.addArguments(asList("-p", "cassandra.pid"));
+ startScriptExe.setCaptureOutput(true);
+ ProcessExecutionResults results = systemInfo.executeProcess(startScriptExe);
+
+ assertEquals(results.getExitCode(), (Integer) 0, "Cassandra failed to start:
" + results.getCapturedOutput());
+
+ StorageNode storageNode = new StorageNode();
+ storageNode.parseNodeInformation("127.0.0.1|7399|9142");
+
+ ClusterInitService clusterInitService = new ClusterInitService();
+ clusterInitService.waitForClusterToStart(asList(storageNode));
+
+ SchemaManager schemaManager = new SchemaManager("rhqadmin",
"rhqadmin", "127.0.0.1|7399|9142");
+ schemaManager.install();
+ schemaManager.updateTopology(true);
+ }
+
+ private void initPluginContainer() {
+ PluginContainerConfiguration pcConfig = new PluginContainerConfiguration();
+ File pluginsDir = new File(System.getProperty("pc.plugins.dir"));
+ pcConfig.setPluginDirectory(pluginsDir);
+ pcConfig.setPluginFinder(new FileSystemPluginFinder(pluginsDir));
+
+ pcConfig.setInsideAgent(false);
+ PluginContainer.getInstance().setConfiguration(pcConfig);
+ PluginContainer.getInstance().initialize();
+ }
+
+ @AfterSuite
+ public void ShutdownPluginContainerAndStorageNode() throws Exception {
+ PluginContainer.getInstance().shutdown();
+ shutdownStorageNodeIfNecessary();
+ }
+
+ private void shutdownStorageNodeIfNecessary() throws Exception {
+ File binDir = new File(basedir, "bin");
+ File pidFile = new File(binDir, "cassandra.pid");
+
+ if (pidFile.exists()) {
+ CassandraClusterManager ccm = new CassandraClusterManager();
+ ccm.killNode(basedir);
+ }
+ }
+
+ @Test
+ public void discoverStorageNode() {
+ InventoryManager inventoryManager =
PluginContainer.getInstance().getInventoryManager();
+ InventoryReport inventoryReport =
inventoryManager.executeServerScanImmediately();
+
+ if (inventoryReport.getAddedRoots().isEmpty()) {
+ // could be empty if the storage node is already in inventory from
+ // a prior discovery scan.
+ Resource platform = inventoryManager.getPlatform();
+ storageNode = findCassandraNode(platform.getChildResources());
+ } else {
+ storageNode = findCassandraNode(inventoryReport.getAddedRoots());
+ }
+
+ assertNotNull(storageNode, "Failed to discover Storage Node
instance");
+ assertNodeIsUp("Expected " + storageNode + " to be UP after
discovery");
+ }
+
+ @Test(dependsOnMethods = "discoverStorageNode")
+ public void shutdownStorageNode() throws Exception {
+ OperationManager operationManager =
PluginContainer.getInstance().getOperationManager();
+ OperationServicesAdapter operationsService = new
OperationServicesAdapter(operationManager);
+
+ long timeout = 1000 * 60;
+ OperationContextImpl operationContext = new
OperationContextImpl(storageNode.getId());
+ OperationServicesResult result =
operationsService.invokeOperation(operationContext, "shutdown",
+ new Configuration(), timeout);
+
+ assertEquals(result.getResultCode(), OperationServicesResultCode.SUCCESS,
"The shutdown operation failed");
+ // TODO why is this failing?
+ assertNodeIsDown("Expected " + storageNode + " to be DOWN after
shutting it down");
+ }
+
+ private void assertNodeIsUp(String msg) {
+ executeAvailabilityScan();
+
+ Availability availability = getAvailability();
+
+ assertNotNull(availability, "Unable to determine availability for " +
storageNode);
+ assertEquals(availability.getAvailabilityType(), AvailabilityType.UP, msg);
+ }
+
+ private void assertNodeIsDown(String msg) {
+ executeAvailabilityScan();
+
+ Availability availability = getAvailability();
+
+ assertNotNull(availability, "Unable to determine availability for " +
storageNode);
+ assertEquals(availability.getAvailabilityType(), AvailabilityType.DOWN, msg);
+ }
+
+ private Availability getAvailability() {
+ InventoryManager inventoryManager =
PluginContainer.getInstance().getInventoryManager();
+ return inventoryManager.getAvailabilityIfKnown(storageNode);
+ }
+
+ private void executeAvailabilityScan() {
+ InventoryManager inventoryManager =
PluginContainer.getInstance().getInventoryManager();
+ inventoryManager.executeAvailabilityScanImmediately(false, true);
+ }
+
+ private Resource findCassandraNode(Set<Resource> resources) {
+ for (Resource resource : resources) {
+ if (isCassandraNode(resource.getResourceType())) {
+ return resource;
+ }
+ }
+ return null;
+ }
+
+ private boolean isCassandraNode(ResourceType type) {
+ return type.getPlugin().equals("RHQStorage") &&
type.getName().equals("RHQ Storage Node");
+ }
+
+}
diff --git a/modules/plugins/rhq-storage/src/test/resources/log4j.properties
b/modules/plugins/rhq-storage/src/test/resources/log4j.properties
new file mode 100644
index 0000000..67db049
--- /dev/null
+++ b/modules/plugins/rhq-storage/src/test/resources/log4j.properties
@@ -0,0 +1,42 @@
+#
+# /*
+# * RHQ Management Platform
+# * Copyright (C) 2005-2012 Red Hat, Inc.
+# * All rights reserved.
+# *
+# * This program is free software; you can redistribute it and/or modify
+# * it under the terms of the GNU General Public License, version 2, as
+# * published by the Free Software Foundation, and/or the GNU Lesser
+# * General Public License, version 2.1, also as published by the Free
+# * Software Foundation.
+# *
+# * This program is distributed in the hope that it will be useful,
+# * but WITHOUT ANY WARRANTY; without even the implied warranty of
+# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# * GNU General Public License and the GNU Lesser General Public License
+# * for more details.
+# *
+# * You should have received a copy of the GNU General Public License
+# * and the GNU Lesser General Public License along with this program;
+# * if not, write to the Free Software Foundation, Inc.,
+# * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+# */
+#
+
+log4j.rootCategory=WARN, FILE, CONSOLE
+
+log4j.appender.FILE=org.apache.log4j.DailyRollingFileAppender
+log4j.appender.FILE.DatePattern='.'yyyy-MM-dd
+log4j.appender.FILE.File=./target/test.log
+log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
+log4j.appender.FILE.layout.ConversionPattern=%d{ABSOLUTE} %-5p %c %m%n
+#log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
+log4j.appender.FILE.Append=false
+
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+#log4j.appender.CONSOLE.layout.ConversionPattern=%5p %d{HH:mm:ss,SSS} %m%n
+log4j.appender.CONSOLE.layout.ConversionPattern=%d{ABSOLUTE} %-5p %c %m%n
+
+log4j.logger.org.rhq=DEBUG
+log4j.logger.com.datastax=DEBUG
commit 83e5b228871c9a8352e98a12e0db76f8f4ea982e
Author: John Sanda <jsanda(a)redhat.com>
Date: Tue Jul 23 22:16:41 2013 -0400
first stab at prepareForBootstrap operation (which is currently broken)
This is clearly broken from some manual testing I did. Given that the
implementation is a bit sloppy at the moment, this is a good time to get some
automated tests in place. The operation will perform the following steps in the
ordered specified:
1) shut down the storage node
2) update cassandra.yaml
3) update rhq-storage-auth.conf
4) restart the node
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 0037bfe..f76da22 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
@@ -111,7 +111,7 @@ public class CassandraNodeComponent extends
JMXServerComponent<ResourceComponent
clusterBuilder = clusterBuilder.withCredentials(username, password);
}
- this.cassandraSession = clusterBuilder.build().connect(clusterName);
+// this.cassandraSession = clusterBuilder.build().connect(clusterName);
} catch (Exception e) {
LOG.error("Connect to Cassandra " + host + ":" +
nativePort, e);
throw e;
@@ -196,7 +196,17 @@ public class CassandraNodeComponent extends
JMXServerComponent<ResourceComponent
operation = storageService.getOperation("drain", emptyParams);
operation.invoke((Object[]) emptyParams);
- ProcessInfo process = context.getNativeProcess();
+ return stopNode();
+ }
+
+ protected OperationResult stopNode() {
+ ProcessInfo process = getResourceContext().getNativeProcess();
+
+ if (processInfo == null) {
+ LOG.warn("Failed to obtain process info. It appears Cassandra is already
shutdown.");
+ return new OperationResult("Failed to obtain process info. It appears
Cassandra is already shutdown.");
+ }
+
long pid = process.getPid();
try {
process.kill("KILL");
@@ -209,6 +219,7 @@ public class CassandraNodeComponent extends
JMXServerComponent<ResourceComponent
}
}
+
protected OperationResult startNode() {
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 3b0aa5b..d9b35b9 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
@@ -26,11 +26,15 @@
package org.rhq.plugins.storage;
import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import java.io.StringReader;
+import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import org.apache.commons.logging.Log;
@@ -39,6 +43,8 @@ import org.mc4j.ems.connection.EmsConnection;
import org.mc4j.ems.connection.bean.EmsBean;
import org.mc4j.ems.connection.bean.attribute.EmsAttribute;
import org.mc4j.ems.connection.bean.operation.EmsOperation;
+import org.yaml.snakeyaml.DumperOptions;
+import org.yaml.snakeyaml.Yaml;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
@@ -48,6 +54,7 @@ import org.rhq.core.domain.configuration.PropertyMap;
import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.pluginapi.configuration.ConfigurationFacet;
import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport;
+import org.rhq.core.pluginapi.inventory.ResourceContext;
import org.rhq.core.pluginapi.operation.OperationFacet;
import org.rhq.core.pluginapi.operation.OperationResult;
import org.rhq.core.util.StringUtil;
@@ -96,6 +103,8 @@ public class StorageNodeComponent extends CassandraNodeComponent
implements Oper
return updateConfiguration(parameters);
} else if (name.equals("updateKnownNodes")) {
return updateKnownNodes(parameters);
+ } else if (name.equals("prepareForBootstrap")) {
+ return prepareForBootstrap(parameters);
} else {
return super.invokeOperation(name, parameters);
}
@@ -132,6 +141,18 @@ public class StorageNodeComponent extends CassandraNodeComponent
implements Oper
ipAddresses.add(propertySimple.getStringValue());
}
+ if (updateAuthFile(result, ipAddresses)) return result;
+
+ EmsBean authBean =
getEmsConnection().getBean("org.rhq.cassandra.auth:type=RhqInternodeAuthenticator");
+ EmsOperation emsOperation =
authBean.getOperation("reloadConfiguration");
+ emsOperation.invoke();
+
+ result.setSimpleResult("Successfully updated the set of known
nodes.");
+
+ return result;
+ }
+
+ private boolean updateAuthFile(OperationResult result, Set<String> ipAddresses)
{
log.info("Updating known nodes to " + ipAddresses);
File confDir = new File(getBasedir(), "conf");
@@ -150,7 +171,7 @@ public class StorageNodeComponent extends CassandraNodeComponent
implements Oper
log.error(msg);
result.setErrorMessage(msg);
- return result;
+ return true;
}
}
@@ -161,7 +182,7 @@ public class StorageNodeComponent extends CassandraNodeComponent
implements Oper
"to unexpected error";
log.error(msg, e);
result.setErrorMessage(msg + ": " +
ThrowableUtil.getRootMessage(e));
- return result;
+ return true;
}
try {
@@ -176,18 +197,127 @@ public class StorageNodeComponent extends CassandraNodeComponent
implements Oper
}
result.setErrorMessage("There was an unexpected error while updating
" + authFile + ". Make sure that " +
"it matches " + authBackupFile + " and then reschedule the
operation.");
+ return true;
+ }
+ return false;
+ }
+
+ private OperationResult prepareForBootstrap(Configuration params) {
+ log.info("Preparing " + this + " for bootstrap...");
+
+ ResourceContext context = getResourceContext();
+ OperationResult result = new OperationResult();
+
+ log.info("Stopping storage node");
+ OperationResult stopNodeResult = stopNode();
+ if (stopNodeResult.getErrorMessage() != null) {
+ log.error("Failed to stop storage node " + this + " Cannot
prepare the node for bootstrap which means " +
+ "that the storage node cannot join the cluster. Make sure the
storage node is not running and retry " +
+ "the operation");
+ result.setErrorMessage("Failed to stop storage node. Cannot prepare the
node for bootstrap which means " +
+ "that it cannot join the cluster. Make sure that the node is not
running and retry the operation. " +
+ "Stopping the storage node failed with this error: " +
stopNodeResult.getErrorMessage());
return result;
}
- EmsBean authBean =
getEmsConnection().getBean("org.rhq.cassandra.auth:type=RhqInternodeAuthenticator");
- EmsOperation emsOperation =
authBean.getOperation("reloadConfiguration");
- emsOperation.invoke();
+ Configuration pluginConfig = context.getPluginConfiguration();
+ String yamlProp = pluginConfig.getSimpleValue("yamlConfiguration");
+ File yamlFile = new File(yamlProp);
- result.setSimpleResult("Successfully updated the set of known
nodes.");
+ DumperOptions options = new DumperOptions();
+ options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
+ Yaml yaml = new Yaml(options);
+
+ Map yamlConfig = null;
+ try {
+ yamlConfig = (Map) yaml.load(new FileInputStream(yamlFile));
+ } catch (FileNotFoundException e) {
+ log.error("Failed to load " + yamlFile, e);
+ log.error("Cannot prepare " + this + " for bootstrap. " +
yamlFile + " must exist in order to make the " +
+ "necessary configuration changes.");
+ result.setErrorMessage("Cannot prepare storage node for bootstrap. It
appears that " + yamlFile +
+ " does not exist. Make sure that it exists so that the necessary
configuration changes can be made.");
+
+ return result;
+ }
+
+ purgeDir(getCommitLogDir(yamlConfig));
+ for (File dataDir : getDataDirs(yamlConfig)) {
+ purgeDir(dataDir);
+ }
+ purgeDir(getSavedCachesDir(yamlConfig));
+
+ log.info("Updating cluster settings");
+
+ String address = pluginConfig.getSimpleValue("host");
+ List<String> seeds =
getAddresses(params.getList("storageNodeIPAddresses"));
+ // Make sure this node's address is not in the list; otherwise, it
+ // won't bootstrap properly.
+ seeds.remove(address);
+ try {
+ updateSeedsList(seeds);
+ } catch (IOException e) {
+ log.error("Failed to update seeds property in " + yamlFile, e);
+ result.setErrorMessage("Failed to prepared node for bootstrap due to
unexpected error that occurred " +
+ "while updating seeds property in " + yamlFile +
":\n" + ThrowableUtil.getAllMessages(e));
+ return result;
+ }
+
+ if (updateAuthFile(result, new HashSet<String>(seeds))) {
+ return result;
+ }
+
+ int cqlPort = Integer.parseInt(params.getSimpleValue("cqlPort"));
+ int gossipPort =
Integer.parseInt(params.getSimpleValue("gossipPort"));
+
+ yamlConfig.put("native_transport_port", cqlPort);
+ yamlConfig.put("storage_port", gossipPort);
+
+ try {
+ yaml.dump(yamlConfig, new FileWriter(yamlFile));
+ } catch (IOException e) {
+ log.error("Could not update cluster settings in " + yamlFile, e);
+ result.setErrorMessage("Could not update cluster settings in " +
yamlFile + ":\n" +
+ ThrowableUtil.getAllMessages(e));
+ return result;
+ }
+
+ log.info(this + " is ready to be bootstrap. Restarting storage
node...");
+ OperationResult startResult = startNode();
+ if (startResult.getErrorMessage() != null) {
+ log.error("Failed to restart storage node:\n" +
startResult.getErrorMessage());
+ result.setErrorMessage("Failed to restart storage node:\n" +
startResult.getErrorMessage());
+ } else {
+ result.setSimpleResult("The storage node was succesfully updated is now
bootstrapping into the cluster.");
+ }
return result;
}
+ private void purgeDir(File dir) {
+ log.info("Purging " + dir);
+ FileUtil.purge(dir, true);
+ }
+
+ private File getCommitLogDir(Map yamlConfig) {
+ return new File((String) yamlConfig.get("commitlog_directory"));
+ }
+
+ private List<File> getDataDirs(Map yamlConfig) {
+ List<File> dirs = new ArrayList<File>();
+ List<String> dirNames = (List<String>)
yamlConfig.get("data_file_directories");
+
+ for (String dirName : dirNames) {
+ dirs.add(new File(dirName));
+ }
+
+ return dirs;
+ }
+
+ private File getSavedCachesDir(Map yamlConfig) {
+ return new File((String) yamlConfig.get("saved_caches_directory"));
+ }
+
private OperationResult nodeAdded(Configuration params) {
boolean runRepair = params.getSimple("runRepair").getBooleanValue();
boolean updateSeedsList =
params.getSimple("updateSeedsList").getBooleanValue();
@@ -405,4 +535,10 @@ public class StorageNodeComponent extends CassandraNodeComponent
implements Oper
boolean succeeded;
String details;
}
+
+ @Override
+ public String toString() {
+ return StorageNodeComponent.class.getSimpleName() + "[resourceKey: " +
getResourceContext().getResourceKey() +
+ "]";
+ }
}
diff --git a/modules/plugins/rhq-storage/src/main/resources/META-INF/rhq-plugin.xml
b/modules/plugins/rhq-storage/src/main/resources/META-INF/rhq-plugin.xml
index 1e39d6c..cd84de6 100644
--- a/modules/plugins/rhq-storage/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/rhq-storage/src/main/resources/META-INF/rhq-plugin.xml
@@ -101,6 +101,16 @@
</parameters>
</operation>
+ <operation name="prepareForBootstrap">
+ <parameters>
+ <c:simple-property name="cqlPort" type="integer"
displayName="CQL Port"/>
+ <c:simple-property name="gossipPort" type="integer"/>
+ <c:list-property name="storageNodeIPAddresses"
displayName="Storage Node IP Addresses">
+ <c:simple-property name="storageNodeIPAddress"/>
+ </c:list-property>
+ </parameters>
+ </operation>
+
<operation name="prepareForUpgrade" description="Prepares the
storage node for upgrade (this operation consists of following steps: 1) turning off the
RPC server, 2) turning off the gossiper, 3) taking the snapshot (backuping the data), 4)
invoking the drain operation">
<parameters>
<c:simple-property name="snapshotName" required="false"
type="string" displayName="Snapshot Name"
commit 4fa9f082b2e011b3bde9defe1021248148c4ad40
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Tue Jul 23 15:02:09 2013 -0400
[BZ 984649] fix module metadata.
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 145e3af..82ff294 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
@@ -290,7 +290,7 @@
<delete
file="${jboss.home}/modules/system/layers/base/org/jgroups/main/jgroups-${jgroups.initial.version}.jar.index"
/>
<!-- Update the module metadata to the patched version -->
<replace
file="${jboss.home}/modules/system/layers/base/org/jgroups/main/module.xml"
- token="jgroups-${jgroups.initial.version}.jar"
value="${jgroups.patch.version}"/>
+ token="jgroups-${jgroups.initial.version}.jar"
value="jgroups-${jgroups.patch.version}.jar"/>
<!-- Copy in patched version -->
<copy
file="${settings.localRepository}/org/jgroups/jgroups/${jgroups.patch.version}/jgroups-${jgroups.patch.version}.jar"
toDir="${jboss.home}/modules/system/layers/base/org/jgroups/main"
verbose="true"/>
commit 8203c669b3b3ba5ed5c3ef27f051220da93ea868
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Tue Jul 23 13:37:32 2013 -0400
Upgrading richfaces to latest patched version.
diff --git a/pom.xml b/pom.xml
index 3662bc7..f909033 100644
--- a/pom.xml
+++ b/pom.xml
@@ -135,7 +135,7 @@
<postgresql.version>9.2-1002.jdbc4</postgresql.version>
<h2.version>1.2.139</h2.version>
<jtds.version>1.2.2</jtds.version>
- <richfaces.version>3.3.3.Final</richfaces.version>
+ <richfaces.version>3.3.4.Final</richfaces.version>
<jline.version>0.9.94</jline.version>
<sigar.version>1.6.5.132-5</sigar.version>
<sigar.zip.version>1.6.5</sigar.zip.version>
commit caeb7a5c832334b74f76a265c8028a5697152dda
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Tue Jul 23 12:28:52 2013 -0400
[BZ 984649] update jgroups usage to latest patched version.
diff --git a/modules/enterprise/server/appserver/pom.xml
b/modules/enterprise/server/appserver/pom.xml
index 0a61138..f1a4c7b 100644
--- a/modules/enterprise/server/appserver/pom.xml
+++ b/modules/enterprise/server/appserver/pom.xml
@@ -19,6 +19,8 @@
<properties>
<rhq.dev.data.dir>${rhq.rootDir}/rhq-data</rhq.dev.data.dir>
+ <jgroups.initial.version>3.2.7.Final</jgroups.initial.version>
+ <jgroups.patch.version>3.2.10.Final</jgroups.patch.version>
</properties>
<dependencies>
@@ -72,6 +74,13 @@
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
</dependency>
+
+ <!-- Pull down the patched version of JGroups. See CVE 2013-4112 and BZ 984365
-->
+ <dependency>
+ <groupId>org.jgroups</groupId>
+ <artifactId>jgroups</artifactId>
+ <version>${jgroups.patch.version}</version>
+ </dependency>
</dependencies>
<build>
@@ -157,6 +166,8 @@
<property name="rhq.server.http.port"
value="${rhq.server.http.port}" />
<property name="rhq.server.https.port"
value="${rhq.server.https.port}" />
<property
name="rhq.sync.endpoint-address"
value="${rhq.sync.endpoint-address}" />
+ <property name="jgroups.initial.version"
value="${jgroups.initial.version}" />
+ <property name="jgroups.patch.version"
value="${jgroups.patch.version}" />
</ant>
</target>
</configuration>
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 a81b6cd..145e3af 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
@@ -283,6 +283,17 @@
</resources>
</module>
]]></echo>
+
+ <echo>Updating JGroups module component for EAP to
${jgroups.patch.version}</echo>
+ <!-- Remove the unpatched version -->
+ <delete
file="${jboss.home}/modules/system/layers/base/org/jgroups/main/jgroups-${jgroups.initial.version}.jar"
/>
+ <delete
file="${jboss.home}/modules/system/layers/base/org/jgroups/main/jgroups-${jgroups.initial.version}.jar.index"
/>
+ <!-- Update the module metadata to the patched version -->
+ <replace
file="${jboss.home}/modules/system/layers/base/org/jgroups/main/module.xml"
+ token="jgroups-${jgroups.initial.version}.jar"
value="${jgroups.patch.version}"/>
+ <!-- Copy in patched version -->
+ <copy
file="${settings.localRepository}/org/jgroups/jgroups/${jgroups.patch.version}/jgroups-${jgroups.patch.version}.jar"
+ toDir="${jboss.home}/modules/system/layers/base/org/jgroups/main"
verbose="true"/>
<echo>Generate SSL key for RHQ server - 128-bit key that expires in 20
years</echo>
<property name="jboss.conf.dir"
location="${jboss.home}/standalone/configuration" />
commit cc64adde1d8835f8c000afe2de0746fda5bbd5c1
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Tue Jul 23 08:43:19 2013 -0500
One more place where the previous rebase removed code for the storage node
configuration.
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 31e3bf7..9416c67 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
@@ -643,6 +643,8 @@ public class StorageNodeManagerBean implements
StorageNodeManagerLocal, StorageN
Configuration parameters = new Configuration();
parameters.setSimpleValue("jmxPort",
storageNodeConfiguration.getJmxPort() + "");
parameters.setSimpleValue("heapSize",
storageNodeConfiguration.getHeapSize() + "");
+ parameters.setSimpleValue("heapNewSize",
storageNodeConfiguration.getHeapNewSize() + "");
+ parameters.setSimpleValue("threadStackSize",
storageNodeConfiguration.getThreadStackSize() + "");
boolean updateConfigurationResult = runOperationAndWaitForResult(subject,
storageNodeResource,
UPDATE_CONFIGURATION_OPERATION, parameters);
commit 373a931987b402479df3d02269cc00f4ac88a358
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Tue Jul 23 08:42:49 2013 -0500
Enable the new set of calculated metrics for disk space utilization in the UI and
CLI.
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/cloud/StorageNodeLoadComposite.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/cloud/StorageNodeLoadComposite.java
index 80bfdd6..2c0b8f8 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/cloud/StorageNodeLoadComposite.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/cloud/StorageNodeLoadComposite.java
@@ -41,9 +41,13 @@ public class StorageNodeLoadComposite implements Serializable {
private MeasurementAggregateWithUnits heapUsed;
private MeasurementAggregateWithUnits heapPercentageUsed;
private MeasurementAggregateWithUnits load;
- private MeasurementAggregateWithUnits partitionDiskUsedPercentage;
private MeasurementAggregateWithUnits dataDiskUsed;
private MeasurementAggregate tokens;
+
+ private MeasurementAggregateWithUnits dataDiskUsedPercentage;
+ private MeasurementAggregateWithUnits totalDiskUsedPercentage;
+ private MeasurementAggregate freeDiskToDataSizeRatio;
+
private MeasurementAggregateWithUnits actuallyOwns;
public StorageNodeLoadComposite() {
@@ -113,35 +117,59 @@ public class StorageNodeLoadComposite implements Serializable {
public void setHeapPercentageUsed(MeasurementAggregateWithUnits heapPercentageUsed)
{
this.heapPercentageUsed = heapPercentageUsed;
}
-
+
/**
* @deprecated use {@link #getPartitionDiskUsedPercentage()
getPartitionDiskUsedPercentage()} instead
- *
+ *
* @return partitionDiskUsedPercentage
*/
public MeasurementAggregateWithUnits getDiskSpacePercentageUsed() {
- return getPartitionDiskUsedPercentage();
+ return getDataDiskUsedPercentage();
}
-
+
/**
* @deprecated use {@link #setPartitionDiskUsedPercentage()
setPartitionDiskUsedPercentage()} instead
- *
+ *
* @param partitionDiskUsedPercentage
*/
- public void setDiskSpacePercentageUsed(MeasurementAggregateWithUnits
partitionDiskUsedPercentage) {
- setPartitionDiskUsedPercentage(partitionDiskUsedPercentage);
+ public void setDiskSpacePercentageUsed(MeasurementAggregateWithUnits
diskUsedPercentage) {
+ setDataDiskUsedPercentage(diskUsedPercentage);
+ }
+
+ /**
+ * @return A computed metric for the percentage of disk space used by data file on
the corresponding partitions.
+ * If multiple data locations are configured then the aggregate is
calculated.
+ */
+ public MeasurementAggregateWithUnits getDataDiskUsedPercentage() {
+ return dataDiskUsedPercentage;
+ }
+
+ public void setDataDiskUsedPercentage(MeasurementAggregateWithUnits
dataDiskUsedPercentage) {
+ this.dataDiskUsedPercentage = dataDiskUsedPercentage;
+ }
+
+ /**
+ * @return A computed metric for the percentage of total (system + Storage Node data
file) disk space used the partitions where data files are stored.
+ * If multiple data locations are configured then the aggregate is
calculated.
+ */
+ public MeasurementAggregateWithUnits getTotalDiskUsedPercentage() {
+ return totalDiskUsedPercentage;
+ }
+
+ public void setTotalDiskUsedPercentage(MeasurementAggregateWithUnits
totalDiskUsedPercentage) {
+ this.totalDiskUsedPercentage = totalDiskUsedPercentage;
}
/**
- * @return A computed metric for the percentage of disk space used on the partition
that contains the SSTables.
- * If multiple data locations are configured then the partition with the
highest utilization will be reported.
+ * @return A computed metric for the percentage of total (system + Storage Node data
file) disk space used the partitions where data files are stored.
+ * If multiple data locations are configured then the aggregate is
calculated.
*/
- public MeasurementAggregateWithUnits getPartitionDiskUsedPercentage() {
- return partitionDiskUsedPercentage;
+ public MeasurementAggregate getFreeDiskToDataSizeRatio() {
+ return freeDiskToDataSizeRatio;
}
- public void setPartitionDiskUsedPercentage(MeasurementAggregateWithUnits
partitionDiskUsedPercentage) {
- this.partitionDiskUsedPercentage = partitionDiskUsedPercentage;
+ public void setFreeDiskToDataSizeRatio(MeasurementAggregate freeDiskToDataSizeRatio)
{
+ this.freeDiskToDataSizeRatio = freeDiskToDataSizeRatio;
}
/**
@@ -202,7 +230,7 @@ public class StorageNodeLoadComposite implements Serializable {
builder.append("heapUsed=").append(heapUsed).append(", ");
builder.append("heapPercentageUsed=").append(heapPercentageUsed).append(",
");
builder.append("load=").append(load).append(", ");
-
builder.append("partitionDiskUsedPercentage=").append(partitionDiskUsedPercentage).append(",
");
+
builder.append("dataUsedPercentage=").append(dataDiskUsedPercentage).append(",
");
builder.append("dataDiskUsed=").append(dataDiskUsed).append(",
");
builder.append("tokens=").append(tokens).append(", ");
builder.append("actuallyOwns=").append(actuallyOwns);
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/storage/StorageNodeDatasource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/storage/StorageNodeDatasource.java
index 7d413fd..07064b7 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/storage/StorageNodeDatasource.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/storage/StorageNodeDatasource.java
@@ -47,6 +47,7 @@ import org.rhq.core.domain.cloud.StorageNode.OperationMode;
import org.rhq.core.domain.cloud.StorageNodeLoadComposite;
import org.rhq.core.domain.cloud.StorageNodeLoadComposite.MeasurementAggregateWithUnits;
import org.rhq.core.domain.criteria.StorageNodeCriteria;
+import org.rhq.core.domain.measurement.MeasurementAggregate;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.core.domain.util.PageOrdering;
@@ -200,7 +201,8 @@ public class StorageNodeDatasource extends
RPCDataSource<StorageNode, StorageNod
public static class StorageNodeLoadCompositeDatasource extends
RPCDataSource<StorageNodeLoadComposite, StorageNodeCriteria> {
public static final String HEAP_PERCENTAGE_KEY = "heapPercentage";
- public static final String DISK_SPACE_PERCENTAGE_KEY =
"diskSpacePercentage";
+ public static final String DATA_DISK_SPACE_PERCENTAGE_KEY =
"dataDiskSpacePercentage";
+ public static final String TOTAL_DISK_SPACE_PERCENTAGE_KEY =
"totalDiskSpacePercentage";
private int id;
public static StorageNodeLoadCompositeDatasource getInstance(int id) {
@@ -296,10 +298,15 @@ public class StorageNodeDatasource extends
RPCDataSource<StorageNode, StorageNod
"This value is calculated by dividing Heap Used by Heap
Maximum.", HEAP_PERCENTAGE_KEY),
Arrays.<Object> asList(loadComposite.getLoad(),
"Load", "Data stored on the node", "load"),
Arrays.<Object> asList(
- loadComposite.getPartitionDiskUsedPercentage(),
- "Disk Space Percent Used",
- "Percentage of total disk space used for the partition that
contains the data files.If multiple data locations are specified then this will report the
average utilization accross all the partitions.",
- DISK_SPACE_PERCENTAGE_KEY),
+ loadComposite.getDataDiskUsedPercentage(),
+ "Data Disk Space Percent Used",
+ "Percentage of disk space used by data files on the
partitions that contain the data files. If multiple data locations are specified then the
aggregate accross all the partitions that contain data files is reported.",
+ DATA_DISK_SPACE_PERCENTAGE_KEY),
+ Arrays.<Object> asList(
+ loadComposite.getTotalDiskUsedPercentage(),
+ "Total Disk Space Percent Used",
+ "Percentage of total disk space used (system and Storage
Node) on the partitions that contain the data files. If multiple data locations are
specified then the aggregate accross all the partitions that contain data files is
reported.",
+ TOTAL_DISK_SPACE_PERCENTAGE_KEY),
Arrays.<Object> asList(
loadComposite.getDataDiskUsed(),
"Total Disk Space Used",
@@ -325,6 +332,21 @@ public class StorageNodeDatasource extends
RPCDataSource<StorageNode, StorageNod
recordsList.add(tokens);
}
+
+ if (loadComposite.getFreeDiskToDataSizeRatio() != null){
+ MeasurementAggregate aggregate =
loadComposite.getFreeDiskToDataSizeRatio();
+
+ ListGridRecord record = new ListGridRecord();
+ record.setAttribute("id",
"freeDiskToDataSizeRatio");
+ record.setAttribute("name", "Free Disk To Data Size
Ratio");
+ record.setAttribute("hover", "Ratio of (Free Disk)/(Data
File Size). A value below 1 is not recommended since a compaction or repair process could
double the amount of disk space used by data files. If multiple data locations are
specified then the aggregate accross all the partitions that contain data files is
reported.");
+ record.setAttribute("min", aggregate.getMin());
+ record.setAttribute("avg", aggregate.getAvg());
+ record.setAttribute("max", aggregate.getMax());
+
+ recordsList.add(record);
+ }
+
ListGridRecord[] records = recordsList.toArray(new
ListGridRecord[recordsList.size()]);
return records;
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/storage/StorageNodeLoadComponent.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/storage/StorageNodeLoadComponent.java
index e8dde9d..e044e4e 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/storage/StorageNodeLoadComponent.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/storage/StorageNodeLoadComponent.java
@@ -51,8 +51,9 @@ public class StorageNodeLoadComponent extends EnhancedVLayout {
@Override
protected String getCellCSSText(ListGridRecord record, int rowNum, int
colNum) {
if ("avg".equals(getFieldName(colNum))
- &&
(StorageNodeLoadCompositeDatasource.HEAP_PERCENTAGE_KEY.equals(record.getAttribute("id"))
|| StorageNodeLoadCompositeDatasource.DISK_SPACE_PERCENTAGE_KEY
- .equals(record.getAttribute("id")))) {
+ &&
(StorageNodeLoadCompositeDatasource.HEAP_PERCENTAGE_KEY.equals(record.getAttribute("id"))
||
+
StorageNodeLoadCompositeDatasource.DATA_DISK_SPACE_PERCENTAGE_KEY.equals(record.getAttribute("id"))
||
+
StorageNodeLoadCompositeDatasource.TOTAL_DISK_SPACE_PERCENTAGE_KEY.equals(record.getAttribute("id"))))
{
if (record.getAttributeAsFloat("avgFloat") > .85) {
return "font-weight:bold; color:#d64949;";
} else if (record.getAttributeAsFloat("avgFloat") > .7)
{
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 fab803b..31e3bf7 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
@@ -253,13 +253,16 @@ public class StorageNodeManagerBean implements
StorageNodeManagerLocal, StorageN
Map<String, Integer> scheduleIdsMap = new HashMap<String,
Integer>();
// get the schedule ids for Storage Service resource
- final String tokensMetric = "Tokens", ownershipMetric =
"Ownership", diskUsedPercentageMetric =
"Calculated.PartitionDiskUsedPercentage";
+ final String tokensMetric = "Tokens", ownershipMetric =
"Ownership";
+ final String dataDiskUsedPercentageMetric =
"Calculated.DataDiskUsedPercentage";
+ final String totalDiskUsedPercentageMetric =
"Calculated.TotalDiskUsedPercentage";
+ final String freeDiskToDataRatioMetric =
"Calculated.FreeDiskToDataSizeRatio";
final String loadMetric = "Load", keyCacheSize =
"KeyCacheSize", rowCacheSize = "RowCacheSize", totalCommitLogSize =
"TotalCommitlogSize";
TypedQuery<Object[]> query = entityManager.<Object[]>
createNamedQuery(
StorageNode.QUERY_FIND_SCHEDULE_IDS_BY_PARENT_RESOURCE_ID_AND_MEASUREMENT_DEFINITION_NAMES,
Object[].class);
query.setParameter("parrentId",
resourceId).setParameter("metricNames",
- Arrays.asList(tokensMetric, ownershipMetric, diskUsedPercentageMetric,
loadMetric, keyCacheSize,
- rowCacheSize, totalCommitLogSize));
+ Arrays.asList(tokensMetric, ownershipMetric, loadMetric, keyCacheSize,
rowCacheSize, totalCommitLogSize,
+ dataDiskUsedPercentageMetric, totalDiskUsedPercentageMetric,
freeDiskToDataRatioMetric));
for (Object[] pair : query.getResultList()) {
scheduleIdsMap.put((String) pair[0], (Integer) pair[1]);
}
@@ -292,10 +295,22 @@ public class StorageNodeManagerBean implements
StorageNodeManagerLocal, StorageN
subject, scheduleId, MeasurementUnits.PERCENTAGE, beginTime,
endTime);
result.setActuallyOwns(ownershipAggregateWithUnits);
}
- if ((scheduleId = scheduleIdsMap.get(diskUsedPercentageMetric)) != null) {
- StorageNodeLoadComposite.MeasurementAggregateWithUnits
diskUsedPercentageAggregateWithUnits = getMeasurementAggregateWithUnits(
+
+ //calculated disk space related metrics
+ if ((scheduleId = scheduleIdsMap.get(dataDiskUsedPercentageMetric)) != null)
{
+ StorageNodeLoadComposite.MeasurementAggregateWithUnits
dataDiskUsedPercentageAggregateWithUnits = getMeasurementAggregateWithUnits(
+ subject, scheduleId, MeasurementUnits.PERCENTAGE, beginTime,
endTime);
+
result.setDataDiskUsedPercentage(dataDiskUsedPercentageAggregateWithUnits);
+ }
+ if ((scheduleId = scheduleIdsMap.get(totalDiskUsedPercentageMetric)) != null)
{
+ StorageNodeLoadComposite.MeasurementAggregateWithUnits
totalDiskUsedPercentageAggregateWithUnits = getMeasurementAggregateWithUnits(
subject, scheduleId, MeasurementUnits.PERCENTAGE, beginTime,
endTime);
-
result.setPartitionDiskUsedPercentage(diskUsedPercentageAggregateWithUnits);
+
result.setDataDiskUsedPercentage(totalDiskUsedPercentageAggregateWithUnits);
+ }
+ if ((scheduleId = scheduleIdsMap.get(freeDiskToDataRatioMetric)) != null) {
+ MeasurementAggregate freeDiskToDataRatioAggregate =
measurementManager.getAggregate(subject,
+ scheduleId, beginTime, endTime);
+ result.setFreeDiskToDataSizeRatio(freeDiskToDataRatioAggregate);
}
if ((scheduleId = scheduleIdsMap.get(loadMetric)) != null) {
diff --git a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml
b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml
index 5bbebed..e95f995 100644
--- a/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/cassandra/src/main/resources/META-INF/rhq-plugin.xml
@@ -188,7 +188,7 @@
<metric property="Calculated.DataDiskUsedPercentage"
displayName="Data File Disk Used Percentage" dataType="measurement"
units="percentage" displayType="summary" description="Percentage
of disk space used by Cassandra data files. The aggregate accross all the partitions will
be reported if multiple data locations are specified. This is a calculated metric derived
from system and Cassandra runtime information."/>
<metric property="Calculated.TotalDiskUsedPercentage"
displayName="Total Disk Used Percentage" dataType="measurement"
units="percentage" displayType="summary" description="Percentage
of total disk space used. The metric acounts overall disk usage (including system files),
not just disk space used by Cassandra. The aggregate accross all the partitions will be
reported if multiple data locations are specified. This is a calculated metric derived
from system and Cassandra runtime information."/>
- <metric property="Calculated.FreeDiskToDataSizeRatio"
displayName="Free Disk to Data Size Ratio" dataType="measurement"
displayType="summary" description="Ratio of (Amount of Free Disk)/(Data
File Size). A value below 1 is not recommended since a compaction or repair process could
double the amount of disk space used by data files. The aggregate accross all the
partitions will be reported if multiple data locations are specified. This is a calculated
metric derived from system and Cassandra runtime information."/>
+ <metric property="Calculated.FreeDiskToDataSizeRatio"
displayName="Free Disk to Data Size Ratio" dataType="measurement"
displayType="summary" description="Ratio of (Free Disk)/(Data File Size). A
value below 1 is not recommended since a compaction or repair process could double the
amount of disk space used by data files. The aggregate accross all the partitions will be
reported if multiple data locations are specified. This is a calculated metric derived
from system and Cassandra runtime information."/>
<metric property="CurrentGenerationNumber" dataType="trait"
displayType="summary" description="Current generation number"/>
<metric property="ExceptionCount" measurementType="trendsup"
dataType="measurement" displayType="summary"
description="Exception Count"/>
commit 6997631e56204db41c9f4902eef1c6210706be3f
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Mon Jul 22 15:14:22 2013 -0500
Add back code used to update storage node configuration tha was lost due to rebase.
This code updates two additional storage node properties added.
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 b32ab5b..fab803b 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
@@ -611,6 +611,8 @@ public class StorageNodeManagerBean implements
StorageNodeManagerLocal, StorageN
storageNodeResource.getId());
configuration.setHeapSize(storageNodeConfiguration.getSimpleValue("maxHeapSize"));
+
configuration.setHeapNewSize(storageNodeConfiguration.getSimpleValue("heapNewSize"));
+
configuration.setThreadStackSize(storageNodeConfiguration.getSimpleValue("threadStackSize"));
configuration.setJmxPort(storageNode.getJmxPort());
}
diff --git a/modules/plugins/rhq-storage/src/main/resources/META-INF/rhq-plugin.xml
b/modules/plugins/rhq-storage/src/main/resources/META-INF/rhq-plugin.xml
index 8156d02..1e39d6c 100644
--- a/modules/plugins/rhq-storage/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/rhq-storage/src/main/resources/META-INF/rhq-plugin.xml
@@ -122,6 +122,9 @@
<operation name="updateConfiguration" description="Updates the node
configuration. Will require a separate server restart for the settings to take
effect.">
<parameters>
<c:simple-property name="heapSize" type="string"
description="The heap size to be used for both -Xms and -Xmx JVM options."/>
+ <c:simple-property name="heapNewSize" type="string"
description="The heap new size to be used be used with -Xmn JVM option."/>
+ <c:simple-property name="threadStackSize" type="integer"
description="The thread stack size. This memory is allocated to each thread off heap.
The
+ value
should be an integer that will be interpreted in kilobytes."/>
<c:simple-property name="jmxPort" type="integer"
description="JMX port JVM option."/>
</parameters>
<results>
commit e85abcf495d6939d876b09bd1de1e71a29af17ec
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Tue Jul 23 10:42:17 2013 +0200
BZ 796480 (and others) add support for subCategory in embedded types (aka
runs-inside)
diff --git
a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/metadata/PluginMetadataParser.java
b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/metadata/PluginMetadataParser.java
index 88dd865..d5ff2ef 100644
---
a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/metadata/PluginMetadataParser.java
+++
b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/metadata/PluginMetadataParser.java
@@ -417,16 +417,56 @@ public class PluginMetadataParser {
return serviceResourceType;
}
- private static void setSubCategory(ResourceDescriptor resourceDescriptor,
ResourceType resourceType)
+ /**
+ * Try to find the subCategory of the p/s/s descriptor in one of the parents
+ *
<subcategories><subcategory>Foo</subcategory></subcategories>
elements and
+ * set it on the resourceType if found.
+ *
+ * It is not enough to look at the direct parents, but we need to also look at the
+ * <runs-inside> types if our type is "embedded" in a different
type.
+ * @param resourceDescriptor Descriptor to get the subCategory attribute from
+ * @param resourceType The type to attach the ResourceSubCategory to.
+ * @throws InvalidPluginDescriptorException If the descriptor.subCategory can not be
found in any parent.
+ */
+ private void setSubCategory(ResourceDescriptor resourceDescriptor, ResourceType
resourceType)
throws InvalidPluginDescriptorException {
String subCatName = resourceDescriptor.getSubCategory();
if (subCatName != null) {
ResourceSubCategory subCat =
SubCategoriesMetadataParser.findSubCategoryOnResourceTypeAncestor(
resourceType, subCatName);
- if (subCat == null)
+
+ // We need to look at resourceDescriptor -> runsInside to see if one of
those defines the
+ // subcategories that we are looking for.
+ if (subCat == null && resourceDescriptor.getRunsInside() != null) {
+ RunsInsideType rit = resourceDescriptor.getRunsInside();
+ List<ParentResourceType> parentResourceTypeList =
rit.getParentResourceType();
+ for (ParentResourceType parentResourceType : parentResourceTypeList) {
+ ResourceType parentType =
getResourceTypeFromPlugin(parentResourceType.getName(),parentResourceType.getPlugin());
+ // check on the parent
+ if (parentType.getChildSubCategories()!=null ) {
+ for (ResourceSubCategory parentSubcat :
parentType.getChildSubCategories()) {
+ if (parentSubcat.getName().equals(subCatName)) {
+ subCat = parentSubcat;
+ break;
+ }
+ }
+ }
+
+ // Not found on runs-inside type look at the ancestor of those
runs-inside types?
+ if (subCat==null) {
+ subCat =
SubCategoriesMetadataParser.findSubCategoryOnResourceTypeAncestor(parentType,subCatName);
+ }
+ if (subCat!=null) {
+ break;
+ }
+ }
+ }
+
+ if (subCat == null) {
throw new InvalidPluginDescriptorException("Resource type [" +
resourceType.getName()
+ "] specified a subcategory (" + subCatName
+ ") that is not defined as a child subcategory of one of its
ancestor resource types.");
+ }
resourceType.setSubCategory(subCat);
}
}
diff --git
a/modules/core/client-api/src/test/java/org/rhq/core/clientapi/agent/metadata/test/ExtensionModelTest.java
b/modules/core/client-api/src/test/java/org/rhq/core/clientapi/agent/metadata/test/ExtensionModelTest.java
index 20e1aa9..2a9595f 100644
---
a/modules/core/client-api/src/test/java/org/rhq/core/clientapi/agent/metadata/test/ExtensionModelTest.java
+++
b/modules/core/client-api/src/test/java/org/rhq/core/clientapi/agent/metadata/test/ExtensionModelTest.java
@@ -226,6 +226,7 @@ public class ExtensionModelTest {
assert jbossServer.getCategory().equals(ResourceCategory.SERVER);
assert jbossServer.getDescription().equals("JBoss Application Server
Description");
assert jbossServer.getParentResourceTypes().size() == 0;
+ assert jbossServer.getChildSubCategories().size() == 2;
assert jbossServer.getChildResourceTypes().size() == 1;
ResourceType embeddedTomcatServer =
jbossServer.getChildResourceTypes().iterator().next();
@@ -263,6 +264,7 @@ public class ExtensionModelTest {
assert hibernateService.getDescription().equals("Hibernate Service
Description");
assert hibernateService.getChildResourceTypes().size() == 0;
assert hibernateService.getParentResourceTypes().size() == 3;
+ assert
hibernateService.getSubCategory().getName().equals("Framework");
ResourceType tomcatServer = metadataManager.getType("TomcatServer",
"Tomcat");
ResourceType jbossServer = metadataManager.getType("JBossASServer",
"JBossAS");
diff --git
a/modules/core/client-api/src/test/java/org/rhq/core/clientapi/agent/metadata/test/NestedSubCategoriesMetadataParserTest.java
b/modules/core/client-api/src/test/java/org/rhq/core/clientapi/agent/metadata/test/NestedSubCategoriesMetadataParserTest.java
new file mode 100644
index 0000000..1cba523
--- /dev/null
+++
b/modules/core/client-api/src/test/java/org/rhq/core/clientapi/agent/metadata/test/NestedSubCategoriesMetadataParserTest.java
@@ -0,0 +1,159 @@
+ /*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2008 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.core.clientapi.agent.metadata.test;
+
+ import java.net.URL;
+ import java.util.List;
+ import java.util.Set;
+
+ import javax.xml.bind.JAXBContext;
+ import javax.xml.bind.Unmarshaller;
+ import javax.xml.bind.util.ValidationEventCollector;
+
+ import org.apache.commons.logging.Log;
+ import org.apache.commons.logging.LogFactory;
+ import org.testng.annotations.BeforeSuite;
+ import org.testng.annotations.Test;
+
+ import org.rhq.core.clientapi.agent.metadata.PluginMetadataManager;
+ import org.rhq.core.clientapi.agent.metadata.SubCategoriesMetadataParser;
+ import org.rhq.core.clientapi.descriptor.AgentPluginDescriptorUtil;
+ import org.rhq.core.clientapi.descriptor.DescriptorPackages;
+ import org.rhq.core.clientapi.descriptor.plugin.PluginDescriptor;
+ import org.rhq.core.clientapi.descriptor.plugin.ResourceDescriptor;
+ import org.rhq.core.clientapi.descriptor.plugin.ServerDescriptor;
+ import org.rhq.core.clientapi.descriptor.plugin.ServiceDescriptor;
+ import org.rhq.core.clientapi.descriptor.plugin.SubCategoryDescriptor;
+ import org.rhq.core.domain.resource.ResourceCategory;
+ import org.rhq.core.domain.resource.ResourceSubCategory;
+ import org.rhq.core.domain.resource.ResourceType;
+
+ /**
+ * @author Charles Crouch
+ * @author Heiko W. Rupp
+ */
+public class NestedSubCategoriesMetadataParserTest {
+ private static final String DESCRIPTOR_FILENAME =
"test-subcategories-nested.xml";
+ private final Log LOG =
LogFactory.getLog(NestedSubCategoriesMetadataParserTest.class);
+
+ private PluginDescriptor pluginDescriptor;
+
+ @BeforeSuite
+ public void loadPluginDescriptor() throws Exception {
+ try {
+ URL descriptorUrl =
this.getClass().getClassLoader().getResource(DESCRIPTOR_FILENAME);
+ LOG.info("Loading plugin descriptor at: " + descriptorUrl);
+
+ JAXBContext jaxbContext =
JAXBContext.newInstance(DescriptorPackages.PC_PLUGIN);
+
+ Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
+ ValidationEventCollector vec = new ValidationEventCollector();
+ unmarshaller.setEventHandler(vec);
+ pluginDescriptor = (PluginDescriptor)
unmarshaller.unmarshal(descriptorUrl.openStream());
+ } catch (Throwable t) {
+ // Catch RuntimeExceptions and Errors and dump their stack trace, because
Surefire will completely swallow them
+ // and throw a cryptic NPE (see
http://jira.codehaus.org/browse/SUREFIRE-157)!
+ t.printStackTrace();
+ throw new RuntimeException(t);
+ }
+ }
+
+ @Test
+ public void parseSingleSubCategory() {
+ List<ServerDescriptor> servers = pluginDescriptor.getServers();
+ ServerDescriptor server0 = servers.get(0);
+ ResourceDescriptor.Subcategories subCategoriesDescriptor =
server0.getSubcategories();
+ assert subCategoriesDescriptor != null : "No subcategories element: "
+ server0.getName();
+
+ List<SubCategoryDescriptor> subCategoryDescriptors =
subCategoriesDescriptor.getSubcategory();
+
+ assert subCategoryDescriptors != null : "No subcategory elements: " +
server0.getName();
+ assert !subCategoryDescriptors.isEmpty() : "No subcategory elements: "
+ server0.getName();
+
+ ResourceSubCategory subCat;
+
+ ResourceType resType = new ResourceType("testResType",
"myplugin", ResourceCategory.SERVER, null);
+ subCat =
SubCategoriesMetadataParser.getSubCategory(subCategoryDescriptors.get(0), resType);
+
+ assert subCat != null : "Null subcategory received from parser";
+ assert subCat.getName().equals("applications") : "Name not read
correctly";
+ assert subCat.getDisplayName().equals("Apps") : "Display name not
read correctly";
+ assert subCat.getDescription().equals("The apps.") : "Description
not read correctly";
+ // getSubCategory is no longer responsible for setting resourcetype information,
that is done in PluginMetadataParser
+ //assert subCat.getResourceType().equals(resType) : "ResourceType not set
correctly";
+
+ }
+
+ @Test
+ public void parseNestedSubCategories() {
+ List<ServerDescriptor> servers = pluginDescriptor.getServers();
+ ServerDescriptor server2 = servers.get(1);
+ assert server2.getName().equals("testServer2");
+ ResourceDescriptor.Subcategories subCategoriesDescriptor =
server2.getSubcategories();
+ assert subCategoriesDescriptor == null : "Unexpected subcategories element:
" + server2.getName();
+ assert server2.getSubCategory().equals("applications");
+
+ List<ServiceDescriptor> services = pluginDescriptor.getServices();
+ ServiceDescriptor service1 = services.get(0);
+ assert service1.getName().equals("testService");
+ assert service1.getSubCategory().equals("applications");
+ }
+
+ @Test
+ public void testParseViaMetaDataManager() throws Exception {
+
+ PluginDescriptor pluginDescriptor;
+
+ URL descriptorUrl =
this.getClass().getClassLoader().getResource(DESCRIPTOR_FILENAME);
+ System.out.println("Loading plugin descriptor at: " + descriptorUrl);
+
+ pluginDescriptor = (PluginDescriptor)
AgentPluginDescriptorUtil.parsePluginDescriptor(descriptorUrl
+ .openStream());
+
+ PluginMetadataManager metadataManager = new PluginMetadataManager();
+ Set<ResourceType> typeSet = metadataManager.loadPlugin(pluginDescriptor);
+ assert typeSet != null : "Got no types!!";
+ assert typeSet.size()==5 : "Expected 5 types, but got " +
typeSet.size();
+
+ ResourceType testService = findType(typeSet,"testService");
+ assert testService.getSubCategory().getName().equals("applications");
+
+ ResourceType testService2 = findType(typeSet,"testService2");
+ assert
testService2.getSubCategory().getName().equals("applications");
+
+ ResourceType testService3 = findType(typeSet,"testService3");
+ assert testService3.getSubCategory().getName().equals("fooBar");
+
+
+ }
+
+ private ResourceType findType(Set<ResourceType> types, String name) {
+ for (ResourceType type : types ) {
+ if (type.getName().equals(name)) {
+ return type;
+ }
+ }
+ assert false : "Type with name " + name + " not found";
+ return null;
+ }
+ }
\ No newline at end of file
diff --git a/modules/core/client-api/src/test/resources/test-hibernate.xml
b/modules/core/client-api/src/test/resources/test-hibernate.xml
index 37a2e03..9051ca2 100644
--- a/modules/core/client-api/src/test/resources/test-hibernate.xml
+++ b/modules/core/client-api/src/test/resources/test-hibernate.xml
@@ -3,7 +3,7 @@
package="org.rhq.plugins.test2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="urn:xmlns:rhq-plugin">
-
+
<depends plugin="JMX" />
<depends plugin="Tomcat" />
<depends plugin="JBossAS" />
@@ -11,11 +11,13 @@
<service name="HibernateService"
discovery="HibernateDiscoveryComponent"
class="HibernateServiceComponent"
- description="Hibernate Service Description">
+ description="Hibernate Service Description"
+ subCategory="Framework"
+ >
<runs-inside>
<parent-resource-type name="TomcatServer"
plugin="Tomcat"/>
<parent-resource-type name="JBossASServer"
plugin="JBossAS"/>
<parent-resource-type name="EmbeddedTomcatServer"
plugin="JBossAS"/>
</runs-inside>
- </service>
+ </service>
</plugin>
\ No newline at end of file
diff --git a/modules/core/client-api/src/test/resources/test-jbossas.xml
b/modules/core/client-api/src/test/resources/test-jbossas.xml
index 4d2602b..8269343 100644
--- a/modules/core/client-api/src/test/resources/test-jbossas.xml
+++ b/modules/core/client-api/src/test/resources/test-jbossas.xml
@@ -12,7 +12,11 @@
discovery="JBossASDiscoveryComponent"
class="JBossASServerComponent"
description="JBoss Application Server Description">
-
+ <subcategories>
+ <subcategory name="Applications" />
+ <subcategory name="Framework" />
+ </subcategories>
+
<operation name="stop" displayName="Stop JBossAS Server"
description="Kills the server" timeout="30">
<parameters>
<c:simple-property name="force"
@@ -29,7 +33,7 @@
required="true"
description="If true, the server is definitely down;
otherwise, the shutdown was issued but it is unclear if it really died"/>
</results>
- </operation>
+ </operation>
<server name="EmbeddedTomcatServer"
description="Embedded Tomcat Web Server Description"
sourcePlugin="Tomcat"
@@ -37,6 +41,6 @@
discovery="JBossASTomcatDiscoveryComponent"
class="JBossASTomcatServerComponent">
</server>
-
+
</server>
</plugin>
\ No newline at end of file
diff --git a/modules/core/client-api/src/test/resources/test-subcategories-nested.xml
b/modules/core/client-api/src/test/resources/test-subcategories-nested.xml
new file mode 100644
index 0000000..eb43af7
--- /dev/null
+++ b/modules/core/client-api/src/test/resources/test-subcategories-nested.xml
@@ -0,0 +1,60 @@
+<!--
+ ~ RHQ Management Platform
+ ~ Copyright (C) 2005-2013 Red Hat, Inc.
+ ~ All rights reserved.
+ ~
+ ~ This program is free software; you can redistribute it and/or modify
+ ~ it under the terms of the GNU General Public License as published by
+ ~ the Free Software Foundation version 2 of the License.
+ ~
+ ~ This program is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ~ GNU General Public License for more details.
+ ~
+ ~ You should have received a copy of the GNU General Public License
+ ~ along with this program; if not, write to the Free Software Foundation, Inc.,
+ ~ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ -->
+
+<plugin name="TestPlugin" displayName="Mock JBoss AS"
package="org.rhq.plugins.mock.jboss"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="urn:xmlns:rhq-plugin">
+
+ <server name="testServer1">
+ <subcategories>
+ <subcategory name="applications" displayName="Apps"
description="The apps."/>
+ <subcategory name="fooBar"/>
+ </subcategories>
+ </server>
+
+ <!-- subCategory="applications" means that resources of this type go in
the 'applications folder' of testServer1-->
+ <server name="testServer2" subCategory="applications">
+ <runs-inside>
+ <parent-resource-type name="testServer1"
plugin="TestPlugin"/>
+ </runs-inside>
+ <metric property="testMetric"/>
+ </server>
+
+ <service name="testService" subCategory="applications">
+ <runs-inside>
+ <parent-resource-type name="testServer1"
plugin="TestPlugin"/>
+ </runs-inside>
+
+ </service>
+
+ <service name="testService2" subCategory="applications">
+ <runs-inside>
+ <parent-resource-type name="testServer1"
plugin="TestPlugin"/>
+ </runs-inside>
+
+ </service>
+
+ <service name="testService3" subCategory="fooBar">
+ <runs-inside>
+ <parent-resource-type name="testServer1"
plugin="TestPlugin"/>
+ </runs-inside>
+
+ </service>
+
+</plugin>
commit 60329fcbda5a1961e0f9285c70eb56ea12fe2eb0
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Mon Jul 22 15:00:35 2013 +0200
Add Michael Burman as contributor
diff --git a/pom.xml b/pom.xml
index c5cf5a7..3662bc7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -2353,6 +2353,10 @@
<timezone>+1</timezone>
</contributor>
<contributor>
+ <name>Michael Burman</name>
+ <timezone>+2</timezone>
+ </contributor>
+ <contributor>
<name>Torben Jäger</name>
<timezone>+1</timezone>
</contributor>
commit d7e9f5b9871824d1f02ae762b44cff85ff6c3d44
Author: Thomas Segismont <tsegismo(a)redhat.com>
Date: Tue Jul 23 10:41:12 2013 +0200
Bug 969621 - EAP 6 managed plug-in is unable to discover EAP servers when more then
one is running on a single host
Update expected resource keys in itests
diff --git
a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/domain/DomainServerComponentTest.java
b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/domain/DomainServerComponentTest.java
index 91ece92..269474b 100644
---
a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/domain/DomainServerComponentTest.java
+++
b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/domain/DomainServerComponentTest.java
@@ -43,8 +43,11 @@ public class DomainServerComponentTest extends
AbstractServerComponentTest {
public static final ResourceType RESOURCE_TYPE =
new ResourceType("JBossAS7 Host Controller", PLUGIN_NAME,
ResourceCategory.SERVER, null);
- // The key is the server's base dir.
- public static final String RESOURCE_KEY = new File(JBOSS_HOME,
"domain").getPath();
+ // The key is the server host config file
+ // hostConfig: /tmp/jboss-as-6.0.0/domain/configuration/host.xml
+ public static final String RESOURCE_KEY = "hostConfig: "
+ + new File(JBOSS_HOME, "domain" + File.separator +
"configuration" + File.separator + "host.xml")
+ .getAbsolutePath();
@Override
protected ResourceType getServerResourceType() {
diff --git
a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/domain/SecurityModuleOptionsTest.java
b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/domain/SecurityModuleOptionsTest.java
index d128144..182ef36 100644
---
a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/domain/SecurityModuleOptionsTest.java
+++
b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/domain/SecurityModuleOptionsTest.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2011 Red Hat, Inc.
+ * Copyright (C) 2005-2013 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -13,8 +13,8 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * along with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
package org.rhq.modules.plugins.jbossas7.itest.domain;
@@ -488,10 +488,8 @@ public class SecurityModuleOptionsTest extends
AbstractJBossAS7PluginTest {
InventoryManager im = pluginContainer.getInventoryManager();
Resource platform = im.getPlatform();
//host controller
- ResourceType hostControllerType = new ResourceType("JBossAS7 Host
Controller", PLUGIN_NAME,
- ResourceCategory.SERVER, null);
- Resource hostController = getResourceByTypeAndKey(platform,
hostControllerType,
- "/tmp/jboss-as-6.0.0/domain");
+ Resource hostController = getResourceByTypeAndKey(platform,
DomainServerComponentTest.RESOURCE_TYPE,
+ DomainServerComponentTest.RESOURCE_KEY);
//profile=full-ha
ResourceType profileType = new ResourceType("Profile", PLUGIN_NAME,
ResourceCategory.SERVICE, null);
String key = PROFILE;
diff --git
a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/StandaloneServerComponentTest.java
b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/StandaloneServerComponentTest.java
index 8446345..32f92c7 100644
---
a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/StandaloneServerComponentTest.java
+++
b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/StandaloneServerComponentTest.java
@@ -51,8 +51,11 @@ public class StandaloneServerComponentTest extends
AbstractServerComponentTest {
public static final ResourceType RESOURCE_TYPE =
new ResourceType("JBossAS7 Standalone Server", PLUGIN_NAME,
ResourceCategory.SERVER, null);
- // The key is the server's base dir.
- public static final String RESOURCE_KEY = new File(JBOSS_HOME,
"standalone").getPath();
+ // The key is the server host config file
+ // hostConfig: /tmp/jboss-as-6.0.0/standalone/configuration/standalone-full-ha.xml
+ public static final String RESOURCE_KEY = "hostConfig: "
+ + new File(JBOSS_HOME, "standalone" + File.separator +
"configuration" + File.separator
+ + "standalone-full-ha.xml").getAbsolutePath();
private static final String RELOAD_OPERATION_NAME = "reload";
private static final String RESTART_OPERATION_NAME = "restart";
commit 567aee7f81c6aa0f7680d4f394cccb1974705320
Author: Larry O'Leary <loleary(a)redhat.com>
Date: Mon Jul 22 16:10:09 2013 -0500
BZ 981015: Fix test failures introduced by commit 01cd91b
- findLdapUserDetails was appending baseDN twice during fallback code
- FakeLdapContext contained some lazy escaping on the mock group entries
diff --git
a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/ldap/FakeLdapContext.java
b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/ldap/FakeLdapContext.java
index dad31ce..2ae6265 100644
---
a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/ldap/FakeLdapContext.java
+++
b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/ldap/FakeLdapContext.java
@@ -99,7 +99,6 @@ public class FakeLdapContext implements LdapContext {
try {
return new
FakeNamingEnumeration<SearchResult>(ldapTestData.getSearchResults(attributes));
} catch (Exception e) {
- // TODO Auto-generated catch block
e.printStackTrace();
return null;
}
@@ -516,12 +515,12 @@ public class FakeLdapContext implements LdapContext {
attr = new BasicAttribute("member");
attr.add("cn=Robert
Smith,ou=users,dc=test,dc=rhq,dc=redhat,dc=com");
attr.add("cn=Cannon\\,
Brett,ou=users,dc=test,dc=rhq,dc=redhat,dc=com");
- attr.add("cn=Charles
H\\\\Samlin,ou=users,dc=test,dc=rhq,dc=redhat,dc=com");
+ attr.add("cn=Charles
H\\Samlin,ou=users,dc=test,dc=rhq,dc=redhat,dc=com");
attr.add("cn=Craig \\#1
Sellers,ou=users,dc=test,dc=rhq,dc=redhat,dc=com");
attr.add("cn=Beverly \\+1
Balanger,ou=users,dc=test,dc=rhq,dc=redhat,dc=com");
attr.add("cn=Bethany \\<Stuart\\>
Wallace,ou=users,dc=test,dc=rhq,dc=redhat,dc=com");
attr.add("cn=Zachory S\\;
Balanger,ou=users,dc=test,dc=rhq,dc=redhat,dc=com");
- attr.add("cn=Allen \\\"The Hammer\\\"
Callen,ou=users,dc=test,dc=rhq,dc=redhat,dc=com");
+ attr.add("cn=Allen \"The Hammer\"
Callen,ou=users,dc=test,dc=rhq,dc=redhat,dc=com");
attr.add("cn=Sam Not \\=
Smitherson,ou=users,dc=test,dc=rhq,dc=redhat,dc=com");
attr.add("cn=\\ Billy The Kiddough\\
,ou=users,dc=test,dc=rhq,dc=redhat,dc=com");
attr.add("cn=System/Integration
API,ou=users,dc=test,dc=rhq,dc=redhat,dc=com");
@@ -557,12 +556,12 @@ public class FakeLdapContext implements LdapContext {
attr = new BasicAttribute("member");
attr.add("cn=John
Smith,ou=users,dc=test,dc=rhq,dc=redhat,dc=com");
attr.add("cn=Dr. Greg Hause\\,
MD,ou=users,dc=test,dc=rhq,dc=redhat,dc=com");
- attr.add("cn=Cindy\\\\Cynthia
Groober,ou=users,dc=test,dc=rhq,dc=redhat,dc=com");
+ attr.add("cn=Cindy\\Cynthia
Groober,ou=users,dc=test,dc=rhq,dc=redhat,dc=com");
attr.add("cn=Biff \\#
Rogers,ou=users,dc=test,dc=rhq,dc=redhat,dc=com");
attr.add("cn=Steven \\+2
Reed,ou=users,dc=test,dc=rhq,dc=redhat,dc=com");
attr.add("cn=Lisa \\<The Great\\>
Toller,ou=users,dc=test,dc=rhq,dc=redhat,dc=com");
attr.add("cn=Homer J Simpsonite\\;
III,ou=users,dc=test,dc=rhq,dc=redhat,dc=com");
- attr.add("cn=Jessica \\\"Crouching Tiger\\\"
Mathers,ou=users,dc=test,dc=rhq,dc=redhat,dc=com");
+ attr.add("cn=Jessica \"Crouching Tiger\"
Mathers,ou=users,dc=test,dc=rhq,dc=redhat,dc=com");
attr.add("cn=Hope \\=
Rein,ou=users,dc=test,dc=rhq,dc=redhat,dc=com");
attr.add("cn=\\ Sue Ferguson\\
,ou=users,dc=test,dc=rhq,dc=redhat,dc=com");
attr.add("cn=Phil/Susan
Carlson,ou=users,dc=test,dc=rhq,dc=redhat,dc=com");
@@ -598,12 +597,12 @@ public class FakeLdapContext implements LdapContext {
attr = new BasicAttribute("member");
attr.add("cn=Sheri
Smith,ou=users,dc=test,dc=rhq,dc=redhat,dc=com");
attr.add("cn=Walsh\\,
Brad,ou=users,dc=test,dc=rhq,dc=redhat,dc=com");
- attr.add("cn=Jim\\\\James
Kirk,ou=users,dc=test,dc=rhq,dc=redhat,dc=com");
+ attr.add("cn=Jim\\James
Kirk,ou=users,dc=test,dc=rhq,dc=redhat,dc=com");
attr.add("cn=Sandra \\#
Phillips,ou=users,dc=test,dc=rhq,dc=redhat,dc=com");
attr.add("cn=William Tell Overture
\\+1,ou=users,dc=test,dc=rhq,dc=redhat,dc=com");
attr.add("cn=Craig \\<Bison\\>
Allen,ou=users,dc=test,dc=rhq,dc=redhat,dc=com");
attr.add("cn=Walter T Fredrick\\; The
Second,ou=users,dc=test,dc=rhq,dc=redhat,dc=com");
- attr.add("cn=Stanley \\\"Short\\\"
Mein,ou=users,dc=test,dc=rhq,dc=redhat,dc=com");
+ attr.add("cn=Stanley \"Short\"
Mein,ou=users,dc=test,dc=rhq,dc=redhat,dc=com");
attr.add("cn=Noah \\=
Sadler,ou=users,dc=test,dc=rhq,dc=redhat,dc=com");
attr.add("cn=\\ Stuart Smiley\\
,ou=users,dc=test,dc=rhq,dc=redhat,dc=com");
attr.add("cn=System/Integration API
2,ou=users,dc=test,dc=rhq,dc=redhat,dc=com");
@@ -984,7 +983,7 @@ public class FakeLdapContext implements LdapContext {
attr.add("User with backslash (\\) in 'cn' in the RHQ Admin
Group");
attrs.put(attr);
- sr = new SearchResult("cn=Charles H\\\\Samlin,ou=users", null,
null, attrs, true);
+ sr = new SearchResult("cn=Charles H\\Samlin,ou=users", null, null,
attrs, true);
this.add(sr);
// dn: cn=Cindy\\Cynthia Groober,ou=users,dc=test,dc=rhq,dc=redhat,dc=com
@@ -1033,7 +1032,7 @@ public class FakeLdapContext implements LdapContext {
attr.add("User with backslash (\\) in 'cn' in the JBoss Admin
Group");
attrs.put(attr);
- sr = new SearchResult("cn=Cindy\\\\Cynthia Groober,ou=users", null,
null, attrs, true);
+ sr = new SearchResult("cn=Cindy\\Cynthia Groober,ou=users", null,
null, attrs, true);
this.add(sr);
// dn: cn=Jim\\James Kirk,ou=users,dc=test,dc=rhq,dc=redhat,dc=com
@@ -1082,7 +1081,7 @@ public class FakeLdapContext implements LdapContext {
attr.add("User with backslash (\\) in 'cn' in the JBoss Monitor
Group");
attrs.put(attr);
- sr = new SearchResult("cn=Jim\\\\James Kirk,ou=users", null, null,
attrs, true);
+ sr = new SearchResult("cn=Jim\\James Kirk,ou=users", null, null,
attrs, true);
this.add(sr);
// dn: cn=Craig \#1 Sellers,ou=users,dc=test,dc=rhq,dc=redhat,dc=com
@@ -1675,7 +1674,7 @@ public class FakeLdapContext implements LdapContext {
null, attrs, true);
this.add(sr);
- // dn: cn=Allen \"The Hammer\"
Callen,ou=users,dc=test,dc=rhq,dc=redhat,dc=com
+ // dn: cn=Allen "The Hammer"
Callen,ou=users,dc=test,dc=rhq,dc=redhat,dc=com
attrs = new BasicAttributes();
attr = new BasicAttribute("baseName");
@@ -1721,11 +1720,11 @@ public class FakeLdapContext implements LdapContext {
attr.add("User with quote (\") in 'cn' in the RHQ Admin
Group");
attrs.put(attr);
- sr = new SearchResult("cn=Allen \\\"The Hammer\\\"
Callen,ou=users", "javax.naming.directory.DirContext",
+ sr = new SearchResult("cn=Allen \"The Hammer\"
Callen,ou=users", "javax.naming.directory.DirContext",
null, attrs, true);
this.add(sr);
- // dn: cn=Jessica \"Crouching Tiger\"
Mathers,ou=users,dc=test,dc=rhq,dc=redhat,dc=com
+ // dn: cn=Jessica "Crouching Tiger"
Mathers,ou=users,dc=test,dc=rhq,dc=redhat,dc=com
attrs = new BasicAttributes();
attr = new BasicAttribute("baseName");
@@ -1771,11 +1770,11 @@ public class FakeLdapContext implements LdapContext {
attr.add("User with quote (\") in 'cn' in the JBoss Admin
Group");
attrs.put(attr);
- sr = new SearchResult("cn=Jessica \\\"Crouching Tiger\\\"
Mathers,ou=users",
+ sr = new SearchResult("cn=Jessica \"Crouching Tiger\"
Mathers,ou=users",
"javax.naming.directory.DirContext", null, attrs, true);
this.add(sr);
- // dn: cn=Stanley \"Short\"
Mein,ou=users,dc=test,dc=rhq,dc=redhat,dc=com
+ // dn: cn=Stanley "Short"
Mein,ou=users,dc=test,dc=rhq,dc=redhat,dc=com
attrs = new BasicAttributes();
attr = new BasicAttribute("baseName");
@@ -1821,7 +1820,7 @@ public class FakeLdapContext implements LdapContext {
attr.add("User with quote (\") in 'cn' in the JBoss Monitor
Group");
attrs.put(attr);
- sr = new SearchResult("cn=Stanley \\\"Short\\\"
Mein,ou=users", null, null, attrs, true);
+ sr = new SearchResult("cn=Stanley \"Short\"
Mein,ou=users", null, null, attrs, true);
this.add(sr);
// dn: cn=Sam Not \= Smitherson,ou=users,dc=test,dc=rhq,dc=redhat,dc=com
@@ -2160,7 +2159,7 @@ public class FakeLdapContext implements LdapContext {
attr.add("User with slash (/) in 'cn' in the RHQ Admin
Group");
attrs.put(attr);
- sr = new SearchResult("cn=System/Integration API,ou=users", null,
null, attrs, true);
+ sr = new SearchResult("cn=System\\/Integration API,ou=users", null,
null, attrs, true);
this.add(sr);
// dn: cn=Phil/Susan Carlson,ou=users,dc=test,dc=rhq,dc=redhat,dc=com
@@ -2209,7 +2208,7 @@ public class FakeLdapContext implements LdapContext {
attr.add("User with slash (/) in 'cn' in the JBoss Admin
Group");
attrs.put(attr);
- sr = new SearchResult("cn=Phil/Susan Carlson,ou=users", null, null,
attrs, true);
+ sr = new SearchResult("cn=Phil\\/Susan Carlson,ou=users", null,
null, attrs, true);
this.add(sr);
// dn: cn=System/Integration API 2,ou=users,dc=test,dc=rhq,dc=redhat,dc=com
@@ -2254,7 +2253,7 @@ public class FakeLdapContext implements LdapContext {
attr.add("User with slash (/) in 'cn' in the JBoss Monitor
Group");
attrs.put(attr);
- sr = new SearchResult("cn=System/Integration API 2,ou=users", null,
null, attrs, true);
+ sr = new SearchResult("cn=System\\/Integration API 2,ou=users",
null, null, attrs, true);
this.add(sr);
// dn: cn=Lee -Fast- Croutche,ou=users,dc=test,dc=rhq,dc=redhat,dc=com
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/LdapGroupManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/LdapGroupManagerBean.java
index a28c709..7473321 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/LdapGroupManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/LdapGroupManagerBean.java
@@ -350,7 +350,6 @@ public class LdapGroupManagerBean implements LdapGroupManagerLocal {
if (si.isRelative()) {
userDN += "," + baseDNs[x];
}
- userDN = userDN + "," + baseDNs[x];
}
userDetails.put("dn", userDN);
commit 8c693ee685d538a28a3c42ce813b10b49997f871
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Jul 22 16:36:23 2013 -0400
get rid of the upgrade wording, it's confusing when performing an initial
install.
diff --git
a/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/AbstractInstall.java
b/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/AbstractInstall.java
index 61c8a9c..fb9bceb 100644
---
a/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/AbstractInstall.java
+++
b/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/AbstractInstall.java
@@ -363,14 +363,14 @@ public abstract class AbstractInstall extends ControlCommand {
protected void startRHQServerForInstallation() throws IOException {
try {
- log.info("The RHQ Server must be started to complete its upgrade.
Starting the RHQ server in preparation of running the server installer...");
+ log.info("The RHQ Server must be started to complete its installation.
Starting the RHQ server in preparation of running the server installer...");
// when you unzip the distro, you are getting a fresh, unadulterated,
out-of-box EAP installation, which by default listens
// to port 9999 for its native management subsystem. Make sure some other
independent EAP server (or anything for that matter)
// isn't already listening to that port.
if (isPortInUse("127.0.0.1", 9999)) {
throw new IOException(
- "Something is already listening to port 9999 - shut it down
before upgrading the server.");
+ "Something is already listening to port 9999 - shut it down
before installing the server.");
}
Executor executor = new DefaultExecutor();
@@ -400,7 +400,7 @@ public abstract class AbstractInstall extends ControlCommand {
}
// Wait for the server to complete it's startup
- log.info("Waiting for the RHQ Server to start in preparation of running
the server installer for upgrade...");
+ log.info("Waiting for the RHQ Server to start in preparation of running
the server installer...");
commandLine = getCommandLine("rhq-installer", "--test");
Executor installerExecutor = new DefaultExecutor();
commit 2409ed2dcd705c58e5024182e95445431b25acf5
Author: John Sanda <jsanda(a)redhat.com>
Date: Mon Jul 22 15:16:49 2013 -0400
document the 4.8 storage patch script
diff --git a/etc/scripts/rhq48-storage-patch/rhq48-storage-patch.sh
b/etc/scripts/rhq48-storage-patch/rhq48-storage-patch.sh
index 33984d1..ae78240 100755
--- a/etc/scripts/rhq48-storage-patch/rhq48-storage-patch.sh
+++ b/etc/scripts/rhq48-storage-patch/rhq48-storage-patch.sh
@@ -1,7 +1,43 @@
#!/bin/bash
+#
+# BACKGROUND:
+# This patch script needs to be run against RHQ 4.8.0 installations prior to
+# script. You do not need to run this script if upgrading from a version
+# earlier than 4.8.0.
+#
+# PREREQUISITES:
+# 1) Shut down the RHQ storage node and server.
+#
+# 2) Edit <rhq-install-dir>/rhq-storage/conf/cassandra.yaml and set the
+# following property,
+#
+# start_rpc: true
+#
+# 3) Note the value of rpc_port in cassandra.yaml. By default it is 9160 which
+# is fine.
+#
+# RUNNING THE PATCH:
+# 1) cd <patch-dir>
+#
+# 2) ./rhq48-storage-patch.sh <rhq-480-server-dir> <storage-ip-address>
<thrift-port> <jmx-port>
+#
+# 3) Carefully reivew the script output for any errors.
+#
+# 4) Edit cassandra.yaml against and reset start_rpc: false
+#
+# ADDITIONAL NOTES:
+# The <jmx-port> defaults to 7299. If you are uncertain of what value to use,
+# you can find it in the UI. Log into RHQ and go to Administration --> Storage Nodes.
+#
+# If you are uncertain of the value to use for the storage node IP address, you
+# find the correct valu in the storage nodes admin UI as well.
+#
+# EXAMPLE:
+# ./rhq48-storage-patch.sh /opt/rhq-4.8.0 127.0.0.1 9160 7299
+# Usage: ./rhq48-storage-patch.sh <rhq-480-server-dir> <storage-ip-address>
<thrift-port> <jmx-port>
function usage() {
- echo "Usage: $0 <rhq-server-dir> <storage-ip-address> <cql-port>
<jmx-port>"
+ echo "Usage: $0 <rhq-480-server-dir> <storage-ip-address>
<thrift-port> <jmx-port>"
}
if [ $# -ne 4 ]; then
@@ -16,11 +52,11 @@ fi
RHQ_SERVER_DIR=$1
CQL_HOSTNAME=$2
-CQL_PORT=$3
+THRIFT_PORT=$3
JMX_PORT=$4
export CQLSH_HOST=$2
-export CQL_PORT=$3
+export CQLSH_PORT=$3
PATCH="apache-cassandra-1.2.4-patch-1.jar"
commit c91c8f23416db836308b2bf3871fdda87559297e
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Mon Jul 22 14:12:08 2013 -0500
Update the storage node manager API for alerts to support UI functionality.
diff --git a/modules/enterprise/server/jar/intentional-api-changes-since-4.8.0.xml
b/modules/enterprise/server/jar/intentional-api-changes-since-4.8.0.xml
index a9ce322..58c4eda 100644
--- a/modules/enterprise/server/jar/intentional-api-changes-since-4.8.0.xml
+++ b/modules/enterprise/server/jar/intentional-api-changes-since-4.8.0.xml
@@ -11,8 +11,22 @@
<difference>
<className>org/rhq/enterprise/server/cloud/StorageNodeManagerRemote</className>
<differenceType>7012</differenceType> <!-- method added to an
interface -->
+ <method>org.rhq.core.domain.util.PageList
findNotAcknowledgedStorageNodeAlerts(org.rhq.core.domain.auth.Subject,
org.rhq.core.domain.cloud.StorageNode)</method>
+ <justification>Adding a method to a remote API interface is safe. This is newly
implemented functionality.</justification>
+ </difference>
+
+ <difference>
+
<className>org/rhq/enterprise/server/cloud/StorageNodeManagerRemote</className>
+ <differenceType>7012</differenceType> <!-- method added to an
interface -->
<method>org.rhq.core.domain.util.PageList
findAllStorageNodeAlerts(org.rhq.core.domain.auth.Subject)</method>
<justification>Adding a method to a remote API interface is safe. This is newly
implemented functionality.</justification>
</difference>
+ <difference>
+
<className>org/rhq/enterprise/server/cloud/StorageNodeManagerRemote</className>
+ <differenceType>7012</differenceType> <!-- method added to an
interface -->
+ <method>org.rhq.core.domain.util.PageList
findAllStorageNodeAlerts(org.rhq.core.domain.auth.Subject,
org.rhq.core.domain.cloud.StorageNode)</method>
+ <justification>Adding a method to a remote API interface is safe. This is newly
implemented functionality.</justification>
+ </difference>
+
</differences>
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 c2a7b46..b32ab5b 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
@@ -512,12 +512,22 @@ public class StorageNodeManagerBean implements
StorageNodeManagerLocal, StorageN
@Override
public PageList<Alert> findNotAcknowledgedStorageNodeAlerts(Subject subject) {
- return findStorageNodeAlerts(subject, false);
+ return findStorageNodeAlerts(subject, false, null);
+ }
+
+ @Override
+ public PageList<Alert> findNotAcknowledgedStorageNodeAlerts(Subject subject,
StorageNode storageNode) {
+ return findStorageNodeAlerts(subject, false, storageNode);
}
@Override
public PageList<Alert> findAllStorageNodeAlerts(Subject subject) {
- return findStorageNodeAlerts(subject, true);
+ return findStorageNodeAlerts(subject, true, null);
+ }
+
+ @Override
+ public PageList<Alert> findAllStorageNodeAlerts(Subject subject, StorageNode
storageNode) {
+ return findStorageNodeAlerts(subject, true, storageNode);
}
/**
@@ -527,8 +537,8 @@ public class StorageNodeManagerBean implements
StorageNodeManagerLocal, StorageN
* @param allAlerts if [true] then return all alerts; if [false] then return only
alerts that are not acknowledged
* @return alerts
*/
- private PageList<Alert> findStorageNodeAlerts(Subject subject, boolean
allAlerts) {
- Integer[] resouceIdsWithAlertDefinitions = findResourcesWithAlertDefinitions();
+ private PageList<Alert> findStorageNodeAlerts(Subject subject, boolean
allAlerts, StorageNode storageNode) {
+ Integer[] resouceIdsWithAlertDefinitions =
findResourcesWithAlertDefinitions(storageNode);
PageList<Alert> alerts = new PageList<Alert>();
if( resouceIdsWithAlertDefinitions != null &&
resouceIdsWithAlertDefinitions.length != 0 ){
@@ -555,31 +565,35 @@ public class StorageNodeManagerBean implements
StorageNodeManagerLocal, StorageN
return alerts;
}
- /**
- * Return resource Ids for all resources and sub-resources of Storage Nodes that
- * have alert definitions. This will be used by the resource criteria to find
- * all alerts triggered for storage nodes.
- *
- * @return
- */
- private Integer[] findResourcesWithAlertDefinitions() {
- List<Integer> resourceIdsWithAlertDefinitions = new
ArrayList<Integer>();
- List<StorageNode> test2 = getStorageNodes();
+ @Override
+ public Integer[] findResourcesWithAlertDefinitions() {
+ return this.findResourcesWithAlertDefinitions(null);
+ }
+
+ @Override
+ public Integer[] findResourcesWithAlertDefinitions(StorageNode storageNode) {
+ List<StorageNode> initialStorageNodes;
+ if (storageNode == null) {
+ initialStorageNodes = getStorageNodes();
+ } else {
+ initialStorageNodes = Arrays.asList(storageNode);
+ }
Queue<Resource> unvisitedResources = new LinkedList<Resource>();
- for (StorageNode node : test2) {
- if (node.getResource() != null) {
- unvisitedResources.add(node.getResource());
+ for (StorageNode initialStorageNode : initialStorageNodes) {
+ if (initialStorageNode.getResource() != null) {
+ unvisitedResources.add(initialStorageNode.getResource());
}
}
- while(!unvisitedResources.isEmpty()){
+ List<Integer> resourceIdsWithAlertDefinitions = new
ArrayList<Integer>();
+ while (!unvisitedResources.isEmpty()) {
Resource resource = unvisitedResources.poll();
if (resource.getAlertDefinitions() != null) {
resourceIdsWithAlertDefinitions.add(resource.getId());
}
- for(Resource child: resource.getChildResources()){
+ for (Resource child : resource.getChildResources()) {
unvisitedResources.add(child);
}
}
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/StorageNodeManagerLocal.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/StorageNodeManagerLocal.java
index 6fca820..69b16c4 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/StorageNodeManagerLocal.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/StorageNodeManagerLocal.java
@@ -81,6 +81,15 @@ public interface StorageNodeManagerLocal {
PageList<Alert> findNotAcknowledgedStorageNodeAlerts(Subject subject);
/**
+ * Fetches the list of Storage Node related alerts that have not yet been
acknowledged for the
+ * specified storage node.
+ *
+ * @param subject subject
+ * @return storage nodes alerts not acknowledged
+ */
+ PageList<Alert> findNotAcknowledgedStorageNodeAlerts(Subject subject,
StorageNode storageNode);
+
+ /**
* Fetches all the Storage Node related alerts.
*
* @param subject subject
@@ -89,6 +98,39 @@ public interface StorageNodeManagerLocal {
PageList<Alert> findAllStorageNodeAlerts(Subject subject);
/**
+ * Fetches all the Storage Node related alerts for the specified storage node.
+ *
+ * @param subject subject
+ * @return all storage nodes alerts
+ */
+ PageList<Alert> findAllStorageNodeAlerts(Subject subject, StorageNode
storageNode);
+
+
+ /**
+ * Find ids for all resources and sub-resources of Storage Nodes that
+ * have alert definitions. This can be used by the resource criteria queries to find
+ * all alerts triggered for storage nodes resources.
+ *
+ * @return resource ids
+ */
+ Integer[] findResourcesWithAlertDefinitions();
+
+ /**
+ * Find ids for all resources and sub-resources, of the specified storage node, that
+ * have alert definitions. This can be used by the resource criteria queries to find
+ * all alerts triggered for storage nodes resources.
+ *
+ * If storage node is null it find ids for all resources and sub-resources of Storage
Nodes that
+ * have alert definitions. Please see {@link #findResourcesWithAlertDefinitions()}
for more details.
+ *
+ * @param storageNode storage node
+ *
+ * @return resource ids
+ */
+ Integer[] findResourcesWithAlertDefinitions(StorageNode storageNode);
+
+
+ /**
* <p>Prepares the node for subsequent upgrade.</p>
* <p> CAUTION: this method will set the RHQ server to maintenance mode, RHQ
storage flushes all the data to disk
* and backup of all the keyspaces is created</p>
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/StorageNodeManagerRemote.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/StorageNodeManagerRemote.java
index 7be1b07..75ac02b 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/StorageNodeManagerRemote.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/StorageNodeManagerRemote.java
@@ -73,10 +73,27 @@ public interface StorageNodeManagerRemote {
PageList<Alert> findNotAcknowledgedStorageNodeAlerts(Subject subject);
/**
+ * Fetches the list of Storage Node related alerts that have not yet been
acknowledged for the
+ * specified storage node.
+ *
+ * @param subject subject
+ * @return storage nodes alerts not acknowledged
+ */
+ PageList<Alert> findNotAcknowledgedStorageNodeAlerts(Subject subject,
StorageNode storageNode);
+
+ /**
* Fetches all the Storage Node related alerts.
*
* @param subject subject
* @return all storage nodes alerts
*/
PageList<Alert> findAllStorageNodeAlerts(Subject subject);
+
+ /**
+ * Fetches all the Storage Node related alerts for the specified storage node.
+ *
+ * @param subject subject
+ * @return all storage nodes alerts
+ */
+ PageList<Alert> findAllStorageNodeAlerts(Subject subject, StorageNode
storageNode);
}
commit c6c9e50398ffb5fc6d297ceffc369975a56b3ef9
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Jul 22 14:09:52 2013 -0400
Add windows support storage install options and resource config update. Introduce
rhq-storage-wrapper.env to hold the configurable values (mimicing somewhat
cassandra-jvm.properties) and apply the values as token replacements in
rhq-storage-wrapper.conf.
Note that cassandra-jvm.properties is still kept up to date on windows and
can be used generically, as needed.
diff --git
a/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/java/org/rhq/cassandra/Deployer.java
b/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/java/org/rhq/cassandra/Deployer.java
index 6547043..60667cc 100644
---
a/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/java/org/rhq/cassandra/Deployer.java
+++
b/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/java/org/rhq/cassandra/Deployer.java
@@ -91,7 +91,14 @@ public class Deployer {
applyConfigChanges(confDir, "cassandra.yaml", tokens);
applyConfigChanges(confDir, "log4j-server.properties", tokens);
applyChangesToCassandraJvmProps(confDir, deploymentOptions);
-// applyConfigChanges(confDir, "cassandra-env.sh", tokens);
+
+ // For windows, update the service wrapper env. It may not ne necessary to have
updated cassandra-jvm.properties
+ // as well as this file, but for now we'll update both, leaving the former as
a dependably set file.
+ if (File.separatorChar == '\\') {
+ applyChangesToWindowsServiceWrapper(deployDir);
+ }
+
+ // applyConfigChanges(confDir, "cassandra-env.sh", tokens);
}
private void applyConfigChanges(File confDir, String fileName, Map<String,
String> tokens)
@@ -109,8 +116,8 @@ public class Deployer {
rhqFile.delete();
} catch (IOException e) {
log.error("An unexpected error occurred while apply configuration
changes to " + filteredFile, e);
- throw new DeploymentException("An unexpected error occurred while apply
configuration changes to " +
- filteredFile, e);
+ throw new DeploymentException("An unexpected error occurred while apply
configuration changes to "
+ + filteredFile, e);
}
}
@@ -132,8 +139,8 @@ public class Deployer {
String javaVersion = System.getProperty("java.version");
// The check here is taken right from cassandra-env.sh
- if ((!isOpenJDK() || javaVersion.compareTo("1.6.0") > 0) ||
- (javaVersion.equals("1.6.0") && getJavaPatchVersion()
> 23)) {
+ if ((!isOpenJDK() || javaVersion.compareTo("1.6.0") > 0)
+ || (javaVersion.equals("1.6.0") &&
getJavaPatchVersion() > 23)) {
properties.put("java_agent",
"-javaagent:$CASSANDRA_HOME/lib/jamm-0.2.5.jar");
}
@@ -165,6 +172,29 @@ public class Deployer {
return Integer.parseInt(javaVersion.substring(startIndex + 1,
javaVersion.length()));
}
+ public void applyChangesToWindowsServiceWrapper(File deployDir) throws
DeploymentException {
+ File wrapperDir = new File(deployDir, "../bin/wrapper");
+ File wrapperEnvFile = new File(wrapperDir, "rhq-storage-wrapper.env");
+
+ try {
+ log.info("Applying configuration changes to " + wrapperEnvFile);
+
+ PropertiesFileUpdate propertiesUpdater = new
PropertiesFileUpdate(wrapperEnvFile.getAbsolutePath());
+ Properties wrapperEnvProps = propertiesUpdater.loadExistingProperties();
+
+ wrapperEnvProps.setProperty("set.heap_min", "-Xms" +
deploymentOptions.getHeapSize());
+ wrapperEnvProps.setProperty("set.heap_max", "-Xmx" +
deploymentOptions.getHeapSize());
+ wrapperEnvProps.setProperty("set.heap_new", "-Xmn" +
deploymentOptions.getHeapNewSize());
+ wrapperEnvProps.setProperty("set.thread_stack_size",
"-Xss" + deploymentOptions.getStackSize());
+ wrapperEnvProps.setProperty("set.jmx_port",
deploymentOptions.getJmxPort().toString());
+
+ propertiesUpdater.update(wrapperEnvProps);
+ } catch (IOException e) {
+ log.error("An error occurred while updating " + wrapperEnvFile,
e);
+ throw new DeploymentException("An error occurred while updating " +
wrapperEnvFile, e);
+ }
+ }
+
public void updateFilePerms() {
File deployDir = new File(deploymentOptions.getBasedir());
File binDir = new File(deployDir, "bin");
@@ -187,8 +217,8 @@ public class Deployer {
try {
authFile.delete();
- StreamUtil.copy(new StringReader(StringUtil.collectionToString(addresses,
"\n")),
- new FileWriter(authFile), true);
+ StreamUtil.copy(new StringReader(StringUtil.collectionToString(addresses,
"\n")), new FileWriter(authFile),
+ true);
} catch (IOException e) {
throw new RuntimeException("Failed to update " + authFile);
}
diff --git
a/modules/enterprise/server/appserver/src/main/bin-resources/bin/wrapper/rhq-storage-wrapper.conf
b/modules/enterprise/server/appserver/src/main/bin-resources/bin/wrapper/rhq-storage-wrapper.conf
index 14f2ff1..de83364 100644
---
a/modules/enterprise/server/appserver/src/main/bin-resources/bin/wrapper/rhq-storage-wrapper.conf
+++
b/modules/enterprise/server/appserver/src/main/bin-resources/bin/wrapper/rhq-storage-wrapper.conf
@@ -66,23 +66,25 @@ wrapper.app.parameter.3="-Dcassandra-foreground=yes"
# Additional JVM parameters (quotes ARE needed)
wrapper.java.additional.1="-ea"
wrapper.java.additional.2="-javaagent:"%RHQ_STORAGE_HOME%\lib\jamm-0.2.5.jar""
-wrapper.java.additional.3="-Xms1G"
-wrapper.java.additional.4="-Xmx1G"
-wrapper.java.additional.5="-XX:+HeapDumpOnOutOfMemoryError"
-wrapper.java.additional.6="-XX:+UseParNewGC"
-wrapper.java.additional.7="-XX:+UseConcMarkSweepGC"
-wrapper.java.additional.8="-XX:+CMSParallelRemarkEnabled"
-wrapper.java.additional.9="-XX:SurvivorRatio=8"
-wrapper.java.additional.10="-XX:MaxTenuringThreshold=1"
-wrapper.java.additional.11="-XX:CMSInitiatingOccupancyFraction=75"
-wrapper.java.additional.12="-XX:+UseCMSInitiatingOccupancyOnly"
-wrapper.java.additional.13="-Dcom.sun.management.jmxremote.port=7299"
-wrapper.java.additional.14="-Dcom.sun.management.jmxremote.ssl=false"
-wrapper.java.additional.15="-Dcom.sun.management.jmxremote.authenticate=false"
-wrapper.java.additional.16="-Dlog4j.configuration=log4j-server.properties"
-wrapper.java.additional.17="-Dlog4j.defaultInitOverride=true"
-
-# We want to make sure the Storage Node starts in the casandra bin directory
+wrapper.java.additional.3="%heap_min%"
+wrapper.java.additional.4="%heap_max%"
+wrapper.java.additional.5="%heap_new%"
+wrapper.java.additional.6="%heap_dump_on_OOMError%"
+wrapper.java.additional.7="%heap_dump_dir%"
+wrapper.java.additional.8="-XX:+UseConcMarkSweepGC"
+wrapper.java.additional.9="-XX:+CMSParallelRemarkEnabled"
+wrapper.java.additional.10="-XX:SurvivorRatio=8"
+wrapper.java.additional.11="-XX:MaxTenuringThreshold=1"
+wrapper.java.additional.12="-XX:CMSInitiatingOccupancyFraction=75"
+wrapper.java.additional.13="-XX:+UseCMSInitiatingOccupancyOnly"
+wrapper.java.additional.14="-XX:+UseParNewGC"
+wrapper.java.additional.15="-Dcom.sun.management.jmxremote.port=%jmx_port%"
+wrapper.java.additional.16="-Dcom.sun.management.jmxremote.ssl=false"
+wrapper.java.additional.17="-Dcom.sun.management.jmxremote.authenticate=false"
+wrapper.java.additional.18="-Dlog4j.configuration=log4j-server.properties"
+wrapper.java.additional.19="-Dlog4j.defaultInitOverride=true"
+
+# We want to make sure the Storage Node starts in the cassandra bin directory
wrapper.working.dir=%RHQ_STORAGE_HOME%/bin
#*****************************************************************************
diff --git
a/modules/enterprise/server/appserver/src/main/bin-resources/bin/wrapper/rhq-storage-wrapper.env
b/modules/enterprise/server/appserver/src/main/bin-resources/bin/wrapper/rhq-storage-wrapper.env
new file mode 100644
index 0000000..1441e0a
--- /dev/null
+++
b/modules/enterprise/server/appserver/src/main/bin-resources/bin/wrapper/rhq-storage-wrapper.env
@@ -0,0 +1,24 @@
+#*****************************************************************************
+# RHQ Storage Node Java Service Wrapper Environment Settings File
+#
+# This file specifies a set of environment variables that will be
+# applied to the Storage Node JVM.
+#
+# THIS FILE SHOULD NOT BE EDITED!
+#
+# This file represents the values managed as RHQ Storage Node resource
+# configuration values. Or, set by the installer.
+#
+#*****************************************************************************
+
+set.jmx_port=7299
+
+set.heap_min=-Xms512M
+set.heap_max=-Xms512M
+set.heap_new=-Xmn128M
+
+set.thread_stack_size=-Xss180k
+
+set.heap_dump_on_OOMError=-XX:+HeapDumpOnOutOfMemoryError
+
+set.heap_dump_dir=
diff --git
a/modules/enterprise/server/appserver/src/main/dev-resources/bin/wrapper/rhq-storage-wrapper.inc
b/modules/enterprise/server/appserver/src/main/dev-resources/bin/wrapper/rhq-storage-wrapper.inc
index ee0d448..6941358 100644
---
a/modules/enterprise/server/appserver/src/main/dev-resources/bin/wrapper/rhq-storage-wrapper.inc
+++
b/modules/enterprise/server/appserver/src/main/dev-resources/bin/wrapper/rhq-storage-wrapper.inc
@@ -4,11 +4,11 @@
#
# override and lower the initial memory profile
-wrapper.java.additional.18=-Xms128M
-wrapper.java.additional.19=-Xmx256M
+wrapper.java.additional.20=-Xms128M
+wrapper.java.additional.21=-Xmx256M
# enable remote debugging
-#wrapper.java.additional.20=-agentlib:jdwp=transport=dt_socket,address=8788,server=y,suspend=n
+#wrapper.java.additional.22=-agentlib:jdwp=transport=dt_socket,address=8788,server=y,suspend=n
# disable JVM startup timeout
wrapper.startup.timeout=0
diff --git
a/modules/plugins/rhq-storage/src/main/java/org/rhq/plugins/storage/StorageNodeConfigDelegate.java
b/modules/plugins/rhq-storage/src/main/java/org/rhq/plugins/storage/StorageNodeConfigDelegate.java
index 8d1771d..1667877 100644
---
a/modules/plugins/rhq-storage/src/main/java/org/rhq/plugins/storage/StorageNodeConfigDelegate.java
+++
b/modules/plugins/rhq-storage/src/main/java/org/rhq/plugins/storage/StorageNodeConfigDelegate.java
@@ -19,10 +19,17 @@ import org.rhq.core.util.StringUtil;
public class StorageNodeConfigDelegate implements ConfigurationFacet {
private File jvmOptsFile;
+ private File wrapperEnvFile;
public StorageNodeConfigDelegate(File basedir) {
File confDir = new File(basedir, "conf");
jvmOptsFile = new File(confDir, "cassandra-jvm.properties");
+
+ // for windows, config props also get propagated to the wrapper env
+ if (isWindows()) {
+ File wrapperDir = new File(basedir, "../bin/wrapper");
+ wrapperEnvFile = new File(wrapperDir, "rhq-storage-wrapper.env");
+ }
}
@Override
@@ -56,6 +63,16 @@ public class StorageNodeConfigDelegate implements ConfigurationFacet {
return config;
}
+ /**
+ * Ensure that the path uses only forward slash.
+ * @param path
+ * @return forward-slashed path, or null if path is null
+ */
+ private static String useForwardSlash(String path) {
+
+ return (null != path) ? path.replace('\\', '/') : null;
+ }
+
private String getHeapMinProp(Properties properties) {
String value = properties.getProperty("heap_min");
@@ -115,47 +132,14 @@ public class StorageNodeConfigDelegate implements ConfigurationFacet
{
@Override
public void updateResourceConfiguration(ConfigurationUpdateReport
configurationUpdateReport) {
try {
- PropertiesFileUpdate propertiesUpdater = new
PropertiesFileUpdate(jvmOptsFile.getAbsolutePath());
- Properties properties = propertiesUpdater.loadExistingProperties();
-
Configuration config = configurationUpdateReport.getConfiguration();
- String maxHeapSize = config.getSimpleValue("maxHeapSize");
- if (!StringUtil.isEmpty(maxHeapSize)) {
- validateHeapArg("maxHeapSize", maxHeapSize);
- // We want min and max heap to be the same
- properties.setProperty("heap_min", "-Xms" +
maxHeapSize);
- properties.setProperty("heap_max", "-Xmx" +
maxHeapSize);
- }
-
- String heapNewSize = config.getSimpleValue("heapNewSize");
- if (!StringUtil.isEmpty(heapNewSize)) {
- validateHeapArg("heapNewSize", heapNewSize);
- properties.setProperty("heap_new", "-Xmn" +
heapNewSize);
- }
+ updateCassandraJvmProps(config);
- String threadStackSize = config.getSimpleValue("threadStackSize");
- if (!StringUtil.isEmpty(threadStackSize)) {
- validateStackArg(threadStackSize);
- properties.setProperty("thread_stack_size", "-Xss" +
threadStackSize + "k");
+ if (isWindows()) {
+ updateWrapperEnv(config);
}
- PropertySimple heapDumpOnOMMError =
config.getSimple("heapDumpOnOOMError");
- if (heapDumpOnOMMError != null) {
- if (heapDumpOnOMMError.getBooleanValue()) {
- properties.setProperty("heap_dump_on_OOMError",
"-XX:+HeapDumpOnOutOfMemoryError");
- } else {
- properties.setProperty("heap_dump_on_OOMError",
"");
- }
- }
-
- String heapDumpDir = config.getSimpleValue("heapDumpDir");
- if (!StringUtil.isEmpty(heapDumpDir)) {
- properties.setProperty("heap_dump_dir", heapDumpDir);
- }
-
- propertiesUpdater.update(properties);
-
configurationUpdateReport.setStatus(ConfigurationUpdateStatus.SUCCESS);
} catch (IllegalArgumentException e) {
configurationUpdateReport.setErrorMessage("No configuration update was
applied: " + e.getMessage());
@@ -164,6 +148,88 @@ public class StorageNodeConfigDelegate implements ConfigurationFacet
{
}
}
+ private void updateCassandraJvmProps(Configuration config) throws IOException {
+ PropertiesFileUpdate propertiesUpdater = new
PropertiesFileUpdate(jvmOptsFile.getAbsolutePath());
+ Properties properties = propertiesUpdater.loadExistingProperties();
+
+ String maxHeapSize = config.getSimpleValue("maxHeapSize");
+ if (!StringUtil.isEmpty(maxHeapSize)) {
+ validateHeapArg("maxHeapSize", maxHeapSize);
+ // We want min and max heap to be the same
+ properties.setProperty("heap_min", "-Xms" +
maxHeapSize);
+ properties.setProperty("heap_max", "-Xmx" +
maxHeapSize);
+ }
+
+ String heapNewSize = config.getSimpleValue("heapNewSize");
+ if (!StringUtil.isEmpty(heapNewSize)) {
+ validateHeapArg("heapNewSize", heapNewSize);
+ properties.setProperty("heap_new", "-Xmn" +
heapNewSize);
+ }
+
+ String threadStackSize = config.getSimpleValue("threadStackSize");
+ if (!StringUtil.isEmpty(threadStackSize)) {
+ validateStackArg(threadStackSize);
+ properties.setProperty("thread_stack_size", "-Xss" +
threadStackSize + "k");
+ }
+
+ PropertySimple heapDumpOnOMMError =
config.getSimple("heapDumpOnOOMError");
+ if (heapDumpOnOMMError != null) {
+ if (heapDumpOnOMMError.getBooleanValue()) {
+ properties.setProperty("heap_dump_on_OOMError",
"-XX:+HeapDumpOnOutOfMemoryError");
+ } else {
+ properties.setProperty("heap_dump_on_OOMError", "");
+ }
+ }
+
+ String heapDumpDir =
useForwardSlash(config.getSimpleValue("heapDumpDir"));
+ if (!StringUtil.isEmpty(heapDumpDir)) {
+ properties.setProperty("heap_dump_dir", heapDumpDir);
+ }
+
+ propertiesUpdater.update(properties);
+ }
+
+ private void updateWrapperEnv(Configuration config) throws IOException {
+ PropertiesFileUpdate propertiesUpdater = new
PropertiesFileUpdate(wrapperEnvFile.getAbsolutePath());
+ Properties properties = propertiesUpdater.loadExistingProperties();
+
+ String maxHeapSize = config.getSimpleValue("maxHeapSize");
+ if (!StringUtil.isEmpty(maxHeapSize)) {
+ validateHeapArg("maxHeapSize", maxHeapSize);
+ // We want min and max heap to be the same
+ properties.setProperty("set.heap_min", "-Xms" +
maxHeapSize);
+ properties.setProperty("set.heap_max", "-Xmx" +
maxHeapSize);
+ }
+
+ String heapNewSize = config.getSimpleValue("heapNewSize");
+ if (!StringUtil.isEmpty(heapNewSize)) {
+ validateHeapArg("heapNewSize", heapNewSize);
+ properties.setProperty("set.heap_new", "-Xmn" +
heapNewSize);
+ }
+
+ String threadStackSize = config.getSimpleValue("threadStackSize");
+ if (!StringUtil.isEmpty(threadStackSize)) {
+ validateStackArg(threadStackSize);
+ properties.setProperty("set.thread_stack_size", "-Xss" +
threadStackSize + "k");
+ }
+
+ PropertySimple heapDumpOnOMMError =
config.getSimple("heapDumpOnOOMError");
+ if (heapDumpOnOMMError != null) {
+ if (heapDumpOnOMMError.getBooleanValue()) {
+ properties.setProperty("set.heap_dump_on_OOMError",
"-XX:+HeapDumpOnOutOfMemoryError");
+ } else {
+ properties.setProperty("set.heap_dump_on_OOMError",
"");
+ }
+ }
+
+ String heapDumpDir =
useForwardSlash(config.getSimpleValue("heapDumpDir"));
+ if (!StringUtil.isEmpty(heapDumpDir)) {
+ properties.setProperty("set.heap_dump_dir", heapDumpDir);
+ }
+
+ propertiesUpdater.update(properties);
+ }
+
private void validateHeapArg(String name, String value) {
if (value.length() < 2) {
throw new IllegalArgumentException(value + " is not a legal value for
the property [" + name + "]");
@@ -189,4 +255,8 @@ public class StorageNodeConfigDelegate implements ConfigurationFacet
{
throw new IllegalArgumentException(value + " is not a legal value for
the property [threadStackSize]");
}
}
+
+ private boolean isWindows() {
+ return File.separatorChar == '\\';
+ }
}
commit 969ea38e7254d61903c699380bd066d6cad3e85e
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Jul 22 14:06:39 2013 -0400
When recreating win services make sure they get started appropriately.
diff --git
a/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/AbstractInstall.java
b/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/AbstractInstall.java
index 8c885b0..61c8a9c 100644
---
a/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/AbstractInstall.java
+++
b/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/AbstractInstall.java
@@ -36,12 +36,16 @@ import java.util.Properties;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.exec.DefaultExecuteResultHandler;
import org.apache.commons.exec.DefaultExecutor;
+import org.apache.commons.exec.ExecuteException;
import org.apache.commons.exec.Executor;
import org.apache.commons.exec.PumpStreamHandler;
+
import org.jboss.as.controller.client.ModelControllerClient;
+
import org.rhq.common.jbossas.client.controller.DeploymentJBossASClient;
import org.rhq.common.jbossas.client.controller.MCCHelper;
import org.rhq.server.control.ControlCommand;
+import org.rhq.server.control.RHQControlException;
/**
* Common code for commands that perform installs. Basically shared code for Install and
Upgrade commands.
@@ -55,7 +59,7 @@ public abstract class AbstractInstall extends ControlCommand {
protected final String STORAGE_CONFIG_PROP =
"rhqctl.install.storage-config";
- protected void installWindowsService(File workingDir, String batFile) throws
Exception {
+ protected void installWindowsService(File workingDir, String batFile, boolean start)
throws Exception {
Executor executor = new DefaultExecutor();
executor.setWorkingDirectory(workingDir);
executor.setStreamHandler(new PumpStreamHandler());
@@ -69,6 +73,11 @@ public abstract class AbstractInstall extends ControlCommand {
commandLine = getCommandLine(batFile, "install");
executor.execute(commandLine);
+
+ if (start) {
+ commandLine = getCommandLine(batFile, "start");
+ executor.execute(commandLine);
+ }
}
protected void validateCustomStorageDataDirectories(CommandLine commandLine,
List<String> errors) {
@@ -100,6 +109,54 @@ public abstract class AbstractInstall extends ControlCommand {
}
}
+ protected void waitForProcessToStop(String pid) throws Exception {
+
+ if (isWindows() || pid == null) {
+ // For the moment we have no better way to just wait some time
+ Thread.sleep(10 * 1000L);
+ } else {
+ int tries = 5;
+ while (tries > 0) {
+ log.debug(".");
+ if (!isUnixPidRunning(pid)) {
+ break;
+ }
+ Thread.sleep(2 * 1000L);
+ tries--;
+ }
+ if (tries == 0) {
+ throw new RHQControlException("Process [" + pid
+ + "] did not finish yet. Terminate it manually and
retry.");
+ }
+ }
+
+ }
+
+ protected boolean isUnixPidRunning(String pid) {
+
+ Executor executor = new DefaultExecutor();
+ executor.setWorkingDirectory(getBinDir());
+ executor.setStreamHandler(new PumpStreamHandler());
+ org.apache.commons.exec.CommandLine commandLine;
+
+ commandLine = new
org.apache.commons.exec.CommandLine("/bin/kill").addArgument("-0").addArgument(pid);
+
+ try {
+ int code = executor.execute(commandLine);
+ if (code != 0) {
+ return false;
+ }
+ } catch (ExecuteException ee) {
+ if (ee.getExitValue() == 1) {
+ // return code 1 means process does not exist
+ return false;
+ }
+ } catch (IOException e) {
+ log.error("Checking for running process failed: " +
e.getMessage());
+ }
+ return true;
+ }
+
protected void waitForRHQServerToInitialize() throws Exception {
try {
final long messageInterval = 30000L;
@@ -287,7 +344,6 @@ public abstract class AbstractInstall extends ControlCommand {
log.debug("Stopping RHQ server...");
-
Executor executor = new DefaultExecutor();
executor.setWorkingDirectory(serverBinDir);
executor.setStreamHandler(new PumpStreamHandler());
diff --git
a/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Install.java
b/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Install.java
index bb6aa40..0808db2 100644
---
a/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Install.java
+++
b/modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Install.java
@@ -142,7 +142,7 @@ public class Install extends AbstractInstall {
if (!isStorageInstalled()) {
installStorageNode(getStorageBasedir(), commandLine);
} else if (isWindows()) {
- installWindowsService(getBinDir(), "rhq-storage");
+ installWindowsService(getBinDir(), "rhq-storage", true);
}
if (!isServerInstalled()) {
@@ -150,7 +150,7 @@ public class Install extends AbstractInstall {
runRHQServerInstaller();
waitForRHQServerToInitialize();
} else if (isWindows()) {
- installWindowsService(getBinDir(), "rhq-server");
+ installWindowsService(getBinDir(), "rhq-server", true);
}
if (!isAgentInstalled()) {
@@ -158,13 +158,15 @@ public class Install extends AbstractInstall {
File agentBasedir = getAgentBasedir();
installAgent(agentBasedir);
configureAgent(agentBasedir, commandLine);
- if
(Boolean.parseBoolean(commandLine.getOptionValue(AGENT_AUTOSTART_OPTION,
"true"))) {
+ boolean start =
Boolean.parseBoolean(commandLine.getOptionValue(AGENT_AUTOSTART_OPTION,
"true"));
+ if (start) {
startAgent(agentBasedir, true);
} else {
log.info("The agent was installed but was told not to start
automatically.");
}
} else if (isWindows()) {
- installWindowsService(new File(getAgentBasedir(), "bin"),
"rhq-agent-wrapper");
+ boolean start =
Boolean.parseBoolean(commandLine.getOptionValue(AGENT_AUTOSTART_OPTION,
"true"));
+ installWindowsService(new File(getAgentBasedir(), "bin"),
"rhq-agent-wrapper", start);
}
} else {
@@ -173,7 +175,7 @@ public class Install extends AbstractInstall {
log.info("The RHQ storage node is already installed in
" + new File(getBaseDir(), "storage"));
if (isWindows()) {
- installWindowsService(getBinDir(), "rhq-storage");
+ installWindowsService(getBinDir(), "rhq-storage",
true);
} else {
log.info("Skipping storage node installation.");
}
@@ -200,7 +202,7 @@ public class Install extends AbstractInstall {
log.warn("The RHQ server is already installed.");
if (isWindows()) {
- installWindowsService(getBinDir(), "rhq-server");
+ installWindowsService(getBinDir(), "rhq-server",
true);
} else {
log.info("Skipping server installation.");
}
@@ -217,8 +219,10 @@ public class Install extends AbstractInstall {
if (isAgentInstalled() &&
!commandLine.hasOption(STORAGE_OPTION)) {
log.info("The RHQ agent is already installed in [" +
getAgentBasedir() + "]");
+ boolean start = Boolean
+
.parseBoolean(commandLine.getOptionValue(AGENT_AUTOSTART_OPTION, "true"));
if (isWindows()) {
- installWindowsService(new File(getAgentBasedir(),
"bin"), "rhq-agent-wrapper");
+ installWindowsService(new File(getAgentBasedir(),
"bin"), "rhq-agent-wrapper", start);
} else {
log.info("Skipping agent installation.");
}