modules/common/cassandra-ccm/cassandra-ccm-core/src/main/java/org/rhq/cassandra/Deployer.java
| 44 ++-
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/server-control/src/main/java/org/rhq/server/control/command/AbstractInstall.java
| 60 ++++
modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Install.java
| 18 -
modules/plugins/rhq-storage/src/main/java/org/rhq/plugins/storage/StorageNodeConfigDelegate.java
| 142 +++++++---
7 files changed, 258 insertions(+), 72 deletions(-)
New commits:
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.");
}