[rhq] Branch 'feature/embeddedagent' - modules/enterprise
by mazz
modules/enterprise/server/embeddedagent/pom.xml | 35 ++++++++--
modules/enterprise/server/embeddedagent/src/main/resources/module/main/module.xml | 2
modules/enterprise/server/embeddedagent/src/main/scripts/module-assembly.xml | 7 +-
3 files changed, 34 insertions(+), 10 deletions(-)
New commits:
commit 6ea0f4a402437545178f14687f0c735878cd979c
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon Jan 27 10:37:05 2014 -0500
unpack the entire agent zip inside the module.
diff --git a/modules/enterprise/server/embeddedagent/pom.xml b/modules/enterprise/server/embeddedagent/pom.xml
index 70ecea6..d20815b 100644
--- a/modules/enterprise/server/embeddedagent/pom.xml
+++ b/modules/enterprise/server/embeddedagent/pom.xml
@@ -30,13 +30,28 @@
</resources>
<plugins>
- <!-- COPY AGENT BINARIES <plugin> <artifactId>maven-dependency-plugin</artifactId>
- <executions> <execution> <id>copy-agent</id> <phase>process-resources</phase>
- <goals> <goal>unpack</goal> </goals> <configuration> <artifactItems> <artifactItem>
- <groupId>org.rhq</groupId> <artifactId>rhq-enterprise-server-ear</artifactId>
- <type>ear</type> <outputDirectory>${project.build.directory}/agent/</outputDirectory>
- </artifactItem> </artifactItems> </configuration> </execution> </executions>
- </plugin> -->
+ <plugin>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-agent</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-enterprise-agent</artifactId>
+ <type>zip</type>
+ <outputDirectory>${project.build.directory}</outputDirectory>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
@@ -69,6 +84,12 @@
<artifactId>jboss-as-server</artifactId>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-enterprise-agent</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
<!-- test deps -->
<dependency>
diff --git a/modules/enterprise/server/embeddedagent/src/main/resources/module/main/module.xml b/modules/enterprise/server/embeddedagent/src/main/resources/module/main/module.xml
index 295c78d..662dd31 100644
--- a/modules/enterprise/server/embeddedagent/src/main/resources/module/main/module.xml
+++ b/modules/enterprise/server/embeddedagent/src/main/resources/module/main/module.xml
@@ -4,7 +4,7 @@
<resources>
<resource-root path="${project.build.finalName}.jar"/>
- <!-- <resource-root path="agent" /> -->
+ <resource-root path="rhq-agent" />
</resources>
<dependencies>
diff --git a/modules/enterprise/server/embeddedagent/src/main/scripts/module-assembly.xml b/modules/enterprise/server/embeddedagent/src/main/scripts/module-assembly.xml
index a4cab0a..c526e5c 100644
--- a/modules/enterprise/server/embeddedagent/src/main/scripts/module-assembly.xml
+++ b/modules/enterprise/server/embeddedagent/src/main/scripts/module-assembly.xml
@@ -27,8 +27,11 @@
<directoryMode>0755</directoryMode>
</fileSet>
<fileSet>
- <directory>${project.build.directory}/agent</directory>
- <outputDirectory>/org/rhq/${artifactId}/main/agent</outputDirectory>
+ <directory>${project.build.directory}/rhq-agent</directory>
+ <outputDirectory>/org/rhq/${artifactId}/main/rhq-agent</outputDirectory>
+ <excludes>
+ <exclude>plugins</exclude>
+ </excludes>
<fileMode>0644</fileMode>
<directoryMode>0755</directoryMode>
</fileSet>
10 years, 4 months
[rhq] Changes to 'feature/embeddedagent'
by mazz
New branch 'feature/embeddedagent' available with the following commits:
commit 1f45e29da1e9153169a89741067e1559a5c69f77
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Jan 24 20:25:13 2014 -0500
initial start of the embedded agent as a WildFly extension subsystem.
right now, this is just the shell service. the agent isn't in here yet. but the service
is fully wired into the AS infrastructure and shows in the AS CLI. has a normal model just like all other subsystems.
Now just have to build the module with the agent inside and have the shell call the AgentMain
10 years, 4 months
[rhq] .classpath
by mazz
.classpath | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit 4f60fa0d3c7a182cb615db6bc54e0da98f583af8
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Jan 24 18:49:39 2014 -0500
add source jar to eclipse classpath
diff --git a/.classpath b/.classpath
index f371634..7bd64fe 100644
--- a/.classpath
+++ b/.classpath
@@ -329,7 +329,7 @@
<classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/as/jboss-as-naming/7.2.0.Alpha1-redhat-4/jboss-as-naming-7.2.0.Alpha1-redhat-4.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/as/jboss-as-server/7.2.0.Alpha1-redhat-4/jboss-as-server-7.2.0.Alpha1-redhat-4.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/as/jboss-as-ee/7.2.0.Alpha1-redhat-4/jboss-as-ee-7.2.0.Alpha1-redhat-4.jar"/>
- <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/as/jboss-as-ejb3/7.2.0.Alpha1-redhat-4/jboss-as-ejb3-7.2.0.Alpha1-redhat-4.jar"/>
+ <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/as/jboss-as-ejb3/7.2.0.Alpha1-redhat-4/jboss-as-ejb3-7.2.0.Alpha1-redhat-4.jar" sourcepath="/M2_REPO/org/jboss/as/jboss-as-ejb3/7.2.0.Alpha1-redhat-4/jboss-as-ejb3-7.2.0.Alpha1-redhat-4-sources.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/staxmapper/1.1.0.Final/staxmapper-1.1.0.Final.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/modules/jboss-modules/1.1.1.GA/jboss-modules-1.1.1.GA.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/as/jboss-as-subsystem-test/7.1.1.Final/jboss-as-subsystem-test-7.1.1.Final.jar"/>
10 years, 4 months
[rhq] modules/plugins
by lkrejci
modules/plugins/script/src/main/java/org/rhq/plugins/script/ScriptArgumentParser.java | 41 ++++++----
modules/plugins/script/src/main/java/org/rhq/plugins/script/ScriptDiscoveryComponent.java | 27 ------
modules/plugins/script/src/main/java/org/rhq/plugins/script/ScriptServerComponent.java | 40 +++++++--
modules/plugins/script/src/main/resources/META-INF/rhq-plugin.xml | 13 ++-
modules/plugins/script/src/test/java/org/rhq/plugins/script/ScriptArgumentParserTest.java | 7 +
5 files changed, 76 insertions(+), 52 deletions(-)
New commits:
commit d8e1e71efc8eb3ffcf2729fc4518b37e5cd304e5
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Sat Jan 25 00:08:01 2014 +0100
[BZ 1049608] - Changes to arg parsing in script server plugin
* we by default keep the broken old behavior (blind split by space)
* a boolean plugin prop to switch quoting and escapes on/off
* configurable escape char set to \ for all platforms
* escaping (when switched on) is POSIX-like:
1) In unquoted text: the escape character preserves the value of any
following character
2) In double-quoted text: the escape character escapes " and itself
otherwise is both the escape character and the following character
are left intact
3) In single-quoted text: no escaping can occur
diff --git a/modules/plugins/script/src/main/java/org/rhq/plugins/script/ScriptArgumentParser.java b/modules/plugins/script/src/main/java/org/rhq/plugins/script/ScriptArgumentParser.java
index cd12f0d..a152b1e 100644
--- a/modules/plugins/script/src/main/java/org/rhq/plugins/script/ScriptArgumentParser.java
+++ b/modules/plugins/script/src/main/java/org/rhq/plugins/script/ScriptArgumentParser.java
@@ -10,7 +10,7 @@ import java.util.List;
public final class ScriptArgumentParser {
private enum State {
- SPACE, ESCAPE, ARG, QUOTE
+ SPACE, ESCAPE, ARG, DOUBLE_QUOTE, DOUBLE_QUOTE_ESCAPE, SINGLE_QUOTE
}
private ScriptArgumentParser() {
@@ -18,7 +18,6 @@ public final class ScriptArgumentParser {
public static String[] parse(String args, char escape) {
State state = State.SPACE;
- char activeQuote = '\u0000';
List<String> parsedArgs = new ArrayList<String>();
int i = 0;
@@ -37,9 +36,10 @@ public final class ScriptArgumentParser {
if (c == escape) {
state = State.ESCAPE;
- } else if (isQuote(c)) {
- activeQuote = c;
- state = State.QUOTE;
+ } else if (c == '"') {
+ state = State.DOUBLE_QUOTE;
+ } else if (c == '\'') {
+ state = State.SINGLE_QUOTE;
} else if (isNotWhitespace) {
arg.append(c);
state = State.ARG;
@@ -52,20 +52,35 @@ public final class ScriptArgumentParser {
case ARG:
if (c == escape) {
state = State.ESCAPE;
- } else if (isQuote(c)) {
- activeQuote = c;
- state = State.QUOTE;
+ } else if (c == '"') {
+ state = State.DOUBLE_QUOTE;
+ } else if (c == '\'') {
+ state = State.SINGLE_QUOTE;
} else if (!Character.isWhitespace(c)) {
arg.append(c);
} else {
state = State.SPACE;
}
break;
- case QUOTE:
- if (c == activeQuote) {
+ case DOUBLE_QUOTE:
+ if (c == '"') {
state = State.ARG;
} else if (c == escape) {
- state = State.ESCAPE;
+ state = State.DOUBLE_QUOTE_ESCAPE;
+ } else {
+ arg.append(c);
+ }
+ break;
+ case DOUBLE_QUOTE_ESCAPE:
+ if (c != '"' && c != escape) {
+ arg.append(escape);
+ }
+ arg.append(c);
+ state = State.DOUBLE_QUOTE;
+ break;
+ case SINGLE_QUOTE:
+ if (c == '\'') {
+ state = State.ARG;
} else {
arg.append(c);
}
@@ -88,8 +103,4 @@ public final class ScriptArgumentParser {
bld.delete(0, bld.length());
}
}
-
- private static boolean isQuote(char c) {
- return c == '\'' || c == '"';
- }
}
diff --git a/modules/plugins/script/src/main/java/org/rhq/plugins/script/ScriptDiscoveryComponent.java b/modules/plugins/script/src/main/java/org/rhq/plugins/script/ScriptDiscoveryComponent.java
index 4ee055a..82cf34e 100644
--- a/modules/plugins/script/src/main/java/org/rhq/plugins/script/ScriptDiscoveryComponent.java
+++ b/modules/plugins/script/src/main/java/org/rhq/plugins/script/ScriptDiscoveryComponent.java
@@ -52,11 +52,7 @@ import org.rhq.core.util.exception.ThrowableUtil;
*
* @author John Mazzitelli
*/
-public class ScriptDiscoveryComponent implements ResourceDiscoveryComponent<ResourceComponent<?>>, ManualAddFacet<ResourceComponent<?>>,
- ResourceUpgradeFacet<ResourceComponent<?>> {
-
- public static final String ESCAPE_CHARACTER_PROP_NAME = "escapeCharacter";
- private static final String ESCAPE_CHARACTER_DEFAULT = "__TO_BE_SET_TO_\\_OR_^__";
+public class ScriptDiscoveryComponent implements ResourceDiscoveryComponent<ResourceComponent<?>>, ManualAddFacet<ResourceComponent<?>> {
private final Log log = LogFactory.getLog(ScriptDiscoveryComponent.class);
@@ -128,7 +124,7 @@ public class ScriptDiscoveryComponent implements ResourceDiscoveryComponent<Reso
} else {
String args = pluginConfig.getSimpleValue(ScriptServerComponent.PLUGINCONFIG_DESC_ARGS, null);
ProcessExecutionResults results = ScriptServerComponent.executeExecutable(context
- .getSystemInformation(), pluginConfig, args, 5000L, true);
+ .getSystemInformation(), pluginConfig, args, 5000L, true, ScriptServerComponent.getConfiguredEscapeCharacter(pluginConfig));
if (results != null) {
if (results.getError() != null) {
log.warn("Failed to execute cli executable to get description. Cause: "
@@ -164,23 +160,6 @@ public class ScriptDiscoveryComponent implements ResourceDiscoveryComponent<Reso
return description;
}
- @Override
- public ResourceUpgradeReport upgrade(ResourceUpgradeContext<ResourceComponent<?>> inventoriedResource) {
- PropertySimple escapeCharacter = inventoriedResource.getPluginConfiguration().getSimple(ESCAPE_CHARACTER_PROP_NAME);
-
- if (escapeCharacter != null && !ESCAPE_CHARACTER_DEFAULT.equals(escapeCharacter.getStringValue())) {
- return null;
- }
-
- char escapeChar = File.separatorChar == '/' ? '\\' : '^';
-
- ResourceUpgradeReport report = new ResourceUpgradeReport();
- report.setNewPluginConfiguration(inventoriedResource.getPluginConfiguration().clone());
- report.getNewPluginConfiguration().put(new PropertySimple(ESCAPE_CHARACTER_PROP_NAME, Character.toString(escapeChar)));
-
- return report;
- }
-
/**
* Attempts to determine the version of the resource managed by the CLI.
*
@@ -198,7 +177,7 @@ public class ScriptDiscoveryComponent implements ResourceDiscoveryComponent<Reso
} else {
String args = pluginConfig.getSimpleValue(ScriptServerComponent.PLUGINCONFIG_VERSION_ARGS, null);
ProcessExecutionResults results = ScriptServerComponent.executeExecutable(context
- .getSystemInformation(), pluginConfig, args, 5000L, true);
+ .getSystemInformation(), pluginConfig, args, 5000L, true, ScriptServerComponent.getConfiguredEscapeCharacter(pluginConfig));
if (results != null) {
if (results.getError() != null) {
log.warn("Failed to execute cli executable to get version. Cause: "
diff --git a/modules/plugins/script/src/main/java/org/rhq/plugins/script/ScriptServerComponent.java b/modules/plugins/script/src/main/java/org/rhq/plugins/script/ScriptServerComponent.java
index 7a81a6f..d62f2a1 100644
--- a/modules/plugins/script/src/main/java/org/rhq/plugins/script/ScriptServerComponent.java
+++ b/modules/plugins/script/src/main/java/org/rhq/plugins/script/ScriptServerComponent.java
@@ -78,6 +78,8 @@ public class ScriptServerComponent implements ResourceComponent, MeasurementFace
protected static final String PLUGINCONFIG_DESC_ARGS = "descriptionArguments";
protected static final String PLUGINCONFIG_DESC_REGEX = "descriptionRegex";
protected static final String PLUGINCONFIG_FIXED_DESC = "fixedDescription";
+ protected static final String PLUGINCONFIG_QUOTING_ENABLED = "quotingEnabled";
+ protected static final String PLUGINCONFIG_ESCAPE_CHARACTER = "escapeCharacter";
protected static final String OPERATION_PARAM_ARGUMENTS = "arguments";
protected static final String OPERATION_PARAM_WAIT_TIME = "waitTime";
@@ -90,7 +92,9 @@ public class ScriptServerComponent implements ResourceComponent, MeasurementFace
protected static final String METRIC_PROPERTY_REGEX = "regex";
protected static final String METRIC_PROPERTY_EXITCODE = "exitcode";
- private Configuration resourceConfiguration;
+ protected static final char DISABLING_ESCAPE_CHARACTER = '\u0000';
+
+ private char escapeChar = DISABLING_ESCAPE_CHARACTER;
private ResourceContext resourceContext;
public void start(ResourceContext context) {
@@ -99,6 +103,8 @@ public class ScriptServerComponent implements ResourceComponent, MeasurementFace
}
this.resourceContext = context;
+
+ escapeChar = getConfiguredEscapeCharacter(resourceContext.getPluginConfiguration());
}
public void stop() {
@@ -380,7 +386,7 @@ public class ScriptServerComponent implements ResourceComponent, MeasurementFace
SystemInfo sysInfo = this.resourceContext.getSystemInformation();
Configuration pluginConfig = this.resourceContext.getPluginConfiguration();
ProcessExecutionResults results = executeExecutable(sysInfo, pluginConfig, args, wait, captureOutput,
- killOnTimeout);
+ killOnTimeout, escapeChar);
if (log.isDebugEnabled()) {
logDebug("CLI results: exitcode=[" + results.getExitCode() + "]; error=[" + results.getError()
@@ -390,22 +396,36 @@ public class ScriptServerComponent implements ResourceComponent, MeasurementFace
return results;
}
+
+ protected static char getConfiguredEscapeCharacter(Configuration pluginConfiguration) {
+ char escapeChar = DISABLING_ESCAPE_CHARACTER;
+ boolean quotingEnabled = Boolean.parseBoolean(pluginConfiguration.getSimpleValue(PLUGINCONFIG_QUOTING_ENABLED, "false"));
+ if (quotingEnabled) {
+ String ec = pluginConfiguration.getSimpleValue(PLUGINCONFIG_ESCAPE_CHARACTER, "\\");
+ escapeChar = ec.charAt(0);
+ }
+
+ return escapeChar;
+ }
+
// This is protected static so the discovery component can use it.
protected static ProcessExecutionResults executeExecutable(SystemInfo sysInfo, Configuration pluginConfig,
- String args, long wait, boolean captureOutput) throws InvalidPluginConfigurationException {
+ String args, long wait, boolean captureOutput, char escapeChar) throws InvalidPluginConfigurationException {
- return executeExecutable(sysInfo, pluginConfig, args, wait, captureOutput, true);
+ return executeExecutable(sysInfo, pluginConfig, args, wait, captureOutput, true, escapeChar);
}
private static ProcessExecutionResults executeExecutable(SystemInfo sysInfo, Configuration pluginConfig,
- String args, long wait, boolean captureOutput, boolean killOnTimeout)
+ String args, long wait, boolean captureOutput, boolean killOnTimeout, char escapeChar)
throws InvalidPluginConfigurationException {
ProcessExecution processExecution = getProcessExecutionInfo(pluginConfig);
if (args != null) {
- char escapeChar = pluginConfig.getSimpleValue(ScriptDiscoveryComponent.ESCAPE_CHARACTER_PROP_NAME, "\\").charAt(
- 0);
- processExecution.setArguments(ScriptArgumentParser.parse(args, escapeChar));
+ if (isQuotingEnabled(escapeChar)) {
+ processExecution.setArguments(ScriptArgumentParser.parse(args, escapeChar));
+ } else {
+ processExecution.setArguments(args.split(" "));
+ }
}
processExecution.setCaptureOutput(captureOutput);
processExecution.setWaitForCompletion(wait);
@@ -601,4 +621,8 @@ public class ScriptServerComponent implements ResourceComponent, MeasurementFace
private void logDebug(String msg) {
log.debug("[" + this.resourceContext.getResourceKey() + "]: " + msg);
}
+
+ private static boolean isQuotingEnabled(char escapeChar) {
+ return escapeChar != DISABLING_ESCAPE_CHARACTER;
+ }
}
diff --git a/modules/plugins/script/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/script/src/main/resources/META-INF/rhq-plugin.xml
index 3f63d36..e1a96f2 100644
--- a/modules/plugins/script/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/script/src/main/resources/META-INF/rhq-plugin.xml
@@ -42,9 +42,16 @@
<c:simple-property name="descriptionRegex" required="false" description="The regex that can pick out the description from the executable output. If the regex has a captured group, its matched content will be used as the description. If there is no captured group, the entire output will be used as the description."/>
<c:simple-property name="fixedDescription" required="false" description="If specified, this will be the description of the managed resource - the executable will not be invoked to determine it." />
</c:group>
- <c:group name="advanced" displayName="Advanced">
- <c:simple-property name="escapeCharacter" required="true" description="The escape character to be used when parsing arguments. By default this is (without quotes) '^' on Windows and '\' everywhere else."
- default="__TO_BE_SET_TO_\_OR_^__">
+ <c:group name="argumentsParsing" displayName="Parsing of Arguments">
+ <c:simple-property name="quotingEnabled" displayName="Enable Quoting of Arguments" required="true" type="boolean" default="false">
+ <c:description>
+ 1) In unquoted text: the escape character preserves the value of any following character
+ 2) In double-quoted text: the escape character escapes " and itself otherwise is both the escape character and the following character are left intact
+ 3) In single-quoted text: no escaping can occur
+ </c:description>
+ </c:simple-property>
+ <c:simple-property name="escapeCharacter" required="true" description="The escape character to be used when parsing arguments. By default the escape character is backslash."
+ default="\">
<c:constraint>
<c:regex-constraint expression="." />
</c:constraint>
diff --git a/modules/plugins/script/src/test/java/org/rhq/plugins/script/ScriptArgumentParserTest.java b/modules/plugins/script/src/test/java/org/rhq/plugins/script/ScriptArgumentParserTest.java
index 67a88c0..5c30200 100644
--- a/modules/plugins/script/src/test/java/org/rhq/plugins/script/ScriptArgumentParserTest.java
+++ b/modules/plugins/script/src/test/java/org/rhq/plugins/script/ScriptArgumentParserTest.java
@@ -2,6 +2,7 @@ package org.rhq.plugins.script;
import static org.testng.Assert.assertEquals;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
@@ -19,12 +20,14 @@ public class ScriptArgumentParserTest {
testCases.put("1 2\t3", new String[]{"1", "2", "3"});
testCases.put("1 '2 ' \"3'\" '4'abs '5\"'", new String[]{"1", "2 ", "3'", "4abs", "5\""});
- testCases.put("\\ \\2 '3\\'a'", new String[]{" ", "2", "3'a"});
+ testCases.put("\\ \\2 '3\\'\\'a'", new String[]{" ", "2", "3\\'a"});
+ testCases.put("\"C:\\Program Files\\Lukas' \\\"Tests\\\"\\1\"", new String[]{"C:\\Program Files\\Lukas' \"Tests\"\\1"});
for(Map.Entry<String, String[]> testCase : testCases.entrySet()) {
String[] result = ScriptArgumentParser.parse(testCase.getKey(), '\\');
- assertEquals(result, testCase.getValue(), "Failed to parse [" + testCase.getKey() + "]");
+ assertEquals(result, testCase.getValue(), "Failed to parse [" + testCase.getKey() + "]. Expected: " + Arrays
+ .asList(testCase.getValue()) + ", but got: " + Arrays.asList(result));
}
}
}
10 years, 4 months
[rhq] Branch 'bug/840403' - modules/plugins
by Thomas Segismont
modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit caa811cb07b29c3678ad9158e3c1d10166996ca3
Author: Thomas Segismont <tsegismo(a)redhat.com>
Date: Fri Jan 24 21:48:35 2014 +0100
Fix misleading comment
diff --git a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
index 161a494..96d0fd9 100644
--- a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
@@ -172,7 +172,7 @@
</c:property-options>
</c:simple-property>
<c:simple-property name="keystorePassword" required="false" type="password" description="Password protecting the custom keystore file"/>
- <c:simple-property name="keyPassword" required="false" type="password" description="Password protecting a key in the custom keystore file"/>
+ <c:simple-property name="keyPassword" required="false" type="password" description="Password protecting the secret key in the custom keystore file"/>
</c:group>
'>
10 years, 4 months
[rhq] Branch 'jsanda/throttling' - modules/enterprise
by John Sanda
modules/enterprise/server/server-metrics/src/main/java/org/rhq/server/metrics/aggregation/Aggregate1HourData.java | 3 +
modules/enterprise/server/server-metrics/src/main/java/org/rhq/server/metrics/aggregation/AggregateIndexEntriesHandler.java | 16 ++++++++--
modules/enterprise/server/server-metrics/src/main/java/org/rhq/server/metrics/aggregation/AggregateRawData.java | 3 +
modules/enterprise/server/server-metrics/src/main/java/org/rhq/server/metrics/aggregation/Compute24HourData.java | 5 +++
modules/enterprise/server/server-metrics/src/main/java/org/rhq/server/metrics/aggregation/Compute6HourData.java | 5 +++
5 files changed, 30 insertions(+), 2 deletions(-)
New commits:
commit 9940a9a6f540e88d5d75e2ea38421c6dadb01bb1
Author: John Sanda <jsanda(a)redhat.com>
Date: Fri Jan 24 15:19:03 2014 -0500
[BZ 1045589] fixing another pootential bug in aggregation code
If we fail to retrieve the index entries for 1 hr or 6 hr data for whatever
reason, then the counters for remaining data to be aggregated gets screwed up.
This commit fixes that.
diff --git a/modules/enterprise/server/server-metrics/src/main/java/org/rhq/server/metrics/aggregation/Aggregate1HourData.java b/modules/enterprise/server/server-metrics/src/main/java/org/rhq/server/metrics/aggregation/Aggregate1HourData.java
index 79a845e..702b64f 100644
--- a/modules/enterprise/server/server-metrics/src/main/java/org/rhq/server/metrics/aggregation/Aggregate1HourData.java
+++ b/modules/enterprise/server/server-metrics/src/main/java/org/rhq/server/metrics/aggregation/Aggregate1HourData.java
@@ -125,6 +125,9 @@ class Aggregate1HourData implements Runnable {
// continue generating 6 hour data because we do not need the index
// here since we already have 6 hour data to aggregate along with the
// schedule ids.
+ log.debug("The wait for 6 hour index entries has been aborted. Proceeding with scheduling computation of " +
+ "1 hour aggregates for previously assigned schedules.");
+ state.getRemaining6HourData().addAndGet(scheduleIds.size());
}
}
}
diff --git a/modules/enterprise/server/server-metrics/src/main/java/org/rhq/server/metrics/aggregation/AggregateIndexEntriesHandler.java b/modules/enterprise/server/server-metrics/src/main/java/org/rhq/server/metrics/aggregation/AggregateIndexEntriesHandler.java
index cb64fcf..f8c5318 100644
--- a/modules/enterprise/server/server-metrics/src/main/java/org/rhq/server/metrics/aggregation/AggregateIndexEntriesHandler.java
+++ b/modules/enterprise/server/server-metrics/src/main/java/org/rhq/server/metrics/aggregation/AggregateIndexEntriesHandler.java
@@ -49,13 +49,25 @@ class AggregateIndexEntriesHandler implements FutureCallback<ResultSet> {
for (Row row : resultSet) {
indexEntries.add(row.getInt(1));
}
- remainingData.set(indexEntries.size());
- indexEntriesArrival.countDown();
+
+ // Even if indexInetries is empty, it is possible (though unlikely) that a subsequent query could return a
+ // non-empty result set. This might happen if the index was updated at the very end of the last time slice, and
+ // we do an inconsistent read. When it is empty, abort() is called to let the AggregateXXXData objects know that
+ // the should update remainingData.
+ if (indexEntries.isEmpty()) {
+ indexEntriesArrival.abort();
+ } else {
+ remainingData.set(indexEntries.size());
+ indexEntriesArrival.countDown();
+ }
+
stopwatch.stop();
+
if (log.isDebugEnabled()) {
log.debug("Finished loading " + indexEntries.size() + " " + src + " index entries in " +
stopwatch.elapsed(TimeUnit.MILLISECONDS) + " ms");
}
+
}
@Override
diff --git a/modules/enterprise/server/server-metrics/src/main/java/org/rhq/server/metrics/aggregation/AggregateRawData.java b/modules/enterprise/server/server-metrics/src/main/java/org/rhq/server/metrics/aggregation/AggregateRawData.java
index 3b123b8..7ea6ce7 100644
--- a/modules/enterprise/server/server-metrics/src/main/java/org/rhq/server/metrics/aggregation/AggregateRawData.java
+++ b/modules/enterprise/server/server-metrics/src/main/java/org/rhq/server/metrics/aggregation/AggregateRawData.java
@@ -136,6 +136,9 @@ class AggregateRawData implements Runnable {
// continue generating 1 hour data because we do not need the index
// here since we already have 1 hour data to aggregate along with the
// schedule ids.
+ log.debug("The wait for 1 hour index entries has been aborted. Proceeding with scheduling computation of " +
+ "1 hour aggregates for previously assigned schedules.");
+ state.getRemaining1HourData().addAndGet(scheduleIds.size());
}
}
}
diff --git a/modules/enterprise/server/server-metrics/src/main/java/org/rhq/server/metrics/aggregation/Compute24HourData.java b/modules/enterprise/server/server-metrics/src/main/java/org/rhq/server/metrics/aggregation/Compute24HourData.java
index 21a9e78..2d66b55 100644
--- a/modules/enterprise/server/server-metrics/src/main/java/org/rhq/server/metrics/aggregation/Compute24HourData.java
+++ b/modules/enterprise/server/server-metrics/src/main/java/org/rhq/server/metrics/aggregation/Compute24HourData.java
@@ -79,6 +79,11 @@ class Compute24HourData implements AsyncFunction<List<ResultSet>, List<ResultSet
ArithmeticMeanCalculator mean = new ArithmeticMeanCalculator();
List<Row> rows = resultSet.all();
+ // Inserting an aggregate metric currently requires three writes. If one of those writes fails, we could wind
+ // update with an IndexOutOfBoundsException in the loop below because it assumes rows.size() % 3 == 0 and that
+ // would could be false if writes fail. This won't be an issue though when the changes for BZ 1049054 are
+ // implemented, and this long comment can then be deleted.
+
for (int i = 0; i < rows.size(); i += 3) {
if (i == 0) {
min = rows.get(i + 1).getDouble(3);
diff --git a/modules/enterprise/server/server-metrics/src/main/java/org/rhq/server/metrics/aggregation/Compute6HourData.java b/modules/enterprise/server/server-metrics/src/main/java/org/rhq/server/metrics/aggregation/Compute6HourData.java
index d8ed0eb..d1eb284 100644
--- a/modules/enterprise/server/server-metrics/src/main/java/org/rhq/server/metrics/aggregation/Compute6HourData.java
+++ b/modules/enterprise/server/server-metrics/src/main/java/org/rhq/server/metrics/aggregation/Compute6HourData.java
@@ -86,6 +86,11 @@ class Compute6HourData implements AsyncFunction<List<ResultSet>, List<ResultSet>
ArithmeticMeanCalculator mean = new ArithmeticMeanCalculator();
List<Row> rows = resultSet.all();
+ // Inserting an aggregate metric currently requires three writes. If one of those writes fails, we could wind
+ // update with an IndexOutOfBoundsException in the loop below because it assumes rows.size() % 3 == 0 and that
+ // would could be false if writes fail. This won't be an issue though when the changes for BZ 1049054 are
+ // implemented, and this long comment can then be deleted.
+
for (int i = 0; i < rows.size(); i += 3) {
if (i == 0) {
min = rows.get(i + 1).getDouble(3);
10 years, 4 months
[rhq] Branch 'jsanda/throttling' - modules/helpers
by John Sanda
modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/MeasurementAggregator.java | 4 ++--
modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/MeasurementCollector.java | 7 ++++++-
modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/MeasurementReader.java | 6 +++++-
modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/Simulator.java | 5 -----
modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/plan/SimulationPlanner.java | 1 +
5 files changed, 14 insertions(+), 9 deletions(-)
New commits:
commit 4c1cd5e1170b1d28319d196df705e10bccd9bcf7
Author: John Sanda <jsanda(a)redhat.com>
Date: Fri Jan 24 14:22:13 2014 -0500
adjusting logging and making readers more configurable
diff --git a/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/MeasurementAggregator.java b/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/MeasurementAggregator.java
index b5f61f3..f1ef747 100644
--- a/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/MeasurementAggregator.java
+++ b/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/MeasurementAggregator.java
@@ -67,7 +67,7 @@ public class MeasurementAggregator implements Runnable {
Timer.Context context = metrics.totalAggregationTime.time();
long start = System.currentTimeMillis();
try {
- log.debug("Starting metrics aggregation");
+ log.info("Starting metrics aggregation");
metricsServer.calculateAggregates();
} catch (Exception e) {
log.error("An error occurred while trying to perform aggregation", e);
@@ -75,7 +75,7 @@ public class MeasurementAggregator implements Runnable {
shutdownManager.shutdown(1);
} finally {
context.stop();
- log.debug("Finished metrics aggregation in " + (System.currentTimeMillis() - start) + " ms");
+ log.info("Finished metrics aggregation in " + (System.currentTimeMillis() - start) + " ms");
metrics.totalAggregationRuns.inc();
}
}
diff --git a/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/MeasurementCollector.java b/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/MeasurementCollector.java
index 531ba96..5968b8e 100644
--- a/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/MeasurementCollector.java
+++ b/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/MeasurementCollector.java
@@ -28,8 +28,10 @@ package org.rhq.metrics.simulator;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.ThreadLocalRandom;
+import java.util.concurrent.TimeUnit;
import com.codahale.metrics.Timer;
+import com.google.common.base.Stopwatch;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -80,10 +82,13 @@ public class MeasurementCollector implements Runnable {
@Override
public void run() {
final Timer.Context context = metrics.batchInsertTime.time();
+ final Stopwatch stopwatch = new Stopwatch().start();
metricsServer.addNumericData(generateData(), new RawDataInsertedCallback() {
@Override
public void onFinish() {
- context.stop();
+ stopwatch.stop();
+ log.info("Finished inserting raw data in " + stopwatch.elapsed(TimeUnit.MILLISECONDS) + " ms");
+ context.stop();
}
@Override
diff --git a/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/MeasurementReader.java b/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/MeasurementReader.java
index a7525b6..510ac43 100644
--- a/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/MeasurementReader.java
+++ b/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/MeasurementReader.java
@@ -2,8 +2,10 @@ package org.rhq.metrics.simulator;
import java.util.Iterator;
import java.util.concurrent.ThreadLocalRandom;
+import java.util.concurrent.TimeUnit;
import com.codahale.metrics.Timer;
+import com.google.common.base.Stopwatch;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -43,6 +45,7 @@ public class MeasurementReader implements Runnable {
@Override
public void run() {
Timer.Context context = metrics.totalReadTime.time();
+ Stopwatch stopwatch = new Stopwatch().start();
try {
log.info("Running metrics queries");
@@ -55,7 +58,8 @@ public class MeasurementReader implements Runnable {
findResourceDataForPast31Days(random.nextInt(startingSchedule, bound));
findResourceDataForPastYear(random.nextInt(startingSchedule, bound));
} finally {
- log.info("Finished running metrics queries");
+ stopwatch.stop();
+ log.info("Finished running metrics queries in " + stopwatch.elapsed(TimeUnit.MILLISECONDS) + " ms");
context.stop();
}
}
diff --git a/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/Simulator.java b/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/Simulator.java
index a3d1eed..eca1f89 100644
--- a/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/Simulator.java
+++ b/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/Simulator.java
@@ -201,11 +201,6 @@ public class Simulator implements ShutdownManager {
@SuppressWarnings("deprecation")
private Session initSession(Cluster cluster) {
- NodeFailureListener listener = new NodeFailureListener();
- for (Host host : cluster.getMetadata().getAllHosts()) {
- host.getMonitor().register(listener);
- }
-
return cluster.connect("rhq");
}
diff --git a/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/plan/SimulationPlanner.java b/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/plan/SimulationPlanner.java
index 02c29e8..fb054cb 100644
--- a/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/plan/SimulationPlanner.java
+++ b/modules/helpers/metrics-simulator/src/main/java/org/rhq/metrics/simulator/plan/SimulationPlanner.java
@@ -75,6 +75,7 @@ public class SimulationPlanner {
simulation.setAggregationInterval(3600000L);
simulation.setMetricsReportInterval(getInt(root.get("metricsReportInterval"), 1200));
simulation.setSimulationRate(1000);
+ simulation.setMetricsServerConfiguration(new MetricsConfiguration());
dateTimeService = new DateTimeService();
}
10 years, 4 months
[rhq] Changes to 'jsanda/throttling'
by John Sanda
New branch 'jsanda/throttling' available with the following commits:
commit ca689495d9504accc3dc243d232dca894e7b6a29
Author: John Sanda <jsanda(a)redhat.com>
Date: Fri Jan 24 14:14:03 2014 -0500
[BZ 1045589] first cut at auto-throttling of C* client requests
There are a few noteworthy changes in this commit. First, all RateLimiter calls
have been pushed down into StorageSession. Secondly, logic has been added in
StorageSession for reducing request throughput when there is a client side
timeout. Lastly, a bug in the aggregation code has been fixed. In
Compute1HourData, Compute6HourData, and Compute24HourData, it is possible that
the list of resultsets could contain nulls if any of the queries to fetch data
failed. Checks have been added to avoid NPEs.
10 years, 4 months
[rhq] modules/enterprise
by Jay Shaughnessy
modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanTest.java | 28 ++++------
1 file changed, 12 insertions(+), 16 deletions(-)
New commits:
commit 83b265871656c2ae21b5c2333b7d4b58d90b078f
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Jan 24 13:52:26 2014 -0500
Fix Test
diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanTest.java
index 4de1380..9a30f9d 100644
--- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanTest.java
+++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanTest.java
@@ -746,10 +746,11 @@ public class ConfigurationManagerBeanTest extends AbstractEJB3Test {
*/
@Test(enabled = ENABLE_TESTS)
public void testResourceConfigurationDefinitionsOptions() throws Exception {
- Resource resource = newResource1;
- Subject overlord = LookupUtil.getSubjectManager().getOverlord();
ConfigurationManagerLocal configurationManager = LookupUtil.getConfigurationManager();
+
getTransactionManager().begin();
+ Resource resource = em.find(Resource.class, newResource1.getId());
+ Subject overlord = LookupUtil.getSubjectManager().getOverlord();
try {
// this is simulating what the UI would be doing, build the config and call the server-side API
@@ -759,20 +760,16 @@ public class ConfigurationManagerBeanTest extends AbstractEJB3Test {
int loadCount = 300;
HashSet<String> parsedNames = new HashSet<String>();
for (int i = 0; i < loadCount; i++) {
- String name = "fake property" + i;
+ String name = "fakeProperty_" + i;
initialDefinition
- .put(new PropertyDefinitionSimple(name, "fake" + i, false, PropertySimpleType.BOOLEAN));
+ .put(new PropertyDefinitionSimple(name, "fake_" + i, false, PropertySimpleType.BOOLEAN));
parsedNames.add(name);
}
newResource1Type.setResourceConfigurationDefinition(initialDefinition);
- em.merge(newResource1Type);
- em.flush();
-
- Configuration configuration = new Configuration();
- configuration.put(new PropertySimple("myboolean", "true"));
+ newResource1Type = em.merge(newResource1Type);
+ em.flush(); // so that slsb calls below will see the change reflected in the db
- ConfigurationDefinition configurationDefinition = newResource1.getResourceType()
- .getResourceConfigurationDefinition();
+ ConfigurationDefinition configurationDefinition = newResource1Type.getResourceConfigurationDefinition();
assert configurationDefinition != null : "Configuration Definition could not be located.";
//retrieve the options for ConfigurationDefinition
ConfigurationDefinition options = configurationManager.getOptionsForConfigurationDefinition(overlord,
@@ -786,15 +783,14 @@ public class ConfigurationManagerBeanTest extends AbstractEJB3Test {
for (Map.Entry<String, PropertyDefinition> entry : options.getPropertyDefinitions().entrySet()) {
PropertyDefinition pd = entry.getValue();
if (pd instanceof PropertyDefinitionSimple) {
- PropertyDefinitionSimple pds = (PropertyDefinitionSimple) pd;
- locatedPropertyDefSimple = pds;
+ locatedPropertyDefSimple = (PropertyDefinitionSimple) pd;
locatedCount++;
- parsedNames.remove(pds.getName());
+ parsedNames.remove(locatedPropertyDefSimple.getName());
}
}
assert locatedPropertyDefSimple != null : "PropertyDefinitionSimple was not located!";
- assert locatedCount >= loadCount : "All expected properties were not loaded. Found '" + locatedCount + "'.";
- assert parsedNames.size() == 0 : "Not all loaded options were parsed.";
+ assert locatedCount != loadCount : "All expected properties were not loaded. Found '" + locatedCount + "'.";
+ assert parsedNames.isEmpty() : "Not all loaded options were parsed.";
} finally {
getTransactionManager().rollback();
10 years, 4 months