[rhq] 3 commits - etc/rhq-ircBot modules/enterprise
by Jiri Kremser
etc/rhq-ircBot/src/main/resources/org/rhq/etc/ircbot/cacerts.jks |binary
modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-navigation/content-plain-navigation.xml | 2 +-
modules/enterprise/server/server-control/src/main/java/org/rhq/server/control/command/Install.java | 2 +-
3 files changed, 2 insertions(+), 2 deletions(-)
New commits:
commit b207dd177913f28f74d0c87720ab17f18138272c
Author: Jirka Kremser <jkremser(a)redhat.com>
Date: Tue Oct 29 15:23:57 2013 +0100
Fixing a typo: the default storage node directory is called rhq-storage.
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 4cc2b3b..d78d9cb 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
@@ -127,7 +127,7 @@ public class Install extends AbstractInstall {
if (installStorage) {
if (isStorageInstalled()) {
- log.info("The RHQ storage node is already installed in [" + new File(getBaseDir(), "storage")
+ log.info("The RHQ storage node is already installed in [" + new File(getBaseDir(), "rhq-storage")
+ "]. It will not be installed.");
if (isWindows()) {
commit 1ff05771a922f171f18be00cb634f092aa021c3c
Author: Jirka Kremser <jkremser(a)redhat.com>
Date: Fri Oct 25 17:01:39 2013 +0200
[BZ 1015436] - [portal.war] unable to update package content via UI - JSF navigation rules magic
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-navigation/content-plain-navigation.xml b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-navigation/content-plain-navigation.xml
index 5c72e1f..e95d9fd 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-navigation/content-plain-navigation.xml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/WEB-INF/jsf-navigation/content-plain-navigation.xml
@@ -159,7 +159,7 @@
<navigation-case>
<from-action>#{CreateNewPackageUIBean.createPackage}</from-action>
<from-outcome>success</from-outcome>
- <to-view-id>/portal/rhq/resource/content/confirm-create-plain.xhtml</to-view-id>
+ <to-view-id>/rhq/resource/content/confirm-create-plain.xhtml</to-view-id>
</navigation-case>
<navigation-case>
commit fe2edda0aebdb97925baff4214584095fc39fba3
Author: Jirka Kremser <jkremser(a)redhat.com>
Date: Fri Oct 25 14:51:26 2013 +0200
irc bot: adding the RH certificate authority instead of particular certificates that are periodically being replaced with whatever reason.
diff --git a/etc/rhq-ircBot/src/main/resources/org/rhq/etc/ircbot/cacerts.jks b/etc/rhq-ircBot/src/main/resources/org/rhq/etc/ircbot/cacerts.jks
index 94185a4..9e605e3 100644
Binary files a/etc/rhq-ircBot/src/main/resources/org/rhq/etc/ircbot/cacerts.jks and b/etc/rhq-ircBot/src/main/resources/org/rhq/etc/ircbot/cacerts.jks differ
10 years, 6 months
[rhq] Branch 'mtho11/bz1014571' - modules/enterprise
by mike thompson
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractD3GraphListView.java | 4 +++-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/graph/ButtonBarDateTimeRangeEditor.java | 2 +-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/MeasurementUserPreferences.java | 4 ++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/UserPreferences.java | 2 --
4 files changed, 8 insertions(+), 4 deletions(-)
New commits:
commit 20d86d50221eae48bf6b753b43ba0956687c1a55
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Mon Oct 28 20:14:26 2013 -0700
[BZ 1014571 ] Fix issue with chart drag date selection not keeping the opened charts across a refresh. Turn off the autosave that triggers an autorefresh for a drag selection.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractD3GraphListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractD3GraphListView.java
index 077a504..f9e7e5a 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractD3GraphListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractD3GraphListView.java
@@ -88,7 +88,9 @@ public abstract class AbstractD3GraphListView extends EnhancedVLayout implements
if (isVisible() && !isRefreshing()) {
isRefreshing = true;
try {
- buttonBarDateTimeRangeEditor.updateTimeRangeToNow();
+ if(!buttonBarDateTimeRangeEditor.isCustomTimeRangeActive()){
+ buttonBarDateTimeRangeEditor.updateTimeRangeToNow();
+ }
refreshData();
} finally {
isRefreshing = false;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/graph/ButtonBarDateTimeRangeEditor.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/graph/ButtonBarDateTimeRangeEditor.java
index 561f961..8e73e06 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/graph/ButtonBarDateTimeRangeEditor.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/graph/ButtonBarDateTimeRangeEditor.java
@@ -210,7 +210,7 @@ public class ButtonBarDateTimeRangeEditor extends EnhancedVLayout {
if (null != prefs.begin && null != prefs.end && prefs.begin > prefs.end) {
CoreGUI.getMessageCenter().notify(new Message(MSG.view_measureTable_startBeforeEnd()));
} else {
- measurementUserPreferences.setMetricRangePreferences(prefs, allowPreferenceUpdateRefresh);
+ measurementUserPreferences.setMetricRangePreferencesNoRefresh(prefs);
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/MeasurementUserPreferences.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/MeasurementUserPreferences.java
index 50d5400..07e95e4 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/MeasurementUserPreferences.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/MeasurementUserPreferences.java
@@ -100,6 +100,10 @@ public class MeasurementUserPreferences {
setMetricRangePreferences(prefs, true);
}
+ public void setMetricRangePreferencesNoRefresh(MetricRangePreferences prefs) {
+ setMetricRangePreferences(prefs, false);
+ }
+
/**
* @param prefs The updated preferences
* @param allowRefresh setting false will inhibit a preference change from calling CoreGui.refresh(). By
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/UserPreferences.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/UserPreferences.java
index a897969..83abeaf 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/UserPreferences.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/preferences/UserPreferences.java
@@ -58,8 +58,6 @@ public class UserPreferences {
preferencesThatShouldNeverCauseRefresh.add(UserPreferenceNames.RECENT_RESOURCES);
// this is auto-set while navigating around and does not affect the current page
preferencesThatShouldNeverCauseRefresh.add(UserPreferenceNames.RECENT_RESOURCE_GROUPS);
- // for graphs changing the date will not autoupdate when we already handle it
- preferencesThatShouldNeverCauseRefresh.add(UserPreferenceNames.MONITOR_VISIBILITY_METRIC_RANGE);
// this update is already applied to current portlets by the dashboard impl
preferencesThatShouldNeverCauseRefresh.add(UserPreferenceNames.PAGE_REFRESH_PERIOD);
}
10 years, 6 months
[rhq] Branch 'release/jon3.2.x' - modules/enterprise
by mazz
modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/help/HelpView.java | 9 ++++-----
modules/enterprise/gui/coregui/src/main/resources/org/rhq/coregui/client/MessageConstants.properties | 4 +---
2 files changed, 5 insertions(+), 8 deletions(-)
New commits:
commit 9d404bcb7f114a72a275dcbd1aceda57bda7dca8
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon Oct 28 19:27:50 2013 -0400
BZ 1014603 - this really isn't necessary for this BZ but it does clean up the help icons that are associated with the help links. we now use the new help icon
(cherry picked from commit 0ba38a7e2532c04e7f6f196ad0e19946fbfd1f82)
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/help/HelpView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/help/HelpView.java
index 42bc376..e571e17 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/help/HelpView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/help/HelpView.java
@@ -79,7 +79,6 @@ public class HelpView extends AbstractSectionedLeftNavigationView {
EnhancedVLayout vLayout = new EnhancedVLayout();
vLayout.setWidth100();
- // TODO: Help icon.
TitleBar titleBar = new TitleBar(MSG.common_title_help(), VIEW_ID.getIcon().getIcon24x24Path());
vLayout.addMember(titleBar);
@@ -92,8 +91,8 @@ public class HelpView extends AbstractSectionedLeftNavigationView {
private NavigationSection buildProductSection() {
- NavigationItem aboutItem = new NavigationItem(new ViewName("AboutBox", MSG.view_help_section_product_about()),
- "[SKIN]/../actions/help.png", new ViewFactory() {
+ NavigationItem aboutItem = new NavigationItem(new ViewName("AboutBox", MSG.view_help_section_product_about(),
+ IconEnum.HELP), new ViewFactory() {
public Canvas createView() {
final AboutModalWindow aboutModalWindow = new AboutModalWindow(productInfo);
aboutModalWindow.show();
@@ -122,10 +121,10 @@ public class HelpView extends AbstractSectionedLeftNavigationView {
try {
icon = this.getContent("view_help_section_" + i + "_propIcon_" + j);
if (icon == null) {
- icon = "[SKIN]/../headerIcons/document.png";
+ icon = IconEnum.HELP.getIcon16x16Path();
}
} catch (MissingResourceException e) {
- icon = "[SKIN]/../headerIcons/document.png";
+ icon = IconEnum.HELP.getIcon16x16Path();
}
final String itemName = "Section" + i + "Item" + j;
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/coregui/client/MessageConstants.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/coregui/client/MessageConstants.properties
index 6295970..65298be 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/coregui/client/MessageConstants.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/coregui/client/MessageConstants.properties
@@ -24,7 +24,7 @@
# M = 1..numSectionItems
#
# view_help_section_N_propTitle_M = localized title for the help (required)
-# view_help_section_N_propIcon_M = icon path (optional, defaults to document icon)
+# view_help_section_N_propIcon_M = icon path (optional, defaults to help icon)
# view_help_section_N_propUrl_M = url for the help (required)
#
view_help_section_count = 2
@@ -49,8 +49,6 @@ view_help_section_2_propUrl_1 = https://docs.jboss.org/author/display/RHQ/Demo
view_help_section_2_propTitle_2 = Demo: Bundle Provisioning
view_help_section_2_propUrl_2 = http://management-platform.blogspot.com/2011/01/bundle-provisioning-via-r...
view_help_section_2_propTitle_3 = How to build Group Definitions
-view_help_section_2_propIcon_3 = [SKIN]/../actions/help.png
view_help_section_2_propUrl_3 = https://docs.jboss.org/author/display/RHQ/Group+Definitions
view_help_section_2_propTitle_4 = How to use the Search Bar
-view_help_section_2_propIcon_4 = [SKIN]/../actions/help.png
view_help_section_2_propUrl_4 = https://docs.jboss.org/author/display/RHQ/Search
10 years, 6 months
[rhq] modules/enterprise
by mazz
modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/help/HelpView.java | 9 ++++-----
modules/enterprise/gui/coregui/src/main/resources/org/rhq/coregui/client/MessageConstants.properties | 4 +---
2 files changed, 5 insertions(+), 8 deletions(-)
New commits:
commit 0ba38a7e2532c04e7f6f196ad0e19946fbfd1f82
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon Oct 28 19:27:50 2013 -0400
BZ 1014603 - this really isn't necessary for this BZ but it does clean up the help icons that are associated with the help links. we now use the new help icon
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/help/HelpView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/help/HelpView.java
index 42bc376..e571e17 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/help/HelpView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/help/HelpView.java
@@ -79,7 +79,6 @@ public class HelpView extends AbstractSectionedLeftNavigationView {
EnhancedVLayout vLayout = new EnhancedVLayout();
vLayout.setWidth100();
- // TODO: Help icon.
TitleBar titleBar = new TitleBar(MSG.common_title_help(), VIEW_ID.getIcon().getIcon24x24Path());
vLayout.addMember(titleBar);
@@ -92,8 +91,8 @@ public class HelpView extends AbstractSectionedLeftNavigationView {
private NavigationSection buildProductSection() {
- NavigationItem aboutItem = new NavigationItem(new ViewName("AboutBox", MSG.view_help_section_product_about()),
- "[SKIN]/../actions/help.png", new ViewFactory() {
+ NavigationItem aboutItem = new NavigationItem(new ViewName("AboutBox", MSG.view_help_section_product_about(),
+ IconEnum.HELP), new ViewFactory() {
public Canvas createView() {
final AboutModalWindow aboutModalWindow = new AboutModalWindow(productInfo);
aboutModalWindow.show();
@@ -122,10 +121,10 @@ public class HelpView extends AbstractSectionedLeftNavigationView {
try {
icon = this.getContent("view_help_section_" + i + "_propIcon_" + j);
if (icon == null) {
- icon = "[SKIN]/../headerIcons/document.png";
+ icon = IconEnum.HELP.getIcon16x16Path();
}
} catch (MissingResourceException e) {
- icon = "[SKIN]/../headerIcons/document.png";
+ icon = IconEnum.HELP.getIcon16x16Path();
}
final String itemName = "Section" + i + "Item" + j;
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/coregui/client/MessageConstants.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/coregui/client/MessageConstants.properties
index 6295970..65298be 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/coregui/client/MessageConstants.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/coregui/client/MessageConstants.properties
@@ -24,7 +24,7 @@
# M = 1..numSectionItems
#
# view_help_section_N_propTitle_M = localized title for the help (required)
-# view_help_section_N_propIcon_M = icon path (optional, defaults to document icon)
+# view_help_section_N_propIcon_M = icon path (optional, defaults to help icon)
# view_help_section_N_propUrl_M = url for the help (required)
#
view_help_section_count = 2
@@ -49,8 +49,6 @@ view_help_section_2_propUrl_1 = https://docs.jboss.org/author/display/RHQ/Demo
view_help_section_2_propTitle_2 = Demo: Bundle Provisioning
view_help_section_2_propUrl_2 = http://management-platform.blogspot.com/2011/01/bundle-provisioning-via-r...
view_help_section_2_propTitle_3 = How to build Group Definitions
-view_help_section_2_propIcon_3 = [SKIN]/../actions/help.png
view_help_section_2_propUrl_3 = https://docs.jboss.org/author/display/RHQ/Group+Definitions
view_help_section_2_propTitle_4 = How to use the Search Bar
-view_help_section_2_propIcon_4 = [SKIN]/../actions/help.png
view_help_section_2_propUrl_4 = https://docs.jboss.org/author/display/RHQ/Search
10 years, 6 months
[rhq] 4 commits - modules/core modules/enterprise
by snegrea
modules/core/domain/src/main/java/org/rhq/core/domain/cloud/StorageClusterSettings.java | 26
modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/admin/storage/ClusterConfigurationEditor.java | 316 +++++++---
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java | 11
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/scheduler/jobs/StorageClusterCredentialsJob.java | 45 +
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/storage/StorageClientManagerBean.java | 108 ++-
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/storage/StorageClusterSettingsManagerBean.java | 35 +
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerBean.java | 6
modules/enterprise/server/server-metrics/src/main/java/org/rhq/server/metrics/StorageSession.java | 18
8 files changed, 442 insertions(+), 123 deletions(-)
New commits:
commit d5cd83d5008374b87e590197aad459cf09dbc737
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Mon Oct 28 16:02:06 2013 -0500
[BZ 1016175] Update and simplifiy some verbiage based on feedback.
(cherry picked from commit dda907b836f7b127e9f4968a8237fce49ae9aa51)
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/admin/storage/ClusterConfigurationEditor.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/admin/storage/ClusterConfigurationEditor.java
index 18079e1..066b9ab 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/admin/storage/ClusterConfigurationEditor.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/admin/storage/ClusterConfigurationEditor.java
@@ -148,8 +148,8 @@ public class ClusterConfigurationEditor extends EnhancedVLayout implements Refre
private void prepareForms() {
setWidth100();
clusterForm = buildForm("<div align='left'><span style='font-family: Arial, Verdana, sans-serif !important;'>"
- + "<b>Cluster Settings</b></span><br/>On save, these setting will not be propagated to existing Storage"
- + " Nodes. Please review the documentation on how update the CQL and Gossip ports for all Storage Nodes.</div>");
+ + "<b>Cluster Settings</b></span><br/>Before changing these settings, storage nodes require updates to have equivalent port numbers. "
+ + "Port changes below will only be saved in the RHQ server configuration.</div>");
List<FormItem> items = buildHeaderItems();
IsIntegerValidator validator = new IsIntegerValidator();
@@ -184,7 +184,7 @@ public class ClusterConfigurationEditor extends EnhancedVLayout implements Refre
clusterForm.setFields(items.toArray(new FormItem[items.size()]));
deploymentForm = buildForm("<div align='left'><span style='font-family: Arial, Verdana, sans-serif !important;'>"
- + "<b>Deployment Settings</b></span><br/>Only applies to new installations.</div>");
+ + "<b>New Deployment Settings</b></span><br/>Only applies to new installations.</div>");
FormItemBuilder.resetOddRow();
items = buildHeaderItems();
commit 9f460f107d825ac3df5b5c485affc9761935b559
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Mon Oct 28 16:01:43 2013 -0500
[BZ 1016175] Workaround to SmartGWT bug: password validators were changing the focus after each user input making it unusable
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/cloud/StorageClusterSettings.java b/modules/core/domain/src/main/java/org/rhq/core/domain/cloud/StorageClusterSettings.java
index 52b17b5..a2251fa 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/cloud/StorageClusterSettings.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/cloud/StorageClusterSettings.java
@@ -88,6 +88,6 @@ public class StorageClusterSettings implements Serializable {
@Override
public String toString() {
return "StorageClusterSettings[cqlPort=" + cqlPort + ", gossipPort=" + gossipPort + ", automaticDeployment="
- + automaticDeployment + ", username=" + username + ", passwordHash=********]";
+ + automaticDeployment + ", username (read-only)=" + username + ", passwordHash=********]";
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/admin/storage/ClusterConfigurationEditor.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/admin/storage/ClusterConfigurationEditor.java
index 6834c1b..18079e1 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/admin/storage/ClusterConfigurationEditor.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/admin/storage/ClusterConfigurationEditor.java
@@ -147,7 +147,8 @@ public class ClusterConfigurationEditor extends EnhancedVLayout implements Refre
private void prepareForms() {
setWidth100();
- clusterForm = buildForm("<div align='left'><span style='font-family: Arial, Verdana, sans-serif !important;'><b>Cluster Settings</b></span><br/>On save, these setting will not be propagated to existing Storage"
+ clusterForm = buildForm("<div align='left'><span style='font-family: Arial, Verdana, sans-serif !important;'>"
+ + "<b>Cluster Settings</b></span><br/>On save, these setting will not be propagated to existing Storage"
+ " Nodes. Please review the documentation on how update the CQL and Gossip ports for all Storage Nodes.</div>");
List<FormItem> items = buildHeaderItems();
@@ -182,7 +183,8 @@ public class ClusterConfigurationEditor extends EnhancedVLayout implements Refre
items.addAll(gossipPortItems);
clusterForm.setFields(items.toArray(new FormItem[items.size()]));
- deploymentForm = buildForm("<div align='left'><span style='font-family: Arial, Verdana, sans-serif !important;'><b>Deployment Settings</b></span><br/>Only applies to new installations.</div>");
+ deploymentForm = buildForm("<div align='left'><span style='font-family: Arial, Verdana, sans-serif !important;'>"
+ + "<b>Deployment Settings</b></span><br/>Only applies to new installations.</div>");
FormItemBuilder.resetOddRow();
items = buildHeaderItems();
@@ -206,7 +208,8 @@ public class ClusterConfigurationEditor extends EnhancedVLayout implements Refre
items.addAll(automaticDeploymentItems);
deploymentForm.setFields(items.toArray(new FormItem[items.size()]));
- credentialsForm = buildForm("<div align='left'><span style='font-family: Arial, Verdana, sans-serif !important;'><b>Cluster Credentials</b></span><br/>Password changes are propagated to the Storage Cluster.</div>");
+ credentialsForm = buildForm("<div align='left'><span style='text-align: left; font-family: Arial, Verdana, sans-serif !important;'>"
+ + "<b>Cluster Credentials</b></span><br/>Password changes are propagated to the Storage Cluster.</div>");
FormItemBuilder.resetOddRow();
items = buildHeaderItems();
@@ -223,6 +226,9 @@ public class ClusterConfigurationEditor extends EnhancedVLayout implements Refre
// password field
StringLengthValidator passwordValidator1 = new StringLengthValidator(6, 100, false);
+ passwordValidator1.setErrorMessage("The password length must be at least 6 characters.");
+ // due to SmartGWT bug that changes focus after each input (https://code.google.com/p/smartgwt/issues/detail?id=309)
+ passwordValidator1.setValidateOnChange(false);
builder = new FormItemBuilder();
List<FormItem> passwordItems = builder
.withName(FIELD_PASSWORD)
@@ -237,9 +243,14 @@ public class ClusterConfigurationEditor extends EnhancedVLayout implements Refre
// password_verify field
builder = new FormItemBuilder();
+ passwordValidator1 = new StringLengthValidator(6, 100, false);
+ passwordValidator1.setErrorMessage("The password length must be at least 6 characters.");
MatchesFieldValidator passwordValidator2 = new MatchesFieldValidator();
passwordValidator2.setOtherField(FIELD_PASSWORD);
passwordValidator2.setErrorMessage("This should be the same string as in the Password field.");
+ // due to same bug in SmartGWT as above
+ passwordValidator1.setValidateOnChange(false);
+ passwordValidator2.setValidateOnChange(false);
List<FormItem> passwordVerifyItems = builder.withName(FIELD_PASSWORD_VERIFY).withTitle("Verify Password")
.withValue(settings.getPasswordHash()).withDescription("Validation (needs to match Password)")
.withReadOnlySetTo(readOnly).withValidators(passwordValidator1, passwordValidator2)
commit c7650fa9381a4d3bd30ae69d1cc87ae54db10ec0
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Mon Oct 28 16:00:59 2013 -0500
[BZ 1016175] Add support for changing the storage password
Add code to update the storage session when credentials get update in the system settings table. Created a quartz job to trigger the refresh every 2 minutes.
The process to refresh the session is as follows:
1) Get new credentials from the database
2) Create a new session with new credentials
3) Replace existing session with newly created one
4) Allow few minutes for existing session drainage
5) Shutdown old session
Other changes:
- Add code to update Cassandra password via a direct CQL query using the existing open session.
- Update log level and text for the storage cluster credentials update job.
- Make the username read-only; adding more intuitive description to the other properties.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/admin/storage/ClusterConfigurationEditor.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/admin/storage/ClusterConfigurationEditor.java
index 11846df..6834c1b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/admin/storage/ClusterConfigurationEditor.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/admin/storage/ClusterConfigurationEditor.java
@@ -59,7 +59,8 @@ import org.rhq.coregui.client.util.message.Message;
*/
public class ClusterConfigurationEditor extends EnhancedVLayout implements RefreshableView {
- private EnhancedDynamicForm form;
+ private EnhancedDynamicForm clusterForm;
+ private EnhancedDynamicForm deploymentForm;
private EnhancedDynamicForm credentialsForm;
private EnhancedIButton saveButton;
private StorageClusterSettings settings;
@@ -123,46 +124,67 @@ public class ClusterConfigurationEditor extends EnhancedVLayout implements Refre
return unsetHeader;
}
- @Override
- protected void onDraw() {
- super.onDraw();
- refresh();
- }
-
- private void prepareForms() {
- setWidth100();
- form = new EnhancedDynamicForm();
+ private EnhancedDynamicForm buildForm(String groupTitle) {
+ EnhancedDynamicForm form = new EnhancedDynamicForm();
form.setHiliteRequiredFields(true);
form.setNumCols(3);
form.setCellPadding(5);
form.setColWidths(190, 220, "*");
form.setIsGroup(true);
- form.setGroupTitle("Cluster Wide Settings");
+ form.setGroupTitle(groupTitle);
form.setBorder("1px solid #AAA");
form.setWidth100();
form.setOverflow(Overflow.VISIBLE);
- form.setExtraSpace(10);
+ form.setExtraSpace(15);
+ return form;
+ }
+
+ @Override
+ protected void onDraw() {
+ super.onDraw();
+ refresh();
+ }
+
+ private void prepareForms() {
+ setWidth100();
+ clusterForm = buildForm("<div align='left'><span style='font-family: Arial, Verdana, sans-serif !important;'><b>Cluster Settings</b></span><br/>On save, these setting will not be propagated to existing Storage"
+ + " Nodes. Please review the documentation on how update the CQL and Gossip ports for all Storage Nodes.</div>");
List<FormItem> items = buildHeaderItems();
IsIntegerValidator validator = new IsIntegerValidator();
-
+
// cql port field
FormItemBuilder builder = new FormItemBuilder();
- List<FormItem> cqlPortItems = builder.withName(FIELD_CQL_PORT).withTitle("CQL Port")
+ List<FormItem> cqlPortItems = builder
+ .withName(FIELD_CQL_PORT)
+ .withTitle("CQL Port")
.withValue(String.valueOf(settings.getCqlPort()))
- .withDescription("The port on which the Storage Nodes listens for CQL client connections.")
- .withValidators(validator).build();
+ .withDescription(
+ "Port on which the Storage Nodes listen for CQL client connections. On save this setting"
+ + " will not be propagated to existing Storage Nodes. Please review the documentation on how update"
+ + " the CQL port for all Storage Nodes. <b>Warning:</b> if this setting does not match the configured"
+ + " Storage Cluster CQL port, the server will not be able to communicate with the Storage Cluster"
+ + " and will go into maintenance mode.").withValidators(validator).build();
items.addAll(cqlPortItems);
// gossip port field
builder = new FormItemBuilder();
- List<FormItem> gossipPortItems = builder.withName(FIELD_GOSSIP_PORT).withTitle("Gossip Port")
+ List<FormItem> gossipPortItems = builder
+ .withName(FIELD_GOSSIP_PORT)
+ .withTitle("Gossip Port")
.withValue(String.valueOf(settings.getGossipPort()))
- .withDescription("The port used for internode communication in the storage cluster.")
- .withValidators(validator).build();
+ .withDescription(
+ "The port used for internode communication in the Storage Cluster. On save this setting"
+ + " will not be propagated to existing Storage Nodes. Please review the documentation on how update"
+ + " the Gossip port for all Storage Nodes. <b>Warning:</b> if this setting does not match the"
+ + " configured Storage Cluster Gossip port, any new Storage Nodes will be able to communicate"
+ + " and be part of the existing Storage Cluster.").withValidators(validator).build();
items.addAll(gossipPortItems);
-
-
+ clusterForm.setFields(items.toArray(new FormItem[items.size()]));
+
+ deploymentForm = buildForm("<div align='left'><span style='font-family: Arial, Verdana, sans-serif !important;'><b>Deployment Settings</b></span><br/>Only applies to new installations.</div>");
+ FormItemBuilder.resetOddRow();
+ items = buildHeaderItems();
// automatic deployment field
builder = new FormItemBuilder();
@@ -171,8 +193,9 @@ public class ClusterConfigurationEditor extends EnhancedVLayout implements Refre
.withTitle("Automatic Deployment")
.withValue(Boolean.toString(settings.getAutomaticDeployment()))
.withDescription(
- "If this is set, the newly installed storage nodes will be automatically deployed to the storage cluster.")
- .withReadOnlySetTo(readOnly).build((FormItem) GWT.create(RadioGroupItem.class));
+ "If this is set, the newly installed storage nodes will be automatically deployed to the storage cluster."
+ + " It only applies to new installations.").withReadOnlySetTo(readOnly)
+ .build((FormItem) GWT.create(RadioGroupItem.class));
RadioGroupItem autoDeployRadio = (RadioGroupItem) automaticDeploymentItems.get(1);
autoDeployRadio.setVertical(false);
LinkedHashMap<String, String> values = new LinkedHashMap<String, String>(2);
@@ -181,58 +204,57 @@ public class ClusterConfigurationEditor extends EnhancedVLayout implements Refre
autoDeployRadio.setValueMap(values);
autoDeployRadio.setValue(settings.getAutomaticDeployment());
items.addAll(automaticDeploymentItems);
-
- form.setFields(items.toArray(new FormItem[items.size()]));
-
- credentialsForm = new EnhancedDynamicForm();
- credentialsForm.setHiliteRequiredFields(true);
- credentialsForm.setNumCols(3);
- credentialsForm.setCellPadding(5);
- credentialsForm.setColWidths(190, 220, "*");
- credentialsForm.setIsGroup(true);
- credentialsForm.setGroupTitle("Storage Cluster Credentials");
- credentialsForm.setBorder("1px solid #AAA");
- credentialsForm.setWidth100();
- credentialsForm.setOverflow(Overflow.VISIBLE);
-
+ deploymentForm.setFields(items.toArray(new FormItem[items.size()]));
+
+ credentialsForm = buildForm("<div align='left'><span style='font-family: Arial, Verdana, sans-serif !important;'><b>Cluster Credentials</b></span><br/>Password changes are propagated to the Storage Cluster.</div>");
FormItemBuilder.resetOddRow();
items = buildHeaderItems();
// username field
StringLengthValidator usernameValidator = new StringLengthValidator(4, 100, false);
builder = new FormItemBuilder();
- List<FormItem> usernameItems = builder.withName(FIELD_USERNAME).withTitle("Username")
- .withValue(settings.getUsername()).withDescription("Username").withReadOnlySetTo(readOnly)
- .withValidators(usernameValidator).build();
+ List<FormItem> usernameItems = builder
+ .withName(FIELD_USERNAME)
+ .withTitle("Username")
+ .withDescription(
+ "Username for Storage Node. This property is read-only because changes to the username are not allowed.")
+ .withValue(settings.getUsername()).withReadOnlySetTo(true).withValidators(usernameValidator).build();
items.addAll(usernameItems);
// password field
StringLengthValidator passwordValidator1 = new StringLengthValidator(6, 100, false);
builder = new FormItemBuilder();
- List<FormItem> passwordItems = builder.withName(FIELD_PASSWORD).withTitle("Password")
- .withValue(settings.getPasswordHash()).withDescription("Password").withReadOnlySetTo(readOnly)
- .withValidators(passwordValidator1).build((FormItem) GWT.create(PasswordItem.class));
+ List<FormItem> passwordItems = builder
+ .withName(FIELD_PASSWORD)
+ .withTitle("Password")
+ .withDescription(
+ "Password for all Storage Node CQL authentication. Changing will get propagated to the all deployed"
+ + " Storage Nodes and appliad to newly installed nodes. All HA servers will have Storage Cluster"
+ + " sessions refreshed automatically to use the new password.")
+ .withValue(settings.getPasswordHash()).withReadOnlySetTo(readOnly).withValidators(passwordValidator1)
+ .build((FormItem) GWT.create(PasswordItem.class));
items.addAll(passwordItems);
// password_verify field
builder = new FormItemBuilder();
MatchesFieldValidator passwordValidator2 = new MatchesFieldValidator();
passwordValidator2.setOtherField(FIELD_PASSWORD);
- passwordValidator2.setErrorMessage("This should be the same string as the Password.");
+ passwordValidator2.setErrorMessage("This should be the same string as in the Password field.");
List<FormItem> passwordVerifyItems = builder.withName(FIELD_PASSWORD_VERIFY).withTitle("Verify Password")
- .withValue(settings.getPasswordHash()).withDescription("This should be the same string as the Password.")
+ .withValue(settings.getPasswordHash()).withDescription("Validation (needs to match Password)")
.withReadOnlySetTo(readOnly).withValidators(passwordValidator1, passwordValidator2)
.build((FormItem) GWT.create(PasswordItem.class));
-
+
items.addAll(passwordVerifyItems);
credentialsForm.setFields(items.toArray(new FormItem[items.size()]));
-
+
LayoutSpacer spacer = new LayoutSpacer();
spacer.setWidth100();
ToolStrip toolStrip = buildToolStrip();
- setMembers(form, credentialsForm, spacer, toolStrip);
- form.validate();
+ setMembers(clusterForm, deploymentForm, credentialsForm, spacer, toolStrip);
+ clusterForm.validate();
+ deploymentForm.validate();
credentialsForm.validate();
markForRedraw();
}
@@ -246,7 +268,7 @@ public class ClusterConfigurationEditor extends EnhancedVLayout implements Refre
saveButton = new EnhancedIButton(MSG.common_button_save());
saveButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
- if (form.validate() && credentialsForm.validate()) {
+ if (clusterForm.validate() && deploymentForm.validate() && credentialsForm.validate()) {
SC.ask(
"Changing the cluster wide configuration will eventually affect all the storage nodes. Do you want to continue?",
new BooleanCallback() {
@@ -271,10 +293,12 @@ public class ClusterConfigurationEditor extends EnhancedVLayout implements Refre
}
private StorageClusterSettings updateSettings() {
- settings.setCqlPort(Integer.parseInt(form.getValueAsString(FIELD_CQL_PORT)));
- settings.setGossipPort(Integer.parseInt(form.getValueAsString(FIELD_GOSSIP_PORT)));
- settings.setAutomaticDeployment(Boolean.parseBoolean(form.getValueAsString(FIELD_AUTOMATIC_DEPLOYMENT)));
-
+ settings.setCqlPort(Integer.parseInt(clusterForm.getValueAsString(FIELD_CQL_PORT)));
+ settings.setGossipPort(Integer.parseInt(clusterForm.getValueAsString(FIELD_GOSSIP_PORT)));
+
+ settings.setAutomaticDeployment(Boolean.parseBoolean(deploymentForm
+ .getValueAsString(FIELD_AUTOMATIC_DEPLOYMENT)));
+
// set the credentials only if there was a change
String wannabeUsername = credentialsForm.getValueAsString(FIELD_USERNAME);
settings.setUsername(wannabeUsername.equals(settings.getUsername()) ? null : wannabeUsername);
@@ -282,7 +306,7 @@ public class ClusterConfigurationEditor extends EnhancedVLayout implements Refre
settings.setPasswordHash(wannabePassword.equals(settings.getPasswordHash()) ? null : wannabePassword);
return settings;
}
-
+
private static class FormItemBuilder {
private String name;
private String title;
@@ -290,47 +314,47 @@ public class ClusterConfigurationEditor extends EnhancedVLayout implements Refre
private String description;
private Validator[] validators;
private boolean readOnly;
-
+
private static boolean oddRow = true;
-
+
public static void resetOddRow() {
oddRow = true;
}
-
+
public FormItemBuilder withName(String name) {
this.name = name;
return this;
}
-
+
public FormItemBuilder withTitle(String title) {
this.title = title;
return this;
}
-
+
public FormItemBuilder withValue(String value) {
this.value = value;
return this;
}
-
+
public FormItemBuilder withDescription(String description) {
this.description = description;
return this;
}
-
+
public FormItemBuilder withValidators(Validator... validators) {
this.validators = validators;
return this;
}
-
+
public FormItemBuilder withReadOnlySetTo(boolean readOnly) {
this.readOnly = readOnly;
return this;
}
-
+
public List<FormItem> build() {
return build(new TextItem());
}
-
+
// GWT doesn't support reflection by default, therefore this "hack"
public List<FormItem> build(FormItem valueItem) {
List<FormItem> fields = new ArrayList<FormItem>();
@@ -365,6 +389,6 @@ public class ClusterConfigurationEditor extends EnhancedVLayout implements Refre
oddRow = !oddRow;
return fields;
}
-
+
}
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java
index 941ae93..90e2345 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java
@@ -87,6 +87,7 @@ import org.rhq.enterprise.server.scheduler.jobs.DynaGroupAutoRecalculationJob;
import org.rhq.enterprise.server.scheduler.jobs.PurgePluginsJob;
import org.rhq.enterprise.server.scheduler.jobs.PurgeResourceTypesJob;
import org.rhq.enterprise.server.scheduler.jobs.SavedSearchResultCountRecalculationJob;
+import org.rhq.enterprise.server.scheduler.jobs.StorageClusterCredentialsJob;
import org.rhq.enterprise.server.scheduler.jobs.StorageClusterInitJob;
import org.rhq.enterprise.server.scheduler.jobs.StorageClusterReadRepairJob;
import org.rhq.enterprise.server.storage.StorageClientManagerBean;
@@ -774,6 +775,16 @@ public class StartupBean implements StartupLocal {
log.error("Cannot create storage cluster init job", e);
}
}
+
+ try {
+ // Storage cluster credentials refresh job
+ final long initialDelay = 1000L * 60 * 5;
+ final long interval = 1000L * 60 * 2;
+ schedulerBean.scheduleSimpleRepeatingJob(StorageClusterCredentialsJob.class, true, false, initialDelay,
+ interval);
+ } catch (Exception e) {
+ log.error("Cannot schedule storage cluster credentials refresh job.", e);
+ }
try {
String cronString = "0 30 0 ? * SUN *"; // every sunday starting at 00:30.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/scheduler/jobs/StorageClusterCredentialsJob.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/scheduler/jobs/StorageClusterCredentialsJob.java
new file mode 100644
index 0000000..f5b2bf5
--- /dev/null
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/scheduler/jobs/StorageClusterCredentialsJob.java
@@ -0,0 +1,45 @@
+/*
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.server.scheduler.jobs;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+
+import org.rhq.enterprise.server.util.LookupUtil;
+
+/**
+ * @author Stefan Negrea
+ */
+public class StorageClusterCredentialsJob extends AbstractStatefulJob {
+
+ private Log log = LogFactory.getLog(StorageClusterCredentialsJob.class);
+
+ @Override
+ public void executeJobCode(JobExecutionContext context) throws JobExecutionException {
+ log.debug("Run credential update job for the storage cluster.");
+ boolean success = LookupUtil.getStorageClientManager().refreshCredentialsAndSession();
+ if (!success) {
+ log.error("Storage session credentials not succesfully refreshed");
+ } else {
+ log.debug("Storage session credentials succesfully refreshed");
+ }
+ }
+}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/storage/StorageClientManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/storage/StorageClientManagerBean.java
index c57d7cd..f28dc3b 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/storage/StorageClientManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/storage/StorageClientManagerBean.java
@@ -88,6 +88,10 @@ public class StorageClientManagerBean {
private boolean initialized;
private StorageClusterMonitor storageClusterMonitor;
+ private String cachedStorageUsername;
+ private String cachedStoragePassword;
+
+
/**
* @return true if the storage subsystem is running
*/
@@ -101,37 +105,9 @@ public class StorageClientManagerBean {
log.info("Initializing storage client subsystem");
- // Always get the creds from the DB, system props may not be up to date at install time
- // the code assumes the passwords to be obfuscated, because they can also come that way from other sources
- // (like property files). So let's make our lives easy and always use obfuscated passwords.
- SystemSettings settings = systemManager.getObfuscatedSystemSettings(true);
- final String username = settings.get(SystemSetting.STORAGE_USERNAME);
- final String password = settings.get(SystemSetting.STORAGE_PASSWORD);
-
- List<StorageNode> storageNodes = new ArrayList<StorageNode>();
- for (StorageNode storageNode : storageNodeManager.getStorageNodes()) {
- // We only want clustered nodes here because we won't be able to connect to
- // node that is not part of the cluster. The filtering here on the operation
- // mode is somewhat convservative because we could also include ADD_MAINTENANCE
- // and REMOVE_MAINTENANCE, but this errors on the side of being safe. Lastly,
- // if a storage node does not have a resource, then that means it was was
- // deployed prior to installing the server.
- if (storageNode.getOperationMode() == StorageNode.OperationMode.NORMAL
- || storageNode.getOperationMode() == StorageNode.OperationMode.MAINTENANCE
- || storageNode.getResource() == null) {
- storageNodes.add(storageNode);
- }
- }
-
- if (storageNodes.isEmpty()) {
- throw new IllegalStateException(
- "There is no storage node metadata stored in the relational database. This may have happened as a "
- + "result of running dbsetup or deleting rows from rhq_storage_node table. Please re-install the "
- + "storage node to fix this issue.");
- }
-
+ Session wrappedSession;
try {
- checkSchemaCompability(username, password, storageNodes);
+ wrappedSession = createSession();
} catch (NoHostAvailableException e) {
initialized = false;
log.warn("Storage client subsystem wasn't initialized because it wasn't possible to connect to the"
@@ -139,7 +115,8 @@ public class StorageClientManagerBean {
+ " as soon as possible.");
return initialized;
}
- Session wrappedSession = createSession(username, password, storageNodes);
+
+ wrappedSession = createSession();
session = new StorageSession(wrappedSession);
storageClusterMonitor = new StorageClusterMonitor();
@@ -155,6 +132,40 @@ public class StorageClientManagerBean {
return initialized;
}
+ public synchronized boolean refreshCredentialsAndSession() {
+ if (!initialized) {
+ if (log.isDebugEnabled()) {
+ log.debug("Storage client subsystem not initialized. Skipping session refresh.");
+ }
+ return false;
+ }
+
+ SystemSettings settings = systemManager.getObfuscatedSystemSettings(true);
+ String username = settings.get(SystemSetting.STORAGE_USERNAME);
+ String password = settings.get(SystemSetting.STORAGE_PASSWORD);
+
+ if ((username != null && !username.equals(this.cachedStorageUsername))
+ || (password != null && !password.equals(this.cachedStoragePassword))) {
+
+ Session wrappedSession;
+ try {
+ wrappedSession = createSession();
+ } catch (NoHostAvailableException e) {
+ initialized = false;
+ log.warn("Storage client subsystem wasn't initialized because it wasn't possible to connect to the"
+ + " storage cluster. The RHQ server is set to MAINTENANCE mode. Please start the storage cluster"
+ + " as soon as possible.");
+ return initialized;
+ }
+
+ session.registerNewSession(wrappedSession);
+ initialized = true;
+ return true;
+ }
+
+ return true;
+ }
+
/**
* Checks storage node schema compatibility.
*
@@ -229,7 +240,38 @@ public class StorageClientManagerBean {
return storageClusterMonitor != null && storageClusterMonitor.isClusterAvailable();
}
- private Session createSession(String username, String password, List<StorageNode> storageNodes) {
+ private Session createSession() {
+ // Always get the creds from the DB, system props may not be up to date at install time
+ // the code assumes the passwords to be obfuscated, because they can also come that way from other sources
+ // (like property files). So let's make our lives easy and always use obfuscated passwords.
+ SystemSettings settings = systemManager.getObfuscatedSystemSettings(true);
+ this.cachedStorageUsername = settings.get(SystemSetting.STORAGE_USERNAME);
+ this.cachedStoragePassword = settings.get(SystemSetting.STORAGE_PASSWORD);
+
+ List<StorageNode> storageNodes = new ArrayList<StorageNode>();
+ for (StorageNode storageNode : storageNodeManager.getStorageNodes()) {
+ // We only want clustered nodes here because we won't be able to connect to
+ // node that is not part of the cluster. The filtering here on the operation
+ // mode is somewhat convservative because we could also include ADD_MAINTENANCE
+ // and REMOVE_MAINTENANCE, but this errors on the side of being safe. Lastly,
+ // if a storage node does not have a resource, then that means it was was
+ // deployed prior to installing the server.
+ if (storageNode.getOperationMode() == StorageNode.OperationMode.NORMAL
+ || storageNode.getOperationMode() == StorageNode.OperationMode.MAINTENANCE
+ || storageNode.getResource() == null) {
+ storageNodes.add(storageNode);
+ }
+ }
+
+ if (storageNodes.isEmpty()) {
+ throw new IllegalStateException(
+ "There is no storage node metadata stored in the relational database. This may have happened as a "
+ + "result of running dbsetup or deleting rows from rhq_storage_node table. Please re-install the "
+ + "storage node to fix this issue.");
+ }
+
+ checkSchemaCompability(this.cachedStorageUsername, this.cachedStoragePassword, storageNodes);
+
if (log.isDebugEnabled()) {
log.debug("Initializing session to connect to storage node cluster");
}
@@ -252,7 +294,7 @@ public class StorageClientManagerBean {
}
cluster = new ClusterBuilder().addContactPoints(hostNames.toArray(new String[hostNames.size()]))
- .withCredentialsObfuscated(username, password).withPort(port)
+ .withCredentialsObfuscated(this.cachedStorageUsername, this.cachedStoragePassword).withPort(port)
.withLoadBalancingPolicy(new RoundRobinPolicy())
.withRetryPolicy(new LoggingRetryPolicy(DefaultRetryPolicy.INSTANCE)).withCompression(compression).build();
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/storage/StorageClusterSettingsManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/storage/StorageClusterSettingsManagerBean.java
index 2a47670..b14db38 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/storage/StorageClusterSettingsManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/storage/StorageClusterSettingsManagerBean.java
@@ -10,6 +10,7 @@ import org.rhq.core.domain.common.composite.SystemSetting;
import org.rhq.core.domain.common.composite.SystemSettings;
import org.rhq.enterprise.server.authz.RequiredPermission;
import org.rhq.enterprise.server.system.SystemManagerLocal;
+import org.rhq.server.metrics.StorageSession;
/**
* @author John Sanda
@@ -17,9 +18,14 @@ import org.rhq.enterprise.server.system.SystemManagerLocal;
@Stateless
public class StorageClusterSettingsManagerBean implements StorageClusterSettingsManagerLocal {
+ private static final String UPDATE_PASSWORD_QUERY = "ALTER USER '%s' WITH PASSWORD '%s'";
+
@EJB
private SystemManagerLocal systemManager;
+ @EJB
+ private StorageClientManagerBean storageClienManager;
+
@Override
@RequiredPermission(Permission.MANAGE_SETTINGS)
public StorageClusterSettings getClusterSettings(Subject subject) {
@@ -76,9 +82,20 @@ public class StorageClusterSettingsManagerBean implements StorageClusterSettings
settings.put(SystemSetting.STORAGE_USERNAME, clusterSettings.getUsername());
}
if (clusterSettings.getPasswordHash() != null) {
+ this.updateStorageClusterCredentials(clusterSettings);
settings.put(SystemSetting.STORAGE_PASSWORD, clusterSettings.getPasswordHash());
}
systemManager.setStorageClusterSettings(subject, settings);
}
+ private void updateStorageClusterCredentials(StorageClusterSettings newClusterSettings) {
+ SystemSettings currentSettings = systemManager.getUnmaskedSystemSettings(true);
+ String currentPassword = currentSettings.get(SystemSetting.STORAGE_PASSWORD);
+
+ if (!currentPassword.equals(newClusterSettings.getPasswordHash())) {
+ StorageSession session = this.storageClienManager.getSession();
+ session.execute(String.format(UPDATE_PASSWORD_QUERY, currentSettings.get(SystemSetting.STORAGE_USERNAME),
+ newClusterSettings.getPasswordHash()));
+ }
+ }
}
diff --git a/modules/enterprise/server/server-metrics/src/main/java/org/rhq/server/metrics/StorageSession.java b/modules/enterprise/server/server-metrics/src/main/java/org/rhq/server/metrics/StorageSession.java
index 60f3fbd..34eada1 100644
--- a/modules/enterprise/server/server-metrics/src/main/java/org/rhq/server/metrics/StorageSession.java
+++ b/modules/enterprise/server/server-metrics/src/main/java/org/rhq/server/metrics/StorageSession.java
@@ -34,6 +34,24 @@ public class StorageSession implements Host.StateListener {
this.wrappedSession.getCluster().register(this);
}
+ public void registerNewSession(Session newWrappedSession) {
+ Session oldWrappedSession = this.wrappedSession;
+
+
+ this.wrappedSession = newWrappedSession;
+ this.wrappedSession.getCluster().register(this);
+
+ oldWrappedSession.getCluster().unregister(this);
+
+ // initial waiting before the first check
+ try {
+ Thread.sleep(60000L);
+ } catch (InterruptedException e) {
+ // nothing
+ }
+ oldWrappedSession.shutdown();
+ }
+
public void addStorageStateListener(StorageStateListener listener) {
listeners.add(listener);
}
commit 1e6aee931a92ff658c2def4d5714e81e0a24b4a5
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Mon Oct 28 15:53:40 2013 -0500
[BZ 1016175] Add support for changing the storage password
- adding length validators for username and password; moving the storage node credentials to its own config section
- renaming "password" field to "passwordHash"; setting the password to null if there was no change at all to it
- adding support for storing the C* credentials to system settings db table
- adding length validators for username and password; moving the storage node credentials to its own config section
(cherry picked from commit f592690d232393b5127b637b2541278198f8b001)
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/cloud/StorageClusterSettings.java b/modules/core/domain/src/main/java/org/rhq/core/domain/cloud/StorageClusterSettings.java
index b44a2b5..52b17b5 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/cloud/StorageClusterSettings.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/cloud/StorageClusterSettings.java
@@ -14,6 +14,10 @@ public class StorageClusterSettings implements Serializable {
private int gossipPort;
private Boolean automaticDeployment;
+
+ private String username;
+
+ private String passwordHash;
public int getCqlPort() {
return cqlPort;
@@ -39,6 +43,22 @@ public class StorageClusterSettings implements Serializable {
this.automaticDeployment = automaticDeployment;
}
+ public String getUsername() {
+ return username;
+ }
+
+ public void setUsername(String username) {
+ this.username = username;
+ }
+
+ public String getPasswordHash() {
+ return passwordHash;
+ }
+
+ public void setPasswordHash(String passwordHash) {
+ this.passwordHash = passwordHash;
+ }
+
@Override
public boolean equals(Object o) {
if (this == o) return true;
@@ -49,6 +69,8 @@ public class StorageClusterSettings implements Serializable {
if (cqlPort != that.cqlPort) return false;
if (gossipPort != that.gossipPort) return false;
if (automaticDeployment != that.automaticDeployment) return false;
+ if (username != that.username) return false;
+ if (passwordHash != that.passwordHash) return false;
return true;
}
@@ -58,12 +80,14 @@ public class StorageClusterSettings implements Serializable {
int result = cqlPort;
result = 29 * result + gossipPort;
result = 29 * result + (automaticDeployment ? 1231 : 1237);
+ result = 29 * result + (username == null ? 0 : username.hashCode());
+ result = 29 * result + (passwordHash == null ? 0 : passwordHash.hashCode());
return result;
}
@Override
public String toString() {
return "StorageClusterSettings[cqlPort=" + cqlPort + ", gossipPort=" + gossipPort + ", automaticDeployment="
- + automaticDeployment + "]";
+ + automaticDeployment + ", username=" + username + ", passwordHash=********]";
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/admin/storage/ClusterConfigurationEditor.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/admin/storage/ClusterConfigurationEditor.java
index 188a993..11846df 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/admin/storage/ClusterConfigurationEditor.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/admin/storage/ClusterConfigurationEditor.java
@@ -22,6 +22,7 @@ import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
+import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.Overflow;
@@ -30,10 +31,12 @@ import com.smartgwt.client.util.SC;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.widgets.form.fields.FormItem;
+import com.smartgwt.client.widgets.form.fields.PasswordItem;
import com.smartgwt.client.widgets.form.fields.RadioGroupItem;
import com.smartgwt.client.widgets.form.fields.StaticTextItem;
import com.smartgwt.client.widgets.form.fields.TextItem;
import com.smartgwt.client.widgets.form.validator.IsIntegerValidator;
+import com.smartgwt.client.widgets.form.validator.MatchesFieldValidator;
import com.smartgwt.client.widgets.form.validator.Validator;
import com.smartgwt.client.widgets.layout.LayoutSpacer;
import com.smartgwt.client.widgets.toolbar.ToolStrip;
@@ -42,6 +45,7 @@ import org.rhq.core.domain.cloud.StorageClusterSettings;
import org.rhq.coregui.client.CoreGUI;
import org.rhq.coregui.client.RefreshableView;
import org.rhq.coregui.client.components.form.EnhancedDynamicForm;
+import org.rhq.coregui.client.components.form.StringLengthValidator;
import org.rhq.coregui.client.gwt.GWTServiceLookup;
import org.rhq.coregui.client.util.enhanced.EnhancedIButton;
import org.rhq.coregui.client.util.enhanced.EnhancedToolStrip;
@@ -56,14 +60,17 @@ import org.rhq.coregui.client.util.message.Message;
public class ClusterConfigurationEditor extends EnhancedVLayout implements RefreshableView {
private EnhancedDynamicForm form;
+ private EnhancedDynamicForm credentialsForm;
private EnhancedIButton saveButton;
- private boolean oddRow;
private StorageClusterSettings settings;
private final boolean readOnly;
private static String FIELD_CQL_PORT = "cql_port";
private static String FIELD_GOSSIP_PORT = "gossip_port";
private static String FIELD_AUTOMATIC_DEPLOYMENT = "automatic_deployment";
+ private static String FIELD_USERNAME = "username";
+ private static String FIELD_PASSWORD = "password";
+ private static String FIELD_PASSWORD_VERIFY = "verify_password";
public ClusterConfigurationEditor(boolean readOnly) {
super();
@@ -81,7 +88,7 @@ public class ClusterConfigurationEditor extends EnhancedVLayout implements Refre
@Override
public void onSuccess(StorageClusterSettings settings) {
ClusterConfigurationEditor.this.settings = settings;
- prepareForm();
+ prepareForms();
}
});
}
@@ -100,48 +107,6 @@ public class ClusterConfigurationEditor extends EnhancedVLayout implements Refre
});
}
- private List<FormItem> buildOneFormRowWithValidator(String name, String title, String value, String description,
- Validator validator) {
- return buildOneFormRow(name, title, value, description, false, validator);
- }
-
- private List<FormItem> buildOneFormRow(String name, String title, String value, String description,
- boolean unitsDropdown, Validator validator) {
- List<FormItem> fields = new ArrayList<FormItem>();
- StaticTextItem nameItem = new StaticTextItem();
- nameItem.setStartRow(true);
- nameItem.setValue("<b>" + title + "</b>");
- nameItem.setShowTitle(false);
- nameItem.setCellStyle(oddRow ? "OddRow" : "EvenRow");
- fields.add(nameItem);
-
- FormItem valueItem = null;
- valueItem = new TextItem();
- valueItem.setName(name);
- valueItem.setValue(value);
- valueItem.setWidth(220);
- if (validator != null) {
- valueItem.setValidators(validator);
- }
- valueItem.setValidateOnChange(true);
- valueItem.setAlign(Alignment.CENTER);
- valueItem.setShowTitle(false);
- valueItem.setRequired(true);
- valueItem.setCellStyle(oddRow ? "OddRow" : "EvenRow");
- valueItem.setDisabled(readOnly);
- fields.add(valueItem);
-
- StaticTextItem descriptionItem = new StaticTextItem();
- descriptionItem.setValue(description);
- descriptionItem.setShowTitle(false);
- descriptionItem.setEndRow(true);
- descriptionItem.setCellStyle(oddRow ? "OddRow" : "EvenRow");
- fields.add(descriptionItem);
-
- oddRow = !oddRow;
- return fields;
- }
-
private List<FormItem> buildHeaderItems() {
List<FormItem> fields = new ArrayList<FormItem>();
fields.add(createHeaderTextItem(MSG.view_configEdit_property()));
@@ -164,7 +129,8 @@ public class ClusterConfigurationEditor extends EnhancedVLayout implements Refre
refresh();
}
- private void prepareForm() {
+ private void prepareForms() {
+ setWidth100();
form = new EnhancedDynamicForm();
form.setHiliteRequiredFields(true);
form.setNumCols(3);
@@ -173,49 +139,101 @@ public class ClusterConfigurationEditor extends EnhancedVLayout implements Refre
form.setIsGroup(true);
form.setGroupTitle("Cluster Wide Settings");
form.setBorder("1px solid #AAA");
- oddRow = true;
+ form.setWidth100();
+ form.setOverflow(Overflow.VISIBLE);
+ form.setExtraSpace(10);
List<FormItem> items = buildHeaderItems();
IsIntegerValidator validator = new IsIntegerValidator();
- items.addAll(buildOneFormRowWithValidator(FIELD_CQL_PORT, "CQL Port", String.valueOf(settings.getCqlPort()),
- "The port on which the Storage Nodes listens for CQL client connections.", validator));
+
+ // cql port field
+ FormItemBuilder builder = new FormItemBuilder();
+ List<FormItem> cqlPortItems = builder.withName(FIELD_CQL_PORT).withTitle("CQL Port")
+ .withValue(String.valueOf(settings.getCqlPort()))
+ .withDescription("The port on which the Storage Nodes listens for CQL client connections.")
+ .withValidators(validator).build();
+ items.addAll(cqlPortItems);
- items.addAll(buildOneFormRowWithValidator(FIELD_GOSSIP_PORT, "Gossip Port",
- String.valueOf(settings.getGossipPort()),
- "The port used for internode communication in the storage cluster.", validator));
+ // gossip port field
+ builder = new FormItemBuilder();
+ List<FormItem> gossipPortItems = builder.withName(FIELD_GOSSIP_PORT).withTitle("Gossip Port")
+ .withValue(String.valueOf(settings.getGossipPort()))
+ .withDescription("The port used for internode communication in the storage cluster.")
+ .withValidators(validator).build();
+ items.addAll(gossipPortItems);
+
+
- List<FormItem> automaticDeploymentItems = buildOneFormRow(
- FIELD_AUTOMATIC_DEPLOYMENT,
- "Automatic Deployment",
- Boolean.toString(settings.getAutomaticDeployment()),
- "If this is set, the newly installed storage nodes will be automatically deployed to the storage cluster.",
- false, null);
- RadioGroupItem autoDeployRadio = new RadioGroupItem(FIELD_AUTOMATIC_DEPLOYMENT);
+ // automatic deployment field
+ builder = new FormItemBuilder();
+ List<FormItem> automaticDeploymentItems = builder
+ .withName(FIELD_AUTOMATIC_DEPLOYMENT)
+ .withTitle("Automatic Deployment")
+ .withValue(Boolean.toString(settings.getAutomaticDeployment()))
+ .withDescription(
+ "If this is set, the newly installed storage nodes will be automatically deployed to the storage cluster.")
+ .withReadOnlySetTo(readOnly).build((FormItem) GWT.create(RadioGroupItem.class));
+ RadioGroupItem autoDeployRadio = (RadioGroupItem) automaticDeploymentItems.get(1);
autoDeployRadio.setVertical(false);
LinkedHashMap<String, String> values = new LinkedHashMap<String, String>(2);
values.put("true", "On");
values.put("false", "Off");
autoDeployRadio.setValueMap(values);
autoDeployRadio.setValue(settings.getAutomaticDeployment());
- autoDeployRadio.setAlign(Alignment.CENTER);
- autoDeployRadio.setShowTitle(false);
- autoDeployRadio.setRequired(true);
- autoDeployRadio.setCellStyle(!oddRow ? "OddRow" : "EvenRow");
- autoDeployRadio.setDisabled(readOnly);
- oddRow = !oddRow;
- automaticDeploymentItems.set(1, autoDeployRadio);
items.addAll(automaticDeploymentItems);
+
form.setFields(items.toArray(new FormItem[items.size()]));
- form.setWidth100();
- form.setOverflow(Overflow.VISIBLE);
- setWidth100();
+ credentialsForm = new EnhancedDynamicForm();
+ credentialsForm.setHiliteRequiredFields(true);
+ credentialsForm.setNumCols(3);
+ credentialsForm.setCellPadding(5);
+ credentialsForm.setColWidths(190, 220, "*");
+ credentialsForm.setIsGroup(true);
+ credentialsForm.setGroupTitle("Storage Cluster Credentials");
+ credentialsForm.setBorder("1px solid #AAA");
+ credentialsForm.setWidth100();
+ credentialsForm.setOverflow(Overflow.VISIBLE);
+
+ FormItemBuilder.resetOddRow();
+ items = buildHeaderItems();
+
+ // username field
+ StringLengthValidator usernameValidator = new StringLengthValidator(4, 100, false);
+ builder = new FormItemBuilder();
+ List<FormItem> usernameItems = builder.withName(FIELD_USERNAME).withTitle("Username")
+ .withValue(settings.getUsername()).withDescription("Username").withReadOnlySetTo(readOnly)
+ .withValidators(usernameValidator).build();
+ items.addAll(usernameItems);
+
+ // password field
+ StringLengthValidator passwordValidator1 = new StringLengthValidator(6, 100, false);
+ builder = new FormItemBuilder();
+ List<FormItem> passwordItems = builder.withName(FIELD_PASSWORD).withTitle("Password")
+ .withValue(settings.getPasswordHash()).withDescription("Password").withReadOnlySetTo(readOnly)
+ .withValidators(passwordValidator1).build((FormItem) GWT.create(PasswordItem.class));
+ items.addAll(passwordItems);
+
+ // password_verify field
+ builder = new FormItemBuilder();
+ MatchesFieldValidator passwordValidator2 = new MatchesFieldValidator();
+ passwordValidator2.setOtherField(FIELD_PASSWORD);
+ passwordValidator2.setErrorMessage("This should be the same string as the Password.");
+ List<FormItem> passwordVerifyItems = builder.withName(FIELD_PASSWORD_VERIFY).withTitle("Verify Password")
+ .withValue(settings.getPasswordHash()).withDescription("This should be the same string as the Password.")
+ .withReadOnlySetTo(readOnly).withValidators(passwordValidator1, passwordValidator2)
+ .build((FormItem) GWT.create(PasswordItem.class));
+
+ items.addAll(passwordVerifyItems);
+ credentialsForm.setFields(items.toArray(new FormItem[items.size()]));
+
LayoutSpacer spacer = new LayoutSpacer();
spacer.setWidth100();
ToolStrip toolStrip = buildToolStrip();
- setMembers(form, spacer, toolStrip);
+ setMembers(form, credentialsForm, spacer, toolStrip);
form.validate();
+ credentialsForm.validate();
markForRedraw();
}
@@ -228,7 +246,7 @@ public class ClusterConfigurationEditor extends EnhancedVLayout implements Refre
saveButton = new EnhancedIButton(MSG.common_button_save());
saveButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
- if (form.validate()) {
+ if (form.validate() && credentialsForm.validate()) {
SC.ask(
"Changing the cluster wide configuration will eventually affect all the storage nodes. Do you want to continue?",
new BooleanCallback() {
@@ -256,6 +274,97 @@ public class ClusterConfigurationEditor extends EnhancedVLayout implements Refre
settings.setCqlPort(Integer.parseInt(form.getValueAsString(FIELD_CQL_PORT)));
settings.setGossipPort(Integer.parseInt(form.getValueAsString(FIELD_GOSSIP_PORT)));
settings.setAutomaticDeployment(Boolean.parseBoolean(form.getValueAsString(FIELD_AUTOMATIC_DEPLOYMENT)));
+
+ // set the credentials only if there was a change
+ String wannabeUsername = credentialsForm.getValueAsString(FIELD_USERNAME);
+ settings.setUsername(wannabeUsername.equals(settings.getUsername()) ? null : wannabeUsername);
+ String wannabePassword = credentialsForm.getValueAsString(FIELD_PASSWORD);
+ settings.setPasswordHash(wannabePassword.equals(settings.getPasswordHash()) ? null : wannabePassword);
return settings;
}
+
+ private static class FormItemBuilder {
+ private String name;
+ private String title;
+ private String value;
+ private String description;
+ private Validator[] validators;
+ private boolean readOnly;
+
+ private static boolean oddRow = true;
+
+ public static void resetOddRow() {
+ oddRow = true;
+ }
+
+ public FormItemBuilder withName(String name) {
+ this.name = name;
+ return this;
+ }
+
+ public FormItemBuilder withTitle(String title) {
+ this.title = title;
+ return this;
+ }
+
+ public FormItemBuilder withValue(String value) {
+ this.value = value;
+ return this;
+ }
+
+ public FormItemBuilder withDescription(String description) {
+ this.description = description;
+ return this;
+ }
+
+ public FormItemBuilder withValidators(Validator... validators) {
+ this.validators = validators;
+ return this;
+ }
+
+ public FormItemBuilder withReadOnlySetTo(boolean readOnly) {
+ this.readOnly = readOnly;
+ return this;
+ }
+
+ public List<FormItem> build() {
+ return build(new TextItem());
+ }
+
+ // GWT doesn't support reflection by default, therefore this "hack"
+ public List<FormItem> build(FormItem valueItem) {
+ List<FormItem> fields = new ArrayList<FormItem>();
+ StaticTextItem nameItem = new StaticTextItem();
+ nameItem.setStartRow(true);
+ nameItem.setValue("<b>" + title + "</b>");
+ nameItem.setShowTitle(false);
+ nameItem.setCellStyle(oddRow ? "OddRow" : "EvenRow");
+ fields.add(nameItem);
+
+ valueItem.setName(name);
+ valueItem.setValue(value);
+ valueItem.setWidth(220);
+ if (validators != null && validators.length > 0) {
+ valueItem.setValidators(validators);
+ }
+ valueItem.setValidateOnChange(true);
+ valueItem.setAlign(Alignment.CENTER);
+ valueItem.setShowTitle(false);
+ valueItem.setRequired(true);
+ valueItem.setCellStyle(oddRow ? "OddRow" : "EvenRow");
+ valueItem.setDisabled(readOnly);
+ fields.add(valueItem);
+
+ StaticTextItem descriptionItem = new StaticTextItem();
+ descriptionItem.setValue(description);
+ descriptionItem.setShowTitle(false);
+ descriptionItem.setEndRow(true);
+ descriptionItem.setCellStyle(oddRow ? "OddRow" : "EvenRow");
+ fields.add(descriptionItem);
+
+ oddRow = !oddRow;
+ return fields;
+ }
+
+ }
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/storage/StorageClusterSettingsManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/storage/StorageClusterSettingsManagerBean.java
index a00200d..2a47670 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/storage/StorageClusterSettingsManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/storage/StorageClusterSettingsManagerBean.java
@@ -46,6 +46,18 @@ public class StorageClusterSettingsManagerBean implements StorageClusterSettings
clusterSettings.setAutomaticDeployment(Boolean.parseBoolean(settings
.get(SystemSetting.STORAGE_AUTOMATIC_DEPLOYMENT)));
}
+
+ if (!settings.containsKey(SystemSetting.STORAGE_USERNAME)) {
+ return null;
+ } else {
+ clusterSettings.setUsername(settings.get(SystemSetting.STORAGE_USERNAME));
+ }
+
+ if (!settings.containsKey(SystemSetting.STORAGE_PASSWORD)) {
+ return null;
+ } else {
+ clusterSettings.setPasswordHash(settings.get(SystemSetting.STORAGE_PASSWORD));
+ }
return clusterSettings;
}
@@ -60,6 +72,12 @@ public class StorageClusterSettingsManagerBean implements StorageClusterSettings
settings.put(SystemSetting.STORAGE_AUTOMATIC_DEPLOYMENT,
Boolean.toString(clusterSettings.getAutomaticDeployment()));
}
+ if (clusterSettings.getUsername() != null) {
+ settings.put(SystemSetting.STORAGE_USERNAME, clusterSettings.getUsername());
+ }
+ if (clusterSettings.getPasswordHash() != null) {
+ settings.put(SystemSetting.STORAGE_PASSWORD, clusterSettings.getPasswordHash());
+ }
systemManager.setStorageClusterSettings(subject, settings);
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerBean.java
index bbef365..610c38d 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemManagerBean.java
@@ -367,11 +367,11 @@ public class SystemManagerBean implements SystemManagerLocal, SystemManagerRemot
private boolean isStorageSetting(SystemSetting setting) {
switch (setting) {
case STORAGE_CQL_PORT:
- return true;
case STORAGE_GOSSIP_PORT:
- return true;
case STORAGE_AUTOMATIC_DEPLOYMENT:
- return true;
+ case STORAGE_PASSWORD:
+ case STORAGE_USERNAME:
+ return true;
default:
return false;
}
10 years, 6 months
[rhq] Branch 'bug/1016175' - modules/enterprise
by snegrea
modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/admin/storage/ClusterConfigurationEditor.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
New commits:
commit dda907b836f7b127e9f4968a8237fce49ae9aa51
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Mon Oct 28 15:38:48 2013 -0500
[BZ 1016175] Update and simplifiy some verbiage based on feedback.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/admin/storage/ClusterConfigurationEditor.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/admin/storage/ClusterConfigurationEditor.java
index 18079e1..066b9ab 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/admin/storage/ClusterConfigurationEditor.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/admin/storage/ClusterConfigurationEditor.java
@@ -148,8 +148,8 @@ public class ClusterConfigurationEditor extends EnhancedVLayout implements Refre
private void prepareForms() {
setWidth100();
clusterForm = buildForm("<div align='left'><span style='font-family: Arial, Verdana, sans-serif !important;'>"
- + "<b>Cluster Settings</b></span><br/>On save, these setting will not be propagated to existing Storage"
- + " Nodes. Please review the documentation on how update the CQL and Gossip ports for all Storage Nodes.</div>");
+ + "<b>Cluster Settings</b></span><br/>Before changing these settings, storage nodes require updates to have equivalent port numbers. "
+ + "Port changes below will only be saved in the RHQ server configuration.</div>");
List<FormItem> items = buildHeaderItems();
IsIntegerValidator validator = new IsIntegerValidator();
@@ -184,7 +184,7 @@ public class ClusterConfigurationEditor extends EnhancedVLayout implements Refre
clusterForm.setFields(items.toArray(new FormItem[items.size()]));
deploymentForm = buildForm("<div align='left'><span style='font-family: Arial, Verdana, sans-serif !important;'>"
- + "<b>Deployment Settings</b></span><br/>Only applies to new installations.</div>");
+ + "<b>New Deployment Settings</b></span><br/>Only applies to new installations.</div>");
FormItemBuilder.resetOddRow();
items = buildHeaderItems();
10 years, 6 months
[rhq] Branch 'release/jon3.2.x' - modules/enterprise
by Jay Shaughnessy
modules/enterprise/agent/src/etc/rhq-agent.bat | 2 +-
modules/enterprise/remoting/cli/src/etc/rhq-cli.bat | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
New commits:
commit 583e8cd1f9bc75211e2d5a339e34a2a02d7b49cc
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Oct 28 10:03:58 2013 -0400
Bug 1022989 - Unable to start JON/RHQ agent on windows due error in rhq_agent.bat
Fix agent bat script and similar issue in cli bat script
Cherry-pick master: 93cbc9c4426363db4d63b4270ba49ba20f7ebe16
diff --git a/modules/enterprise/agent/src/etc/rhq-agent.bat b/modules/enterprise/agent/src/etc/rhq-agent.bat
index f7980b3..46ef0b9 100644
--- a/modules/enterprise/agent/src/etc/rhq-agent.bat
+++ b/modules/enterprise/agent/src/etc/rhq-agent.bat
@@ -192,7 +192,7 @@ if not defined RHQ_AGENT_MAINCLASS (
rem note - currently not using custom Java Prefs as the default, use commented command line to activate. If installing
rem note - the agent as a windows service, you must also uncomment lines in wrapper/rhq-agent-wrapper.conf.
rem set CMD="%RHQ_JAVA_EXE_FILE_PATH%" %_JAVA_ENDORSED_DIRS_OPT% %_JAVA_LIBRARY_PATH_OPT% %_JAVA_PREFERENCES_FACTORY_OPT% %RHQ_AGENT_JAVA_OPTS% %RHQ_AGENT_ADDITIONAL_JAVA_OPTS% %_LOG_CONFIG% -cp "%CLASSPATH%" %RHQ_AGENT_MAINCLASS% %RHQ_AGENT_CMDLINE_OPTS%
-set CMD="%RHQ_AGENT_EXE_FILE_PATH%" %_JAVA_ENDORSED_DIRS_OPT% %_JAVA_LIBRARY_PATH_OPT% %RHQ_AGENT_JAVA_OPTS% %RHQ_AGENT_ADDITIONAL_JAVA_OPTS% %_LOG_CONFIG% -cp "%CLASSPATH%" %RHQ_AGENT_MAINCLASS% %RHQ_AGENT_CMDLINE_OPTS%
+set CMD="%RHQ_JAVA_EXE_FILE_PATH%" %_JAVA_ENDORSED_DIRS_OPT% %_JAVA_LIBRARY_PATH_OPT% %RHQ_AGENT_JAVA_OPTS% %RHQ_AGENT_ADDITIONAL_JAVA_OPTS% %_LOG_CONFIG% -cp "%CLASSPATH%" %RHQ_AGENT_MAINCLASS% %RHQ_AGENT_CMDLINE_OPTS%
if not defined _SETENV_ONLY (
rem log4j 1.2.8 does not create the directory for us (later versions do)
diff --git a/modules/enterprise/remoting/cli/src/etc/rhq-cli.bat b/modules/enterprise/remoting/cli/src/etc/rhq-cli.bat
index b7992c5..96d59bc 100644
--- a/modules/enterprise/remoting/cli/src/etc/rhq-cli.bat
+++ b/modules/enterprise/remoting/cli/src/etc/rhq-cli.bat
@@ -149,7 +149,7 @@ if defined RHQ_CLI_DEBUG (
set _LOG_CONFIG=-Dlog4j.configuration=log4j.xml
)
-set CMD="%RHQ_CLI_JAVA_EXE_FILE_PATH%" %_JAVA_ENDORSED_DIRS_OPT% %_JAVA_LIBRARY_PATH_OPT% %RHQ_CLI_JAVA_OPTS% %RHQ_CLI_ADDITIONAL_JAVA_OPTS% %_LOG_CONFIG% -cp "%CLASSPATH%" org.rhq.enterprise.client.ClientMain %RHQ_CLI_CMDLINE_OPTS%
+set CMD="%RHQ_JAVA_EXE_FILE_PATH%" %_JAVA_ENDORSED_DIRS_OPT% %_JAVA_LIBRARY_PATH_OPT% %RHQ_CLI_JAVA_OPTS% %RHQ_CLI_ADDITIONAL_JAVA_OPTS% %_LOG_CONFIG% -cp "%CLASSPATH%" org.rhq.enterprise.client.ClientMain %RHQ_CLI_CMDLINE_OPTS%
rem log4j 1.2.8 does not create the directory for us (later versions do)
if not exist "%RHQ_CLI_HOME%\logs" (
10 years, 6 months
[rhq] modules/enterprise
by Jay Shaughnessy
modules/enterprise/agent/src/etc/rhq-agent.bat | 2 +-
modules/enterprise/remoting/cli/src/etc/rhq-cli.bat | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
New commits:
commit 9d0306553f32bb0ce5c51ebb31ffb962abfca2c3
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Oct 28 10:01:09 2013 -0400
Bug 1022989 - Unable to start JON/RHQ agent on windows due error in rhq_agent.bat
Fix agent bat script and similar issue in cli bat script
diff --git a/modules/enterprise/agent/src/etc/rhq-agent.bat b/modules/enterprise/agent/src/etc/rhq-agent.bat
index f7980b3..46ef0b9 100644
--- a/modules/enterprise/agent/src/etc/rhq-agent.bat
+++ b/modules/enterprise/agent/src/etc/rhq-agent.bat
@@ -192,7 +192,7 @@ if not defined RHQ_AGENT_MAINCLASS (
rem note - currently not using custom Java Prefs as the default, use commented command line to activate. If installing
rem note - the agent as a windows service, you must also uncomment lines in wrapper/rhq-agent-wrapper.conf.
rem set CMD="%RHQ_JAVA_EXE_FILE_PATH%" %_JAVA_ENDORSED_DIRS_OPT% %_JAVA_LIBRARY_PATH_OPT% %_JAVA_PREFERENCES_FACTORY_OPT% %RHQ_AGENT_JAVA_OPTS% %RHQ_AGENT_ADDITIONAL_JAVA_OPTS% %_LOG_CONFIG% -cp "%CLASSPATH%" %RHQ_AGENT_MAINCLASS% %RHQ_AGENT_CMDLINE_OPTS%
-set CMD="%RHQ_AGENT_EXE_FILE_PATH%" %_JAVA_ENDORSED_DIRS_OPT% %_JAVA_LIBRARY_PATH_OPT% %RHQ_AGENT_JAVA_OPTS% %RHQ_AGENT_ADDITIONAL_JAVA_OPTS% %_LOG_CONFIG% -cp "%CLASSPATH%" %RHQ_AGENT_MAINCLASS% %RHQ_AGENT_CMDLINE_OPTS%
+set CMD="%RHQ_JAVA_EXE_FILE_PATH%" %_JAVA_ENDORSED_DIRS_OPT% %_JAVA_LIBRARY_PATH_OPT% %RHQ_AGENT_JAVA_OPTS% %RHQ_AGENT_ADDITIONAL_JAVA_OPTS% %_LOG_CONFIG% -cp "%CLASSPATH%" %RHQ_AGENT_MAINCLASS% %RHQ_AGENT_CMDLINE_OPTS%
if not defined _SETENV_ONLY (
rem log4j 1.2.8 does not create the directory for us (later versions do)
diff --git a/modules/enterprise/remoting/cli/src/etc/rhq-cli.bat b/modules/enterprise/remoting/cli/src/etc/rhq-cli.bat
index b7992c5..96d59bc 100644
--- a/modules/enterprise/remoting/cli/src/etc/rhq-cli.bat
+++ b/modules/enterprise/remoting/cli/src/etc/rhq-cli.bat
@@ -149,7 +149,7 @@ if defined RHQ_CLI_DEBUG (
set _LOG_CONFIG=-Dlog4j.configuration=log4j.xml
)
-set CMD="%RHQ_CLI_JAVA_EXE_FILE_PATH%" %_JAVA_ENDORSED_DIRS_OPT% %_JAVA_LIBRARY_PATH_OPT% %RHQ_CLI_JAVA_OPTS% %RHQ_CLI_ADDITIONAL_JAVA_OPTS% %_LOG_CONFIG% -cp "%CLASSPATH%" org.rhq.enterprise.client.ClientMain %RHQ_CLI_CMDLINE_OPTS%
+set CMD="%RHQ_JAVA_EXE_FILE_PATH%" %_JAVA_ENDORSED_DIRS_OPT% %_JAVA_LIBRARY_PATH_OPT% %RHQ_CLI_JAVA_OPTS% %RHQ_CLI_ADDITIONAL_JAVA_OPTS% %_LOG_CONFIG% -cp "%CLASSPATH%" org.rhq.enterprise.client.ClientMain %RHQ_CLI_CMDLINE_OPTS%
rem log4j 1.2.8 does not create the directory for us (later versions do)
if not exist "%RHQ_CLI_HOME%\logs" (
10 years, 6 months
[rhq] Branch 'release/jon3.2.x' - 2 commits - modules/enterprise
by Jay Shaughnessy
modules/enterprise/agent/ant-run.xml | 2
modules/enterprise/agent/src/etc/java-service-wrapper/rhq-agent-wrapper.inc | 19 +
modules/enterprise/agent/src/etc/rhq-agent-env.bat | 10
modules/enterprise/agent/src/etc/rhq-agent.bat | 12
modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentMain.java | 124 +++++++---
modules/enterprise/remoting/cli/src/etc/rhq-cli-env.bat | 26 --
modules/enterprise/remoting/cli/src/etc/rhq-cli.bat | 45 +--
modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-installer.bat | 12
modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-server.bat | 12
modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-storage-installer.bat | 12
modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-storage.bat | 12
modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-data-migration.bat | 12
modules/enterprise/server/appserver/src/main/bin-resources/bin/rhqctl.bat | 15 -
modules/enterprise/server/appserver/src/main/bin-resources/bin/wrapper/rhq-server-wrapper.inc | 19 +
modules/enterprise/server/appserver/src/main/bin-resources/bin/wrapper/rhq-storage-wrapper.env | 25 +-
modules/enterprise/server/appserver/src/main/bin-resources/bin/wrapper/rhq-storage-wrapper.inc | 19 +
modules/enterprise/server/appserver/src/main/dev-resources/bin/wrapper/rhq-server-wrapper.inc | 12
modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java | 87 +++++--
19 files changed, 325 insertions(+), 152 deletions(-)
New commits:
commit 93cbc9c4426363db4d63b4270ba49ba20f7ebe16
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Oct 28 09:35:24 2013 -0400
Bug 1022620 - Windows 2008 - Upgrade to JON3.2.ER3 fails when using oracle jdk7-32b
Second commit for this.
Went one step further. Now for the server and agent we create/set java.io.tmpdir
to InstallDir/temp, if the original java.io.tmpdir is invalid. We'll generate
a warning about the original setting. We'll only exit if our attempt to
create/set a local temp dir fails. This helps us succeed out of box with
the known issues using the 32-bit JVm on Windows, as well as getting
around the issue in general.
cherry-pick master: fdc1cabee3ea72a167f71971a7d4c8f324b8e8db
diff --git a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentMain.java b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentMain.java
index 77c88b1..c99f4b6 100644
--- a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentMain.java
+++ b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentMain.java
@@ -368,7 +368,7 @@ public class AgentMain {
private VMHealthCheckThread m_vmHealthCheckThread;
/**
- * Counts the number of times the agent has been restarted and holds the reason for the last restart.
+ * Counts the number of times the agent has been restarted and holds the reason for the last restart.
*/
private final AgentRestartCounter m_agentRestartCounter = new AgentRestartCounter();
@@ -378,7 +378,7 @@ public class AgentMain {
private boolean m_disableNativeSystem;
/**
- * Thread used to repeatedly ping the server for connectivity, agent avail update, and clock sync
+ * Thread used to repeatedly ping the server for connectivity, agent avail update, and clock sync
*/
private ScheduledThreadPoolExecutor m_pingThreadPoolExecutor;
@@ -465,6 +465,62 @@ public class AgentMain {
return;
}
+ private void checkTempDir() {
+ File tmpDir = new File(System.getProperty("java.io.tmpdir"));
+ if (!tmpDir.exists()) {
+ LOG.warn("Invalid java.io.tmpdir: [" + tmpDir.getAbsolutePath() + "] does not exist.");
+ useLocalTmpDir();
+ return;
+ }
+ if (!tmpDir.isDirectory()) {
+ LOG.warn("Invalid java.io.tmpdir: [" + tmpDir.getAbsolutePath() + "] is not a directory");
+ useLocalTmpDir();
+ return;
+ }
+ if (!tmpDir.canRead() || !tmpDir.canExecute()) {
+ LOG.warn("Invalid java.io.tmpdir: [" + tmpDir.getAbsolutePath() + "] is not readable");
+ useLocalTmpDir();
+ return;
+ }
+ if (!tmpDir.canWrite()) {
+ LOG.warn("Invalid java.io.tmpdir: [" + tmpDir.getAbsolutePath() + "] is not writable");
+ useLocalTmpDir();
+ return;
+ }
+ }
+
+ private void useLocalTmpDir() {
+ File localTmpDir = null;
+ try {
+ localTmpDir = new File(new File(getAgentHomeDirectory()), "temp");
+ LOG.info("Using alternate java.io.tmpdir: [" + localTmpDir.getAbsolutePath() + "]");
+ if (!localTmpDir.exists()) {
+ LOG.info("Creating alternate java.io.tmpdir: [" + localTmpDir.getAbsolutePath() + "]");
+ localTmpDir.mkdir();
+ }
+ System.setProperty("java.io.tmpdir", localTmpDir.getAbsolutePath());
+ } catch (Throwable t) {
+ throw new RuntimeException("Startup failed: Could not create or set local java.io.tmpdir ["
+ + localTmpDir.getAbsolutePath() + "]", t);
+ }
+ if (!localTmpDir.exists()) {
+ throw new RuntimeException("Startup failed: local java.io.tmpdir [" + localTmpDir.getAbsolutePath()
+ + "] does not exist");
+ }
+ if (!localTmpDir.isDirectory()) {
+ throw new RuntimeException("Startup failed: local java.io.tmpdir [" + localTmpDir.getAbsolutePath()
+ + "] is not a directory");
+ }
+ if (!localTmpDir.canRead() || !localTmpDir.canExecute()) {
+ throw new RuntimeException("Startup failed: local java.io.tmpdir [" + localTmpDir.getAbsolutePath()
+ + "] is not readable");
+ }
+ if (!localTmpDir.canWrite()) {
+ throw new RuntimeException("Startup failed: local java.io.tmpdir [" + localTmpDir.getAbsolutePath()
+ + "] is not writable");
+ }
+ }
+
/**
* Constructor for {@link AgentMain} that loads the agent configuration and prepare some additional internal data.
*
@@ -517,13 +573,15 @@ public class AgentMain {
prepareNativeSystem();
+ checkTempDir();
+
return;
}
/**
* Returns the directory that is considered the "agent home" (i.e. the directory
* where the agent is installed).
- *
+ *
* @return agent home directory, or empty string if it cannot be determined
*/
public String getAgentHomeDirectory() {
@@ -614,7 +672,7 @@ public class AgentMain {
/**
* This method should be called whenever the server time is known. This helps
* keep the {@link #getAgentServerClockDifference()} up-to-date.
- *
+ *
* @param serverTime the currently know value of the server clock (epoch millis)
*/
public void serverClockNotification(long serverTime) {
@@ -920,7 +978,7 @@ public class AgentMain {
/**
* This will enable/disable agent-server communication tracing. This is for
* use mainly in development but can also be used for troubleshooting problems.
- *
+ *
* @param enabled whether or not to turn on agent comm tracing
*/
public void agentServerCommunicationsTrace(boolean enabled) {
@@ -952,7 +1010,7 @@ public class AgentMain {
* This will hot-deploy a new log4j log configuration file. Use this to change, at runtime,
* the log settings so you can, for example, begin logging DEBUG messages to help troubleshoot
* problems.
- *
+ *
* @param logFilePath the path to the log file - relative to the classloader or filesystem
*
* @throws Exception if failed to hot deploy the new log config
@@ -985,7 +1043,7 @@ public class AgentMain {
/**
* Returns an iteratable list of servers that can be used as backups when this agent needs to failover
* to another server.
- *
+ *
* @return list of servers (may be empty but will not be <code>null</code>)
*/
public FailoverListComposite getServerFailoverList() {
@@ -1029,8 +1087,8 @@ public class AgentMain {
/**
* Downloads a new server failover list from the server and returns the failover list
* that is now in effect.
- * @return
- *
+ * @return
+ *
* @return the server failover list that is now in effect
*/
public FailoverListComposite downloadServerFailoverList() {
@@ -1568,7 +1626,7 @@ public class AgentMain {
* @param wait_ms maximum number of milliseconds to wait
*
* @return <code>true</code> if the server is up, <code>false</code> if it is not yet up or the agent has shutdown
- *
+ *
* @throws AgentNotSupportedException If the server is up but it told us we are the wrong version, then this is thrown.
* When this is thrown, the agent is currently in the midst of updating itself.
*/
@@ -1940,9 +1998,9 @@ public class AgentMain {
* port and transport parameters being used to talk to the current server
* will stay the same. Otherwise, it will be assumed the server is a
* full endpoint URL.
- *
+ *
* @param server the host of the server to switch to, or a full server endpoint URL
- *
+ *
* @return <code>true</code> if successfully switched, <code>false</code> otherwise
*/
public boolean switchToServer(String server) {
@@ -1996,9 +2054,9 @@ public class AgentMain {
/**
* Switches the agent to talk to the next server in the failover list.
- *
+ *
* This is package-scoped so the failover callback can call this.
- *
+ *
* @param comm the communicator object whose endpoint needs to be switched to the next server
* the caller must ensure the remote communicator provided to this method is the
* same communicator used by this agent's {@link #getClientCommandSender() sender}.
@@ -2036,12 +2094,12 @@ public class AgentMain {
/**
* Immediately switches the given communicator to the given server.
- *
+ *
* @param comm the communicator whose server is switched
* @param newServer the endpoint of the new server
* @param transport the transport that should be used in the new remote endpoint URL
* @param transportParams the transport params that should be used in the new remote endpoint URL
- *
+ *
* @return <code>true</code> if successfully switched; <code>false</code> otherwise
*/
private boolean switchCommServer(RemoteCommunicator comm, ServerEntry newServer, String transport,
@@ -2096,12 +2154,12 @@ public class AgentMain {
* is making the server its primary server and will begin sending it messages. The request
* is sent such that the communicator's initialize callback will never be invoked, however,
* the caller can ask for the request to attempt failover.
- *
+ *
* <p>This is package scoped so the initialize callback can call this</p>
- *
+ *
* @param comm the communicator used to send the message to the server
* @param attemptFailover if <code>true</code>, and the connect command fails, server failover will be attempted
- *
+ *
* @throws Throwable
*/
void sendConnectRequestToServer(RemoteCommunicator comm, boolean attemptFailover) throws Throwable {
@@ -2203,7 +2261,7 @@ public class AgentMain {
/**
* Returns the agent restart counter object.
- *
+ *
* @return the agent restart counter
*/
public AgentRestartCounter getAgentRestartCounter() {
@@ -2351,7 +2409,7 @@ public class AgentMain {
m_commServices.start(m_configuration.getPreferences(), m_configuration.getClientCommandSenderConfiguration());
// prime the sender so it can be prepared to start sending messages.
- // if auto-discovery is enabled, then the auto-discovery listener will tell the sender when its OK to start
+ // if auto-discovery is enabled, then the auto-discovery listener will tell the sender when its OK to start
// sending. Otherwise start polling and let the poller tell the sender when it is ok to start sending.
if (!isAutoDiscoveryEnabled()) {
LOG.info(AgentI18NResourceKeys.NO_AUTO_DETECT);
@@ -2402,7 +2460,7 @@ public class AgentMain {
/**
* This will prepare the auto-discovery listener, if server auto-detection is enabled.
- *
+ *
* @throws Exception
*/
private void prepareAutoDiscoveryListener() throws Exception {
@@ -2638,17 +2696,17 @@ public class AgentMain {
/**
* Creates a raw remote communicator that can talk to the given endpoint.
- *
+ *
* This is public-scoped so the {@link PrimaryServerSwitchoverThread} can use this
* and the {@link IdentifyPromptCommand} can use this.
- *
+ *
* @param transport
* @param address
* @param port
* @param transportParams
- *
+ *
* @return the remote communicator
- *
+ *
* @throws Exception if the communicator could not be created
*/
public RemoteCommunicator createServerRemoteCommunicator(String transport, String address, int port,
@@ -2741,7 +2799,7 @@ public class AgentMain {
* Given a failover list, this makes very rudimentary connection attempts to each server to see if
* this agent can at least reach the server endpoints. If an endpoint cannot be reached,
* a warning is logged.
- *
+ *
* @param failoverList the list of servers this agent will potentially need to talk to.
* @return the servers that failed to be connected to
*/
@@ -2804,7 +2862,7 @@ public class AgentMain {
* Given a failover list, this will persist it so the agent can recover it if the agent itself fails.
* If this method fails to persist the list, an error is logged but otherwise this method
* returns normally.
- *
+ *
* @param failoverList the failover list to persist (may be <code>null</code>)
*/
private void storeServerFailoverList(FailoverListComposite failoverList) {
@@ -3184,7 +3242,7 @@ public class AgentMain {
}
if (m_daemonMode) {
- AgentInputReaderFactory.setConsoleType(AgentInputReaderFactory.ConsoleType.java); // don't use native libs, no need and jline causes problems
+ AgentInputReaderFactory.setConsoleType(AgentInputReaderFactory.ConsoleType.java); // don't use native libs, no need and jline causes problems
} else if (console_type != null) {
AgentInputReaderFactory.setConsoleType(console_type);
}
@@ -3373,7 +3431,7 @@ public class AgentMain {
return args.toArray(new String[args.size()]);
}
- // perform any other massaging
+ // perform any other massaging
private String safeArg(String arg) {
// remove trailing '=' from long option args. For example --plugin= should just be --plugin for
// downstream processing.
@@ -3642,7 +3700,7 @@ public class AgentMain {
* </ol>
* By restarting the plugin container in such conditions, we essentially re-run the resource upgrade
* and let the plugin container try to re-merge with the server that we know has just connected.
- *
+ *
* @author Lukas Krejci
*/
private class PluginContainerConditionalRestartListener implements ClientCommandSenderStateListener {
@@ -3750,7 +3808,7 @@ public class AgentMain {
try {
// if we can't send to the server ignore the ping
if (!m_clientSender.isSending()) {
- // An unlikely state, but if we're not sending, not polling and not performing autoDiscovery
+ // An unlikely state, but if we're not sending, not polling and not performing autoDiscovery
// (multicast), then start polling to we eventually get out of this state.
if (!(m_clientSender.isServerPolling() || isAutoDiscoveryEnabled())) {
LOG.info(AgentI18NResourceKeys.PING_EXECUTOR_STARTING_POLLING);
@@ -3760,7 +3818,7 @@ public class AgentMain {
return;
}
- // we are in sending mode, so make sure the poller is off
+ // we are in sending mode, so make sure the poller is off
if (m_clientSender.isServerPolling()) {
LOG.info(AgentI18NResourceKeys.PING_EXECUTOR_STOPPING_POLLING_RESUME_PING);
m_clientSender.stopServerPolling();
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java
index d5878c6..941ae93 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java
@@ -236,20 +236,56 @@ public class StartupBean implements StartupLocal {
private void checkTempDir() {
File tmpDir = new File(System.getProperty("java.io.tmpdir"));
if (!tmpDir.exists()) {
- throw new RuntimeException("Startup failed: java.io.tmpdir '" + tmpDir.getAbsolutePath()
- + "' does not exist");
+ log.warn("Invalid java.io.tmpdir: [" + tmpDir.getAbsolutePath() + "] does not exist.");
+ useLocalTmpDir();
+ return;
}
if (!tmpDir.isDirectory()) {
- throw new RuntimeException("Startup failed: java.io.tmpdir '" + tmpDir.getAbsolutePath()
- + "' is not a directory");
+ log.warn("Invalid java.io.tmpdir: [" + tmpDir.getAbsolutePath() + "] is not a directory");
+ useLocalTmpDir();
+ return;
}
if (!tmpDir.canRead() || !tmpDir.canExecute()) {
- throw new RuntimeException("Startup failed: java.io.tmpdir '" + tmpDir.getAbsolutePath()
- + "' is not readable");
+ log.warn("Invalid java.io.tmpdir: [" + tmpDir.getAbsolutePath() + "] is not readable");
+ useLocalTmpDir();
+ return;
}
if (!tmpDir.canWrite()) {
- throw new RuntimeException("Startup failed: java.io.tmpdir '" + tmpDir.getAbsolutePath()
- + "' is not writable");
+ log.warn("Invalid java.io.tmpdir: [" + tmpDir.getAbsolutePath() + "] is not writable");
+ useLocalTmpDir();
+ return;
+ }
+ }
+
+ private void useLocalTmpDir() {
+ File localTmpDir = null;
+ try {
+ localTmpDir = new File(LookupUtil.getCoreServer().getInstallDir(), "temp");
+ log.info("Using alternate java.io.tmpdir: [" + localTmpDir.getAbsolutePath() + "]");
+ if (!localTmpDir.exists()) {
+ log.info("Creating alternate java.io.tmpdir: [" + localTmpDir.getAbsolutePath() + "]");
+ localTmpDir.mkdir();
+ }
+ System.setProperty("java.io.tmpdir", localTmpDir.getAbsolutePath());
+ } catch (Throwable t) {
+ throw new RuntimeException("Startup failed: Could not create or set local java.io.tmpdir ["
+ + localTmpDir.getAbsolutePath() + "]", t);
+ }
+ if (!localTmpDir.exists()) {
+ throw new RuntimeException("Startup failed: local java.io.tmpdir [" + localTmpDir.getAbsolutePath()
+ + "] does not exist");
+ }
+ if (!localTmpDir.isDirectory()) {
+ throw new RuntimeException("Startup failed: local java.io.tmpdir [" + localTmpDir.getAbsolutePath()
+ + "] is not a directory");
+ }
+ if (!localTmpDir.canRead() || !localTmpDir.canExecute()) {
+ throw new RuntimeException("Startup failed: local java.io.tmpdir [" + localTmpDir.getAbsolutePath()
+ + "] is not readable");
+ }
+ if (!localTmpDir.canWrite()) {
+ throw new RuntimeException("Startup failed: local java.io.tmpdir [" + localTmpDir.getAbsolutePath()
+ + "] is not writable");
}
}
@@ -546,19 +582,19 @@ public class StartupBean implements StartupLocal {
}
}
- /**
- * This seeds the agent clients cache with clients for all known agents. These clients will be started so they can
- * immediately begin to send any persisted guaranteed messages that might already exist. This method must be called
- * at a time when the server is ready to accept messages from agents because any guaranteed messages that are
- * delivered might trigger the agents to send messages back to the server.
- *
- * NOTE: we don't need to do this - so far, none of the messages the server sends to the agent are marked
- * with "guaranteed delivery" (this is on purpose and a good thing) so we don't need to start all the agent clients
- * in case they have persisted messages. Since the number of agents could be large this cache could be huge and
- * take some time to initialize. If we don't call this, it speeds up start up, and doesn't bloat memory with
- * clients we might not ever need (since agents might have affinity to other servers). Agent clients
- * can be created lazily at runtime when the server needs it.
- */
+ /**
+ * This seeds the agent clients cache with clients for all known agents. These clients will be started so they can
+ * immediately begin to send any persisted guaranteed messages that might already exist. This method must be called
+ * at a time when the server is ready to accept messages from agents because any guaranteed messages that are
+ * delivered might trigger the agents to send messages back to the server.
+ *
+ * NOTE: we don't need to do this - so far, none of the messages the server sends to the agent are marked
+ * with "guaranteed delivery" (this is on purpose and a good thing) so we don't need to start all the agent clients
+ * in case they have persisted messages. Since the number of agents could be large this cache could be huge and
+ * take some time to initialize. If we don't call this, it speeds up start up, and doesn't bloat memory with
+ * clients we might not ever need (since agents might have affinity to other servers). Agent clients
+ * can be created lazily at runtime when the server needs it.
+ */
private void startAgentClients() {
log.info("Starting agent clients - any persisted messages with guaranteed delivery will be sent...");
@@ -598,7 +634,7 @@ public class StartupBean implements StartupLocal {
final long initialDelay = 1000L * 60;
final long interval = 1000L * 60;
schedulerBean.scheduleSimpleRepeatingJob(SavedSearchResultCountRecalculationJob.class, true, false,
- initialDelay, interval);
+ initialDelay, interval);
} catch (Exception e) {
log.error("Cannot schedule asynchronous resource deletion job.", e);
}
@@ -636,7 +672,7 @@ public class StartupBean implements StartupLocal {
final long initialDelay = 1000L * 60;
final long interval = 1000L * 60;
schedulerBean.scheduleSimpleRepeatingJob(DynaGroupAutoRecalculationJob.class, true, false, initialDelay,
- interval);
+ interval);
} catch (Exception e) {
log.error("Cannot schedule DynaGroup auto-recalculation job.", e);
}
@@ -738,9 +774,9 @@ public class StartupBean implements StartupLocal {
log.error("Cannot create storage cluster init job", e);
}
}
-
+
try {
- String cronString = "0 30 0 ? * SUN *"; // every sunday starting at 00:30.
+ String cronString = "0 30 0 ? * SUN *"; // every sunday starting at 00:30.
schedulerBean.scheduleSimpleCronJob(StorageClusterReadRepairJob.class, true, true, cronString);
} catch (Exception e) {
log.error("Cannot create storage cluster read repair job", e);
@@ -754,6 +790,7 @@ public class StartupBean implements StartupLocal {
*
* @deprecated we don't have an embedded agent anymore, leaving this in case we resurrect it
*/
+ @Deprecated
private void startEmbeddedAgent() throws RuntimeException {
// we can't use EmbeddedAgentBootstrapServiceMBean because if the embedded agent
// isn't installed, that class will not be available; we must use JMX API
commit d34ef2053001dd2ecb7bc17614950f508dfefb60
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Oct 25 14:17:27 2013 -0400
Bug 1022620 - Windows 2008 - Upgrade to JON3.2.ER3 fails when using oracle jdk7-32b
The 64bit Java distribution assumes that it will run a '-server' JVM, which
is required by RHQ (in part because the underlying AS7 also requires it but
also because it should run as a server). The 32bit distribution still makes
a distinction between a client JVM (optimized to be lightweight) and a server
JVM (optimized to perform). Only the 32bit JDK supplies the server JVM, so
for 32 Java bit we require the JDK.
By default the 32bit distribution installs under 'c:\Program Files (x86)\Java\'.
Unfortunately, our scripts failed when RHQ_JAVA_HOME was set to this
directory, because the parentheses cause issues with the script conditionals,
which (by brilliant M$ design) use parens for grouping. So, fix #1 in this
check-in is to enable and delayed expansion of variables in the scripts, in our
logic determining where the java exe is.
On Windows we install RHQ into three windows services, one for storage, server
and agent. By default, the (non--user) local system account runs the services.
Unfortunately, when using the 32bit distribution the java.io.tmpdir then
resolves to a locked-down temp directory under windows/system32, which
subsequently stops things from working. The workaround is to use a user
account via RUN_AS[_ME] or to redefined java.io.tmpdir to be a valid
directory. The latter choice is somewhat involved as you need to update
the property in all three service wrapper configurations. This was not
as easily supported as it could be, so fix #2 is to add wrapper.inc files
for all of the components and beef up some commenting in several of our
script/conf files.
Also in this commit:
- fix the CLI scripts to use the new RHQ_JAVA_HOME and RHQ_JAVA_EXE_FILE_PATH
properties. This had been previously missed.
- make the dev version of rhq-server-wrapper.inc apply lower mem settings.
ToDo: Wiki doco around 32bit distribution.
Conflicts:
modules/enterprise/server/appserver/src/main/bin-resources/bin/rhqctl.bat
Cherry-pick of master: 6d87af2dd0ffaa7ecad1e1ed6d67ac7f0ff45129
diff --git a/modules/enterprise/agent/ant-run.xml b/modules/enterprise/agent/ant-run.xml
index 4816e1c..d6ebbfb 100644
--- a/modules/enterprise/agent/ant-run.xml
+++ b/modules/enterprise/agent/ant-run.xml
@@ -186,7 +186,7 @@ Ant Script that provides ways to package the Agent.
<copy todir="${agent.distro.dir}/bin/wrapper">
<fileset dir="${basedir}/src/etc/java-service-wrapper"
- includes="rhq-agent-wrapper.conf"/>
+ includes="rhq-agent-wrapper.*"/>
</copy>
<copy todir="${agent.distro.dir}/bin/wrapper/windows-x86_32">
diff --git a/modules/enterprise/agent/src/etc/java-service-wrapper/rhq-agent-wrapper.inc b/modules/enterprise/agent/src/etc/java-service-wrapper/rhq-agent-wrapper.inc
new file mode 100644
index 0000000..cd22661
--- /dev/null
+++ b/modules/enterprise/agent/src/etc/java-service-wrapper/rhq-agent-wrapper.inc
@@ -0,0 +1,19 @@
+#*****************************************************************************
+# RHQ Agent Java Service Wrapper Settings Include File
+#
+# This file specifies a set of additional environment variables that will be
+# applied to the RHQ Agent JVM. This file will likely be empty.
+#
+# If adding additional Java properties note that the properties must follow
+# a strict number ordering (that continues from rhq-agent-wrapper.conf)
+# and currently must start with:
+#
+# wrapper.java.additional.9=
+#
+# For example, to set a non-default temp directory for Java:
+# Note: use forward slashes for directories:
+#
+# wrapper.java.additional.9="-Djava.io.tmpdir=c:/temp"
+#
+#*****************************************************************************
+
diff --git a/modules/enterprise/agent/src/etc/rhq-agent-env.bat b/modules/enterprise/agent/src/etc/rhq-agent-env.bat
index bfa2c9a..56485a1 100644
--- a/modules/enterprise/agent/src/etc/rhq-agent-env.bat
+++ b/modules/enterprise/agent/src/etc/rhq-agent-env.bat
@@ -30,7 +30,7 @@ rem RHQ_JAVA_EXE_FILE_PATH is set.
rem If this and RHQ_JAVA_EXE_FILE_PATH are
rem not set, JAVA_HOME will be used.
rem
-rem set RHQ_JAVA_HOME=C:\opt\java
+rem set RHQ_JAVA_HOME=
rem RHQ_JAVA_EXE_FILE_PATH - Defines the full path to the Java
rem executable to use. If this is set,
@@ -41,11 +41,13 @@ rem is used. If this and
rem RHQ_JAVA_HOME are not set, then
rem JAVA_HOME will be used.
rem
-rem set RHQ_JAVA_EXE_FILE_PATH=C:\WINDOWS\system32\java.exe
+rem set RHQ_JAVA_EXE_FILE_PATH=
rem ===========================================================================
-rem THE FOLLOWING ARE USED SOLELY FOR THE rhq-agent.bat SCRIPT
-rem THESE ARE NOT USED/IGNORED BY rhq-agent-wrapper.bat SCRIPT
+rem THE FOLLOWING ARE USED SOLELY FOR THE rhq-agent.bat SCRIPT,
+rem THEY ARE IGNORED BY rhq-agent-wrapper.bat SCRIPT. See the
+rem rhq-agent-wrapper.conf and rhq-agent-wrapper.inc for more
+rem on setting Java options.
rem RHQ_AGENT_JAVA_OPTS - Java VM command line options to be
rem passed into the agent's VM. If this is not defined
diff --git a/modules/enterprise/agent/src/etc/rhq-agent.bat b/modules/enterprise/agent/src/etc/rhq-agent.bat
index 59b2e3c..f7980b3 100644
--- a/modules/enterprise/agent/src/etc/rhq-agent.bat
+++ b/modules/enterprise/agent/src/etc/rhq-agent.bat
@@ -19,7 +19,7 @@ rem If the embedded JRE is to be used but is not available, the fallback
rem JRE to be used will be determined by the JAVA_HOME environment variable.
rem ===========================================================================
-setlocal
+setlocal enabledelayedexpansion
if "%1"=="_SETENV_ONLY" (
set _SETENV_ONLY=true
@@ -78,23 +78,23 @@ rem ----------------------------------------------------------------------
if not defined RHQ_JAVA_EXE_FILE_PATH (
if defined RHQ_AGENT_JAVA_EXE_FILE_PATH (
- set RHQ_JAVA_EXE_FILE_PATH=%RHQ_AGENT_JAVA_EXE_FILE_PATH%
+ set RHQ_JAVA_EXE_FILE_PATH=!RHQ_AGENT_JAVA_EXE_FILE_PATH!
)
)
if not defined RHQ_JAVA_HOME (
if defined RHQ_AGENT_JAVA_HOME (
- set RHQ_JAVA_HOME=%RHQ_AGENT_JAVA_HOME%
+ set RHQ_JAVA_HOME=!RHQ_AGENT_JAVA_HOME!
)
)
if not defined RHQ_JAVA_EXE_FILE_PATH (
if not defined RHQ_JAVA_HOME (
- if defined RHQ_AGENT_DEBUG echo No RHQ JAVA property set, defaulting to JAVA_HOME: %JAVA_HOME%
- set RHQ_JAVA_HOME=%JAVA_HOME%
+ if defined RHQ_AGENT_DEBUG echo No RHQ JAVA property set, defaulting to JAVA_HOME: !JAVA_HOME!
+ set RHQ_JAVA_HOME=!JAVA_HOME!
)
)
if not defined RHQ_JAVA_EXE_FILE_PATH (
- set RHQ_JAVA_EXE_FILE_PATH=%RHQ_JAVA_HOME%\bin\java.exe
+ set RHQ_JAVA_EXE_FILE_PATH=!RHQ_JAVA_HOME!\bin\java.exe
)
if defined RHQ_AGENT_DEBUG echo RHQ_JAVA_HOME: %RHQ_JAVA_HOME%
diff --git a/modules/enterprise/remoting/cli/src/etc/rhq-cli-env.bat b/modules/enterprise/remoting/cli/src/etc/rhq-cli-env.bat
index 8ef3b68..d5d1189 100644
--- a/modules/enterprise/remoting/cli/src/etc/rhq-cli-env.bat
+++ b/modules/enterprise/remoting/cli/src/etc/rhq-cli-env.bat
@@ -16,22 +16,18 @@ rem directory of the directory where this script lives.
rem
rem set RHQ_CLI_HOME=C:\opt\rhq-cli
-rem RHQ_CLI_JAVA_HOME - The location of the JRE that the CLI will
-rem use. This will be ignored if
-rem RHQ_CLI_JAVA_EXE_FILE_PATH is set.
-rem If this and RHQ_CLI_JAVA_EXE_FILE_PATH are
-rem not set, the CLI will default to JAVA_HOME.
-rem
-rem set RHQ_CLI_JAVA_HOME=
+rem RHQ_JAVA_HOME - The location of the JRE that the server will use. This
+rem will be ignored if RHQ_JAVA_EXE_FILE_PATH is set.
+rem If this and RHQ_JAVA_EXE_FILE_PATH are not set, then
+rem JAVA_HOME will be used.
+rem set RHQ_JAVA_HOME=
-rem RHQ_CLI_JAVA_EXE_FILE_PATH - Defines the full path to the Java
-rem executable to use. If this is set,
-rem RHQ_CLI_JAVA_HOME is ignored.
-rem If this is not set, then
-rem %RHQ_CLI_JAVA_HOME%\bin\java.exe
-rem is used.
-rem
-rem set RHQ_CLI_JAVA_EXE_FILE_PATH=C:\WINDOWS\system32\java.exe
+rem RHQ_JAVA_EXE_FILE_PATH - Defines the full path to the Java executable to
+rem use. If this is set, RHQ_JAVA_HOME is ignored.
+rem If this is not set, then $RHQ_JAVA_HOME/bin/java
+rem is used. If this and RHQ_JAVA_HOME are not set,
+rem then $JAVA_HOME/bin/java will be used.
+rem set RHQ_JAVA_EXE_FILE_PATH=
rem RHQ_CLI_JAVA_OPTS - Java VM command line options to be
rem passed into the CLI's VM. If this is not defined
diff --git a/modules/enterprise/remoting/cli/src/etc/rhq-cli.bat b/modules/enterprise/remoting/cli/src/etc/rhq-cli.bat
index 0d80d3e..b7992c5 100644
--- a/modules/enterprise/remoting/cli/src/etc/rhq-cli.bat
+++ b/modules/enterprise/remoting/cli/src/etc/rhq-cli.bat
@@ -11,7 +11,7 @@ rem are described in comments in rhq-cli-env.bat. The variables can also be
rem set via rhq-cli-env.bat, which is sourced by this script.
rem ===========================================================================
-setlocal
+setlocal enabledelayedexpansion
title RHQ CLI
@@ -56,22 +56,36 @@ if defined RHQ_CLI_DEBUG echo RHQ_CLI_HOME: %RHQ_CLI_HOME%
rem ----------------------------------------------------------------------
rem Find the Java executable and verify we have a VM available
+rem Note that RHQ_CLI_JAVA_* props are still handled for back compat
rem ----------------------------------------------------------------------
-if not defined RHQ_CLI_JAVA_EXE_FILE_PATH (
- if not defined RHQ_CLI_JAVA_HOME call :prepare_embedded_jre
+if not defined RHQ_JAVA_EXE_FILE_PATH (
+ if defined RHQ_CLI_JAVA_EXE_FILE_PATH (
+ set RHQ_JAVA_EXE_FILE_PATH=!RHQ_CLI_JAVA_EXE_FILE_PATH!
+ )
+)
+if not defined RHQ_JAVA_HOME (
+ if defined RHQ_CLI_JAVA_HOME (
+ set RHQ_JAVA_HOME=!RHQ_CLI_JAVA_HOME!
+ )
)
-if not defined RHQ_CLI_JAVA_EXE_FILE_PATH (
- set RHQ_CLI_JAVA_EXE_FILE_PATH=%RHQ_CLI_JAVA_HOME%\bin\java.exe
+if not defined RHQ_JAVA_EXE_FILE_PATH (
+ if not defined RHQ_JAVA_HOME (
+ if defined RHQ_CLI_DEBUG echo No RHQ JAVA property set, defaulting to JAVA_HOME: !JAVA_HOME!
+ set RHQ_JAVA_HOME=!JAVA_HOME!
+ )
+)
+if not defined RHQ_JAVA_EXE_FILE_PATH (
+ set RHQ_JAVA_EXE_FILE_PATH=!RHQ_JAVA_HOME!\bin\java.exe
)
-if defined RHQ_CLI_DEBUG echo RHQ_CLI_JAVA_HOME: %RHQ_CLI_JAVA_HOME%
-if defined RHQ_CLI_DEBUG echo RHQ_CLI_JAVA_EXE_FILE_PATH: %RHQ_CLI_JAVA_EXE_FILE_PATH%
+if defined RHQ_CLI_DEBUG echo RHQ_JAVA_HOME: %RHQ_JAVA_HOME%
+if defined RHQ_CLI_DEBUG echo RHQ_JAVA_EXE_FILE_PATH: %RHQ_JAVA_EXE_FILE_PATH%
-if not exist "%RHQ_CLI_JAVA_EXE_FILE_PATH%" (
+if not exist "%RHQ_JAVA_EXE_FILE_PATH%" (
echo There is no JVM available.
- echo Please set RHQ_CLI_JAVA_HOME or RHQ_CLI_JAVA_EXE_FILE_PATH appropriately.
+ echo Please set RHQ_JAVA_HOME or RHQ_JAVA_EXE_FILE_PATH appropriately.
exit /B 1
)
@@ -163,19 +177,6 @@ if not defined CLASSPATH (
goto :eof
rem ----------------------------------------------------------------------
-rem CALL subroutine that prepares to use the embedded JRE
-rem ----------------------------------------------------------------------
-
-:prepare_embedded_jre
-set RHQ_CLI_JAVA_HOME=%RHQ_CLI_HOME%\jre
-if defined RHQ_CLI_DEBUG echo Using the embedded JRE
-if not exist "%RHQ_CLI_JAVA_HOME%" (
- if defined RHQ_CLI_DEBUG echo No embedded JRE found - will try to use JAVA_HOME: %JAVA_HOME%
- set RHQ_CLI_JAVA_HOME=%JAVA_HOME%
-)
-goto :eof
-
-rem ----------------------------------------------------------------------
rem CALL subroutine that exits this script normally
rem ----------------------------------------------------------------------
diff --git a/modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-installer.bat b/modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-installer.bat
index 2b95d74c..d2c554c 100644
--- a/modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-installer.bat
+++ b/modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-installer.bat
@@ -47,7 +47,7 @@ rem If the embedded JRE is to be used but is not available, the fallback
rem JRE to be used will be determined by the JAVA_HOME environment variable.
rem ===========================================================================
-setlocal
+setlocal enabledelayedexpansion
rem if debug variable is set, it is assumed to be on, unless its value is false
if "%RHQ_SERVER_DEBUG%" == "false" (
@@ -80,23 +80,23 @@ rem ----------------------------------------------------------------------
if not defined RHQ_JAVA_EXE_FILE_PATH (
if defined RHQ_SERVER_JAVA_EXE_FILE_PATH (
- set RHQ_JAVA_EXE_FILE_PATH=%RHQ_SERVER_JAVA_EXE_FILE_PATH%
+ set RHQ_JAVA_EXE_FILE_PATH=!RHQ_SERVER_JAVA_EXE_FILE_PATH!
)
)
if not defined RHQ_JAVA_HOME (
if defined RHQ_SERVER_JAVA_HOME (
- set RHQ_JAVA_HOME=%RHQ_SERVER_JAVA_HOME%
+ set RHQ_JAVA_HOME=!RHQ_SERVER_JAVA_HOME!
)
)
if not defined RHQ_JAVA_EXE_FILE_PATH (
if not defined RHQ_JAVA_HOME (
- if defined RHQ_SERVER_DEBUG echo No RHQ JAVA property set, defaulting to JAVA_HOME: %JAVA_HOME%
- set RHQ_JAVA_HOME=%JAVA_HOME%
+ if defined RHQ_SERVER_DEBUG echo No RHQ JAVA property set, defaulting to JAVA_HOME: !JAVA_HOME!
+ set RHQ_JAVA_HOME=!JAVA_HOME!
)
)
if not defined RHQ_JAVA_EXE_FILE_PATH (
- set RHQ_JAVA_EXE_FILE_PATH=%RHQ_JAVA_HOME%\bin\java.exe
+ set RHQ_JAVA_EXE_FILE_PATH=!RHQ_JAVA_HOME!\bin\java.exe
)
if defined RHQ_SERVER_DEBUG echo RHQ_JAVA_HOME: %RHQ_JAVA_HOME%
diff --git a/modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-server.bat b/modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-server.bat
index a8a70ff..ba6cbd8 100644
--- a/modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-server.bat
+++ b/modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-server.bat
@@ -58,7 +58,7 @@ rem
rem This script does not use the built-in JBossAS run.bat.
rem ===========================================================================
-setlocal
+setlocal enabledelayedexpansion
rem if debug variable is set, it is assumed to be on, unless its value is false
if "%RHQ_SERVER_DEBUG%" == "false" (
@@ -91,23 +91,23 @@ rem ----------------------------------------------------------------------
if not defined RHQ_JAVA_EXE_FILE_PATH (
if defined RHQ_SERVER_JAVA_EXE_FILE_PATH (
- set RHQ_JAVA_EXE_FILE_PATH=%RHQ_SERVER_JAVA_EXE_FILE_PATH%
+ set RHQ_JAVA_EXE_FILE_PATH=!RHQ_SERVER_JAVA_EXE_FILE_PATH!
)
)
if not defined RHQ_JAVA_HOME (
if defined RHQ_SERVER_JAVA_HOME (
- set RHQ_JAVA_HOME=%RHQ_SERVER_JAVA_HOME%
+ set RHQ_JAVA_HOME=!RHQ_SERVER_JAVA_HOME!
)
)
if not defined RHQ_JAVA_EXE_FILE_PATH (
if not defined RHQ_JAVA_HOME (
- if defined RHQ_SERVER_DEBUG echo No RHQ JAVA property set, defaulting to JAVA_HOME: %JAVA_HOME%
- set RHQ_JAVA_HOME=%JAVA_HOME%
+ if defined RHQ_SERVER_DEBUG echo No RHQ JAVA property set, defaulting to JAVA_HOME: !JAVA_HOME!
+ set RHQ_JAVA_HOME=!JAVA_HOME!
)
)
if not defined RHQ_JAVA_EXE_FILE_PATH (
- set RHQ_JAVA_EXE_FILE_PATH=%RHQ_JAVA_HOME%\bin\java.exe
+ set RHQ_JAVA_EXE_FILE_PATH=!RHQ_JAVA_HOME!\bin\java.exe
)
if defined RHQ_SERVER_DEBUG echo RHQ_JAVA_HOME: %RHQ_JAVA_HOME%
diff --git a/modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-storage-installer.bat b/modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-storage-installer.bat
index 6f97385..f29b7c9 100644
--- a/modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-storage-installer.bat
+++ b/modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-storage-installer.bat
@@ -50,7 +50,7 @@ rem left unset if it is not needed.
rem
rem =============================================================================
-setlocal
+setlocal enabledelayedexpansion
rem if debug variable is set, it is assumed to be on, unless its value is false
if "%RHQ_STORAGE_DEBUG%" == "false" (
@@ -135,23 +135,23 @@ rem ----------------------------------------------------------------------
if not defined RHQ_JAVA_EXE_FILE_PATH (
if defined RHQ_SERVER_JAVA_EXE_FILE_PATH (
- set RHQ_JAVA_EXE_FILE_PATH=%RHQ_SERVER_JAVA_EXE_FILE_PATH%
+ set RHQ_JAVA_EXE_FILE_PATH=!RHQ_SERVER_JAVA_EXE_FILE_PATH!
)
)
if not defined RHQ_JAVA_HOME (
if defined RHQ_SERVER_JAVA_HOME (
- set RHQ_JAVA_HOME=%RHQ_SERVER_JAVA_HOME%
+ set RHQ_JAVA_HOME=!RHQ_SERVER_JAVA_HOME!
)
)
if not defined RHQ_JAVA_EXE_FILE_PATH (
if not defined RHQ_JAVA_HOME (
- if defined RHQ_STORAGE_DEBUG echo No RHQ JAVA property set, defaulting to JAVA_HOME: %JAVA_HOME%
- set RHQ_JAVA_HOME=%JAVA_HOME%
+ if defined RHQ_STORAGE_DEBUG echo No RHQ JAVA property set, defaulting to JAVA_HOME: !JAVA_HOME!
+ set RHQ_JAVA_HOME=!JAVA_HOME!
)
)
if not defined RHQ_JAVA_EXE_FILE_PATH (
- set RHQ_JAVA_EXE_FILE_PATH=%RHQ_JAVA_HOME%\bin\java.exe
+ set RHQ_JAVA_EXE_FILE_PATH=!RHQ_JAVA_HOME!\bin\java.exe
)
if defined RHQ_STORAGE_DEBUG echo RHQ_JAVA_HOME: %RHQ_JAVA_HOME%
diff --git a/modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-storage.bat b/modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-storage.bat
index 7560932..c2f7f02 100644
--- a/modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-storage.bat
+++ b/modules/enterprise/server/appserver/src/main/bin-resources/bin/internal/rhq-storage.bat
@@ -60,7 +60,7 @@ rem
rem This script does not use the built-in cassandra.bat.
rem ===========================================================================
-setlocal
+setlocal enabledelayedexpansion
rem if debug variable is set, it is assumed to be on, unless its value is false
if "%RHQ_STORAGE_DEBUG%" == "false" (
@@ -111,23 +111,23 @@ rem ----------------------------------------------------------------------
if not defined RHQ_JAVA_EXE_FILE_PATH (
if defined RHQ_SERVER_JAVA_EXE_FILE_PATH (
- set RHQ_JAVA_EXE_FILE_PATH=%RHQ_SERVER_JAVA_EXE_FILE_PATH%
+ set RHQ_JAVA_EXE_FILE_PATH=!RHQ_SERVER_JAVA_EXE_FILE_PATH!
)
)
if not defined RHQ_JAVA_HOME (
if defined RHQ_SERVER_JAVA_HOME (
- set RHQ_JAVA_HOME=%RHQ_SERVER_JAVA_HOME%
+ set RHQ_JAVA_HOME=!RHQ_SERVER_JAVA_HOME!
)
)
if not defined RHQ_JAVA_EXE_FILE_PATH (
if not defined RHQ_JAVA_HOME (
- if defined RHQ_STORAGE_DEBUG echo No RHQ JAVA property set, defaulting to JAVA_HOME: %JAVA_HOME%
- set RHQ_JAVA_HOME=%JAVA_HOME%
+ if defined RHQ_STORAGE_DEBUG echo No RHQ JAVA property set, defaulting to JAVA_HOME: !JAVA_HOME!
+ set RHQ_JAVA_HOME=!JAVA_HOME!
)
)
if not defined RHQ_JAVA_EXE_FILE_PATH (
- set RHQ_JAVA_EXE_FILE_PATH=%RHQ_JAVA_HOME%\bin\java.exe
+ set RHQ_JAVA_EXE_FILE_PATH=!RHQ_JAVA_HOME!\bin\java.exe
)
if defined RHQ_STORAGE_DEBUG echo RHQ_JAVA_HOME: %RHQ_JAVA_HOME%
diff --git a/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-data-migration.bat b/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-data-migration.bat
index 844495d..7976b98 100644
--- a/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-data-migration.bat
+++ b/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhq-data-migration.bat
@@ -50,7 +50,7 @@ rem left unset if it is not needed.
rem
rem =============================================================================
-setlocal
+setlocal enabledelayedexpansion
rem if debug variable is set, it is assumed to be on, unless its value is false
if "%RHQ_DATA_MIGRATION_DEBUG%" == "false" (
@@ -135,23 +135,23 @@ rem ----------------------------------------------------------------------
if not defined RHQ_JAVA_EXE_FILE_PATH (
if defined RHQ_SERVER_JAVA_EXE_FILE_PATH (
- set RHQ_JAVA_EXE_FILE_PATH=%RHQ_SERVER_JAVA_EXE_FILE_PATH%
+ set RHQ_JAVA_EXE_FILE_PATH=!RHQ_SERVER_JAVA_EXE_FILE_PATH!
)
)
if not defined RHQ_JAVA_HOME (
if defined RHQ_SERVER_JAVA_HOME (
- set RHQ_JAVA_HOME=%RHQ_SERVER_JAVA_HOME%
+ set RHQ_JAVA_HOME=!RHQ_SERVER_JAVA_HOME!
)
)
if not defined RHQ_JAVA_EXE_FILE_PATH (
if not defined RHQ_JAVA_HOME (
- if defined RHQ_DATA_MIGRATION_DEBUG echo No RHQ JAVA property set, defaulting to JAVA_HOME: %JAVA_HOME%
- set RHQ_JAVA_HOME=%JAVA_HOME%
+ if defined RHQ_DATA_MIGRATION_DEBUG echo No RHQ JAVA property set, defaulting to JAVA_HOME: !JAVA_HOME!
+ set RHQ_JAVA_HOME=!JAVA_HOME!
)
)
if not defined RHQ_JAVA_EXE_FILE_PATH (
- set RHQ_JAVA_EXE_FILE_PATH=%RHQ_JAVA_HOME%\bin\java.exe
+ set RHQ_JAVA_EXE_FILE_PATH=!RHQ_JAVA_HOME!\bin\java.exe
)
if defined RHQ_DATA_MIGRATION_DEBUG echo RHQ_JAVA_HOME: %RHQ_JAVA_HOME%
diff --git a/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhqctl.bat b/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhqctl.bat
index 6a611e4..8d16ceb 100644
--- a/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhqctl.bat
+++ b/modules/enterprise/server/appserver/src/main/bin-resources/bin/rhqctl.bat
@@ -49,7 +49,7 @@ rem left unset if it is not needed.
rem =============================================================================
-setlocal
+setlocal enabledelayedexpansion
rem if debug variable is set, it is assumed to be on, unless its value is false
if "%RHQ_CONTROL_DEBUG%" == "false" (
@@ -134,23 +134,23 @@ rem ----------------------------------------------------------------------
if not defined RHQ_JAVA_EXE_FILE_PATH (
if defined RHQ_SERVER_JAVA_EXE_FILE_PATH (
- set RHQ_JAVA_EXE_FILE_PATH=%RHQ_SERVER_JAVA_EXE_FILE_PATH%
+ set RHQ_JAVA_EXE_FILE_PATH=!RHQ_SERVER_JAVA_EXE_FILE_PATH!
)
)
if not defined RHQ_JAVA_HOME (
if defined RHQ_SERVER_JAVA_HOME (
- set RHQ_JAVA_HOME=%RHQ_SERVER_JAVA_HOME%
+ set RHQ_JAVA_HOME=!RHQ_SERVER_JAVA_HOME!
)
)
if not defined RHQ_JAVA_EXE_FILE_PATH (
if not defined RHQ_JAVA_HOME (
- if defined RHQ_CONTROL_DEBUG echo No RHQ JAVA property set, defaulting to JAVA_HOME: %JAVA_HOME%
- set RHQ_JAVA_HOME=%JAVA_HOME%
+ if defined RHQ_CONTROL_DEBUG echo No RHQ JAVA property set, defaulting to JAVA_HOME: !JAVA_HOME!
+ set RHQ_JAVA_HOME=!JAVA_HOME!
)
)
if not defined RHQ_JAVA_EXE_FILE_PATH (
- set RHQ_JAVA_EXE_FILE_PATH=%RHQ_JAVA_HOME%\bin\java.exe
+ set RHQ_JAVA_EXE_FILE_PATH=!RHQ_JAVA_HOME!\bin\java.exe
)
if defined RHQ_CONTROL_DEBUG echo RHQ_JAVA_HOME: %RHQ_JAVA_HOME%
@@ -178,8 +178,7 @@ if defined RHQ_CONTROL_DEBUG (
set _RHQ_LOGLEVEL=INFO
)
-rem debugging the logging level now for development/testing
-rem debugging the logging level now for development/testing
+rem Set some of the base required options
set RHQ_CONTROL_JAVA_OPTS=%RHQ_CONTROL_JAVA_OPTS% -Djava.awt.headless=true -Drhq.server.properties-file="%RHQ_SERVER_HOME%\bin\rhq-server.properties" -Drhq.control.logdir="%RHQ_SERVER_HOME%\logs" -Drhq.control.loglevel=%_RHQ_LOGLEVEL% -Drhq.server.basedir="%RHQ_SERVER_HOME%" -Drhqctl.properties-file="%RHQ_SERVER_HOME%\bin\rhqctl.properties" -Drhq.java-exe-file-path="%RHQ_JAVA_EXE_FILE_PATH%"
rem Sample JPDA settings for remote socket debugging
diff --git a/modules/enterprise/server/appserver/src/main/bin-resources/bin/wrapper/rhq-server-wrapper.inc b/modules/enterprise/server/appserver/src/main/bin-resources/bin/wrapper/rhq-server-wrapper.inc
new file mode 100644
index 0000000..ffef3ce
--- /dev/null
+++ b/modules/enterprise/server/appserver/src/main/bin-resources/bin/wrapper/rhq-server-wrapper.inc
@@ -0,0 +1,19 @@
+#*****************************************************************************
+# RHQ Server Java Service Wrapper Settings Include File
+#
+# This file specifies a set of additional environment variables that will be
+# applied to the RHQ Server JVM. This file will likely be empty.
+#
+# If adding additional Java properties note that the properties must follow
+# a strict number ordering (that continues from rhq-server-wrapper.conf)
+# and currently must start with:
+#
+# wrapper.java.additional.23=
+#
+# For example, to set a non-default temp directory for Java:
+# Note: use forward slashes for directories:
+#
+# wrapper.java.additional.23="-Djava.io.tmpdir=c:/temp"
+#
+#*****************************************************************************
+
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
index 1441e0a..ff0cb19 100644
--- 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
@@ -2,15 +2,21 @@
# 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.
+# applied to the RHQ Storage Node JVM.
#
-# THIS FILE SHOULD NOT BE EDITED!
+#*****************************************************************************
+
+
+#*****************************************************************************
+# MANAGED SETTINGS
#
-# This file represents the values managed as RHQ Storage Node resource
+# This section represents the values managed as RHQ Storage Node resource
# configuration values. Or, set by the installer.
#
+# DO NOT EDIT THESE VALUES BY HAND. Changes should be performed via
+# the Administration section of the RHQ GUI.
+#
#*****************************************************************************
-
set.jmx_port=7299
set.heap_min=-Xms512M
@@ -22,3 +28,14 @@ set.thread_stack_size=-Xss180k
set.heap_dump_on_OOMError=-XX:+HeapDumpOnOutOfMemoryError
set.heap_dump_dir=
+
+
+#*****************************************************************************
+# CUSTOM SETTINGS
+#
+# This section if for additional properties managed by the user. In general
+# there will be nothing defined in this section. More likely any customization
+# of what is set in the rhq-storage-wrapper.conf would be located in the
+# rhq-storage-wrapper.inc file. See that file for more information.
+#
+#*****************************************************************************
diff --git a/modules/enterprise/server/appserver/src/main/bin-resources/bin/wrapper/rhq-storage-wrapper.inc b/modules/enterprise/server/appserver/src/main/bin-resources/bin/wrapper/rhq-storage-wrapper.inc
new file mode 100644
index 0000000..ef5aa09
--- /dev/null
+++ b/modules/enterprise/server/appserver/src/main/bin-resources/bin/wrapper/rhq-storage-wrapper.inc
@@ -0,0 +1,19 @@
+#*****************************************************************************
+# RHQ Storage Node Java Service Wrapper Settings Include File
+#
+# This file specifies a set of additional environment variables that will be
+# applied to the RHQ Storage Node JVM. This file will likely be empty.
+#
+# If adding additional Java properties note that the properties must follow
+# a strict number ordering (that continues from rhq-storage-wrapper.conf)
+# and currently must start with:
+#
+# wrapper.java.additional.21=
+#
+# For example, to set a non-default temp directory for Java:
+# Note: use forward slashes for directories:
+#
+# wrapper.java.additional.21="-Djava.io.tmpdir=c:/temp"
+#
+#*****************************************************************************
+
diff --git a/modules/enterprise/server/appserver/src/main/dev-resources/bin/wrapper/rhq-server-wrapper.inc b/modules/enterprise/server/appserver/src/main/dev-resources/bin/wrapper/rhq-server-wrapper.inc
index 8cd24ee..d883571 100644
--- a/modules/enterprise/server/appserver/src/main/dev-resources/bin/wrapper/rhq-server-wrapper.inc
+++ b/modules/enterprise/server/appserver/src/main/dev-resources/bin/wrapper/rhq-server-wrapper.inc
@@ -3,13 +3,19 @@
# last wrapper.java.additional.N entry in rhq-server-wrapper.conf.
#
+# reduce memory needs for dev env.
+wrapper.java.additional.23=-Xms512M
+wrapper.java.additional.24=-Xmx512M
+wrapper.java.additional.25=-XX:PermSize=200M
+wrapper.java.additional.26=-XX:MaxPermSize=200M
+
# enable remote debugging
-wrapper.java.additional.23=-agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=n
+wrapper.java.additional.27=-agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=n
# enable jprofiler
#set.PATH=%PATH%;<jprofiler-install-dir>\bin\windows
-#wrapper.java.additional.24=-agentlib:jprofilerti=port=8849
-#wrapper.java.additional.25=-Xbootclasspath/a:<jprofiler-install-dir>\bin\agent.jar
+#wrapper.java.additional.28=-agentlib:jprofilerti=port=8849
+#wrapper.java.additional.29=-Xbootclasspath/a:<jprofiler-install-dir>\bin\agent.jar
# disable JVM startup timeout
wrapper.startup.timeout=0
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 67eff91..ae1a184 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
@@ -1008,7 +1008,7 @@ ${comment}rhq.storage.verify-data-dirs-empty=${rhq.storage.verify-data-dirs-empt
<target name="copy-dev-resources" if="copy.dev.resources">
<echo>Copying dev-only resources ...</echo>
- <copy todir="${project.build.outputDirectory}" verbose="true">
+ <copy todir="${project.build.outputDirectory}" overwrite="true" verbose="true">
<fileset dir="src/main/dev-resources" />
</copy>
<loadproperties>
10 years, 6 months
[rhq] modules/enterprise
by Jay Shaughnessy
modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentMain.java | 124 +++++++---
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java | 87 +++++--
2 files changed, 153 insertions(+), 58 deletions(-)
New commits:
commit fdc1cabee3ea72a167f71971a7d4c8f324b8e8db
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Oct 25 17:47:23 2013 -0400
Bug 1022620 - Windows 2008 - Upgrade to JON3.2.ER3 fails when using oracle jdk7-32b
Second commit for this.
Went one step further. Now for the server and agent we create/set java.io.tmpdir
to InstallDir/temp, if the original java.io.tmpdir is invalid. We'll generate
a warning about the original setting. We'll only exit if our attempt to
create/set a local temp dir fails. This helps us succeed out of box with
the known issues using the 32-bit JVm on Windows, as well as getting
around the issue in general.
diff --git a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentMain.java b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentMain.java
index 77c88b1..c99f4b6 100644
--- a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentMain.java
+++ b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentMain.java
@@ -368,7 +368,7 @@ public class AgentMain {
private VMHealthCheckThread m_vmHealthCheckThread;
/**
- * Counts the number of times the agent has been restarted and holds the reason for the last restart.
+ * Counts the number of times the agent has been restarted and holds the reason for the last restart.
*/
private final AgentRestartCounter m_agentRestartCounter = new AgentRestartCounter();
@@ -378,7 +378,7 @@ public class AgentMain {
private boolean m_disableNativeSystem;
/**
- * Thread used to repeatedly ping the server for connectivity, agent avail update, and clock sync
+ * Thread used to repeatedly ping the server for connectivity, agent avail update, and clock sync
*/
private ScheduledThreadPoolExecutor m_pingThreadPoolExecutor;
@@ -465,6 +465,62 @@ public class AgentMain {
return;
}
+ private void checkTempDir() {
+ File tmpDir = new File(System.getProperty("java.io.tmpdir"));
+ if (!tmpDir.exists()) {
+ LOG.warn("Invalid java.io.tmpdir: [" + tmpDir.getAbsolutePath() + "] does not exist.");
+ useLocalTmpDir();
+ return;
+ }
+ if (!tmpDir.isDirectory()) {
+ LOG.warn("Invalid java.io.tmpdir: [" + tmpDir.getAbsolutePath() + "] is not a directory");
+ useLocalTmpDir();
+ return;
+ }
+ if (!tmpDir.canRead() || !tmpDir.canExecute()) {
+ LOG.warn("Invalid java.io.tmpdir: [" + tmpDir.getAbsolutePath() + "] is not readable");
+ useLocalTmpDir();
+ return;
+ }
+ if (!tmpDir.canWrite()) {
+ LOG.warn("Invalid java.io.tmpdir: [" + tmpDir.getAbsolutePath() + "] is not writable");
+ useLocalTmpDir();
+ return;
+ }
+ }
+
+ private void useLocalTmpDir() {
+ File localTmpDir = null;
+ try {
+ localTmpDir = new File(new File(getAgentHomeDirectory()), "temp");
+ LOG.info("Using alternate java.io.tmpdir: [" + localTmpDir.getAbsolutePath() + "]");
+ if (!localTmpDir.exists()) {
+ LOG.info("Creating alternate java.io.tmpdir: [" + localTmpDir.getAbsolutePath() + "]");
+ localTmpDir.mkdir();
+ }
+ System.setProperty("java.io.tmpdir", localTmpDir.getAbsolutePath());
+ } catch (Throwable t) {
+ throw new RuntimeException("Startup failed: Could not create or set local java.io.tmpdir ["
+ + localTmpDir.getAbsolutePath() + "]", t);
+ }
+ if (!localTmpDir.exists()) {
+ throw new RuntimeException("Startup failed: local java.io.tmpdir [" + localTmpDir.getAbsolutePath()
+ + "] does not exist");
+ }
+ if (!localTmpDir.isDirectory()) {
+ throw new RuntimeException("Startup failed: local java.io.tmpdir [" + localTmpDir.getAbsolutePath()
+ + "] is not a directory");
+ }
+ if (!localTmpDir.canRead() || !localTmpDir.canExecute()) {
+ throw new RuntimeException("Startup failed: local java.io.tmpdir [" + localTmpDir.getAbsolutePath()
+ + "] is not readable");
+ }
+ if (!localTmpDir.canWrite()) {
+ throw new RuntimeException("Startup failed: local java.io.tmpdir [" + localTmpDir.getAbsolutePath()
+ + "] is not writable");
+ }
+ }
+
/**
* Constructor for {@link AgentMain} that loads the agent configuration and prepare some additional internal data.
*
@@ -517,13 +573,15 @@ public class AgentMain {
prepareNativeSystem();
+ checkTempDir();
+
return;
}
/**
* Returns the directory that is considered the "agent home" (i.e. the directory
* where the agent is installed).
- *
+ *
* @return agent home directory, or empty string if it cannot be determined
*/
public String getAgentHomeDirectory() {
@@ -614,7 +672,7 @@ public class AgentMain {
/**
* This method should be called whenever the server time is known. This helps
* keep the {@link #getAgentServerClockDifference()} up-to-date.
- *
+ *
* @param serverTime the currently know value of the server clock (epoch millis)
*/
public void serverClockNotification(long serverTime) {
@@ -920,7 +978,7 @@ public class AgentMain {
/**
* This will enable/disable agent-server communication tracing. This is for
* use mainly in development but can also be used for troubleshooting problems.
- *
+ *
* @param enabled whether or not to turn on agent comm tracing
*/
public void agentServerCommunicationsTrace(boolean enabled) {
@@ -952,7 +1010,7 @@ public class AgentMain {
* This will hot-deploy a new log4j log configuration file. Use this to change, at runtime,
* the log settings so you can, for example, begin logging DEBUG messages to help troubleshoot
* problems.
- *
+ *
* @param logFilePath the path to the log file - relative to the classloader or filesystem
*
* @throws Exception if failed to hot deploy the new log config
@@ -985,7 +1043,7 @@ public class AgentMain {
/**
* Returns an iteratable list of servers that can be used as backups when this agent needs to failover
* to another server.
- *
+ *
* @return list of servers (may be empty but will not be <code>null</code>)
*/
public FailoverListComposite getServerFailoverList() {
@@ -1029,8 +1087,8 @@ public class AgentMain {
/**
* Downloads a new server failover list from the server and returns the failover list
* that is now in effect.
- * @return
- *
+ * @return
+ *
* @return the server failover list that is now in effect
*/
public FailoverListComposite downloadServerFailoverList() {
@@ -1568,7 +1626,7 @@ public class AgentMain {
* @param wait_ms maximum number of milliseconds to wait
*
* @return <code>true</code> if the server is up, <code>false</code> if it is not yet up or the agent has shutdown
- *
+ *
* @throws AgentNotSupportedException If the server is up but it told us we are the wrong version, then this is thrown.
* When this is thrown, the agent is currently in the midst of updating itself.
*/
@@ -1940,9 +1998,9 @@ public class AgentMain {
* port and transport parameters being used to talk to the current server
* will stay the same. Otherwise, it will be assumed the server is a
* full endpoint URL.
- *
+ *
* @param server the host of the server to switch to, or a full server endpoint URL
- *
+ *
* @return <code>true</code> if successfully switched, <code>false</code> otherwise
*/
public boolean switchToServer(String server) {
@@ -1996,9 +2054,9 @@ public class AgentMain {
/**
* Switches the agent to talk to the next server in the failover list.
- *
+ *
* This is package-scoped so the failover callback can call this.
- *
+ *
* @param comm the communicator object whose endpoint needs to be switched to the next server
* the caller must ensure the remote communicator provided to this method is the
* same communicator used by this agent's {@link #getClientCommandSender() sender}.
@@ -2036,12 +2094,12 @@ public class AgentMain {
/**
* Immediately switches the given communicator to the given server.
- *
+ *
* @param comm the communicator whose server is switched
* @param newServer the endpoint of the new server
* @param transport the transport that should be used in the new remote endpoint URL
* @param transportParams the transport params that should be used in the new remote endpoint URL
- *
+ *
* @return <code>true</code> if successfully switched; <code>false</code> otherwise
*/
private boolean switchCommServer(RemoteCommunicator comm, ServerEntry newServer, String transport,
@@ -2096,12 +2154,12 @@ public class AgentMain {
* is making the server its primary server and will begin sending it messages. The request
* is sent such that the communicator's initialize callback will never be invoked, however,
* the caller can ask for the request to attempt failover.
- *
+ *
* <p>This is package scoped so the initialize callback can call this</p>
- *
+ *
* @param comm the communicator used to send the message to the server
* @param attemptFailover if <code>true</code>, and the connect command fails, server failover will be attempted
- *
+ *
* @throws Throwable
*/
void sendConnectRequestToServer(RemoteCommunicator comm, boolean attemptFailover) throws Throwable {
@@ -2203,7 +2261,7 @@ public class AgentMain {
/**
* Returns the agent restart counter object.
- *
+ *
* @return the agent restart counter
*/
public AgentRestartCounter getAgentRestartCounter() {
@@ -2351,7 +2409,7 @@ public class AgentMain {
m_commServices.start(m_configuration.getPreferences(), m_configuration.getClientCommandSenderConfiguration());
// prime the sender so it can be prepared to start sending messages.
- // if auto-discovery is enabled, then the auto-discovery listener will tell the sender when its OK to start
+ // if auto-discovery is enabled, then the auto-discovery listener will tell the sender when its OK to start
// sending. Otherwise start polling and let the poller tell the sender when it is ok to start sending.
if (!isAutoDiscoveryEnabled()) {
LOG.info(AgentI18NResourceKeys.NO_AUTO_DETECT);
@@ -2402,7 +2460,7 @@ public class AgentMain {
/**
* This will prepare the auto-discovery listener, if server auto-detection is enabled.
- *
+ *
* @throws Exception
*/
private void prepareAutoDiscoveryListener() throws Exception {
@@ -2638,17 +2696,17 @@ public class AgentMain {
/**
* Creates a raw remote communicator that can talk to the given endpoint.
- *
+ *
* This is public-scoped so the {@link PrimaryServerSwitchoverThread} can use this
* and the {@link IdentifyPromptCommand} can use this.
- *
+ *
* @param transport
* @param address
* @param port
* @param transportParams
- *
+ *
* @return the remote communicator
- *
+ *
* @throws Exception if the communicator could not be created
*/
public RemoteCommunicator createServerRemoteCommunicator(String transport, String address, int port,
@@ -2741,7 +2799,7 @@ public class AgentMain {
* Given a failover list, this makes very rudimentary connection attempts to each server to see if
* this agent can at least reach the server endpoints. If an endpoint cannot be reached,
* a warning is logged.
- *
+ *
* @param failoverList the list of servers this agent will potentially need to talk to.
* @return the servers that failed to be connected to
*/
@@ -2804,7 +2862,7 @@ public class AgentMain {
* Given a failover list, this will persist it so the agent can recover it if the agent itself fails.
* If this method fails to persist the list, an error is logged but otherwise this method
* returns normally.
- *
+ *
* @param failoverList the failover list to persist (may be <code>null</code>)
*/
private void storeServerFailoverList(FailoverListComposite failoverList) {
@@ -3184,7 +3242,7 @@ public class AgentMain {
}
if (m_daemonMode) {
- AgentInputReaderFactory.setConsoleType(AgentInputReaderFactory.ConsoleType.java); // don't use native libs, no need and jline causes problems
+ AgentInputReaderFactory.setConsoleType(AgentInputReaderFactory.ConsoleType.java); // don't use native libs, no need and jline causes problems
} else if (console_type != null) {
AgentInputReaderFactory.setConsoleType(console_type);
}
@@ -3373,7 +3431,7 @@ public class AgentMain {
return args.toArray(new String[args.size()]);
}
- // perform any other massaging
+ // perform any other massaging
private String safeArg(String arg) {
// remove trailing '=' from long option args. For example --plugin= should just be --plugin for
// downstream processing.
@@ -3642,7 +3700,7 @@ public class AgentMain {
* </ol>
* By restarting the plugin container in such conditions, we essentially re-run the resource upgrade
* and let the plugin container try to re-merge with the server that we know has just connected.
- *
+ *
* @author Lukas Krejci
*/
private class PluginContainerConditionalRestartListener implements ClientCommandSenderStateListener {
@@ -3750,7 +3808,7 @@ public class AgentMain {
try {
// if we can't send to the server ignore the ping
if (!m_clientSender.isSending()) {
- // An unlikely state, but if we're not sending, not polling and not performing autoDiscovery
+ // An unlikely state, but if we're not sending, not polling and not performing autoDiscovery
// (multicast), then start polling to we eventually get out of this state.
if (!(m_clientSender.isServerPolling() || isAutoDiscoveryEnabled())) {
LOG.info(AgentI18NResourceKeys.PING_EXECUTOR_STARTING_POLLING);
@@ -3760,7 +3818,7 @@ public class AgentMain {
return;
}
- // we are in sending mode, so make sure the poller is off
+ // we are in sending mode, so make sure the poller is off
if (m_clientSender.isServerPolling()) {
LOG.info(AgentI18NResourceKeys.PING_EXECUTOR_STOPPING_POLLING_RESUME_PING);
m_clientSender.stopServerPolling();
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java
index d5878c6..941ae93 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/StartupBean.java
@@ -236,20 +236,56 @@ public class StartupBean implements StartupLocal {
private void checkTempDir() {
File tmpDir = new File(System.getProperty("java.io.tmpdir"));
if (!tmpDir.exists()) {
- throw new RuntimeException("Startup failed: java.io.tmpdir '" + tmpDir.getAbsolutePath()
- + "' does not exist");
+ log.warn("Invalid java.io.tmpdir: [" + tmpDir.getAbsolutePath() + "] does not exist.");
+ useLocalTmpDir();
+ return;
}
if (!tmpDir.isDirectory()) {
- throw new RuntimeException("Startup failed: java.io.tmpdir '" + tmpDir.getAbsolutePath()
- + "' is not a directory");
+ log.warn("Invalid java.io.tmpdir: [" + tmpDir.getAbsolutePath() + "] is not a directory");
+ useLocalTmpDir();
+ return;
}
if (!tmpDir.canRead() || !tmpDir.canExecute()) {
- throw new RuntimeException("Startup failed: java.io.tmpdir '" + tmpDir.getAbsolutePath()
- + "' is not readable");
+ log.warn("Invalid java.io.tmpdir: [" + tmpDir.getAbsolutePath() + "] is not readable");
+ useLocalTmpDir();
+ return;
}
if (!tmpDir.canWrite()) {
- throw new RuntimeException("Startup failed: java.io.tmpdir '" + tmpDir.getAbsolutePath()
- + "' is not writable");
+ log.warn("Invalid java.io.tmpdir: [" + tmpDir.getAbsolutePath() + "] is not writable");
+ useLocalTmpDir();
+ return;
+ }
+ }
+
+ private void useLocalTmpDir() {
+ File localTmpDir = null;
+ try {
+ localTmpDir = new File(LookupUtil.getCoreServer().getInstallDir(), "temp");
+ log.info("Using alternate java.io.tmpdir: [" + localTmpDir.getAbsolutePath() + "]");
+ if (!localTmpDir.exists()) {
+ log.info("Creating alternate java.io.tmpdir: [" + localTmpDir.getAbsolutePath() + "]");
+ localTmpDir.mkdir();
+ }
+ System.setProperty("java.io.tmpdir", localTmpDir.getAbsolutePath());
+ } catch (Throwable t) {
+ throw new RuntimeException("Startup failed: Could not create or set local java.io.tmpdir ["
+ + localTmpDir.getAbsolutePath() + "]", t);
+ }
+ if (!localTmpDir.exists()) {
+ throw new RuntimeException("Startup failed: local java.io.tmpdir [" + localTmpDir.getAbsolutePath()
+ + "] does not exist");
+ }
+ if (!localTmpDir.isDirectory()) {
+ throw new RuntimeException("Startup failed: local java.io.tmpdir [" + localTmpDir.getAbsolutePath()
+ + "] is not a directory");
+ }
+ if (!localTmpDir.canRead() || !localTmpDir.canExecute()) {
+ throw new RuntimeException("Startup failed: local java.io.tmpdir [" + localTmpDir.getAbsolutePath()
+ + "] is not readable");
+ }
+ if (!localTmpDir.canWrite()) {
+ throw new RuntimeException("Startup failed: local java.io.tmpdir [" + localTmpDir.getAbsolutePath()
+ + "] is not writable");
}
}
@@ -546,19 +582,19 @@ public class StartupBean implements StartupLocal {
}
}
- /**
- * This seeds the agent clients cache with clients for all known agents. These clients will be started so they can
- * immediately begin to send any persisted guaranteed messages that might already exist. This method must be called
- * at a time when the server is ready to accept messages from agents because any guaranteed messages that are
- * delivered might trigger the agents to send messages back to the server.
- *
- * NOTE: we don't need to do this - so far, none of the messages the server sends to the agent are marked
- * with "guaranteed delivery" (this is on purpose and a good thing) so we don't need to start all the agent clients
- * in case they have persisted messages. Since the number of agents could be large this cache could be huge and
- * take some time to initialize. If we don't call this, it speeds up start up, and doesn't bloat memory with
- * clients we might not ever need (since agents might have affinity to other servers). Agent clients
- * can be created lazily at runtime when the server needs it.
- */
+ /**
+ * This seeds the agent clients cache with clients for all known agents. These clients will be started so they can
+ * immediately begin to send any persisted guaranteed messages that might already exist. This method must be called
+ * at a time when the server is ready to accept messages from agents because any guaranteed messages that are
+ * delivered might trigger the agents to send messages back to the server.
+ *
+ * NOTE: we don't need to do this - so far, none of the messages the server sends to the agent are marked
+ * with "guaranteed delivery" (this is on purpose and a good thing) so we don't need to start all the agent clients
+ * in case they have persisted messages. Since the number of agents could be large this cache could be huge and
+ * take some time to initialize. If we don't call this, it speeds up start up, and doesn't bloat memory with
+ * clients we might not ever need (since agents might have affinity to other servers). Agent clients
+ * can be created lazily at runtime when the server needs it.
+ */
private void startAgentClients() {
log.info("Starting agent clients - any persisted messages with guaranteed delivery will be sent...");
@@ -598,7 +634,7 @@ public class StartupBean implements StartupLocal {
final long initialDelay = 1000L * 60;
final long interval = 1000L * 60;
schedulerBean.scheduleSimpleRepeatingJob(SavedSearchResultCountRecalculationJob.class, true, false,
- initialDelay, interval);
+ initialDelay, interval);
} catch (Exception e) {
log.error("Cannot schedule asynchronous resource deletion job.", e);
}
@@ -636,7 +672,7 @@ public class StartupBean implements StartupLocal {
final long initialDelay = 1000L * 60;
final long interval = 1000L * 60;
schedulerBean.scheduleSimpleRepeatingJob(DynaGroupAutoRecalculationJob.class, true, false, initialDelay,
- interval);
+ interval);
} catch (Exception e) {
log.error("Cannot schedule DynaGroup auto-recalculation job.", e);
}
@@ -738,9 +774,9 @@ public class StartupBean implements StartupLocal {
log.error("Cannot create storage cluster init job", e);
}
}
-
+
try {
- String cronString = "0 30 0 ? * SUN *"; // every sunday starting at 00:30.
+ String cronString = "0 30 0 ? * SUN *"; // every sunday starting at 00:30.
schedulerBean.scheduleSimpleCronJob(StorageClusterReadRepairJob.class, true, true, cronString);
} catch (Exception e) {
log.error("Cannot create storage cluster read repair job", e);
@@ -754,6 +790,7 @@ public class StartupBean implements StartupLocal {
*
* @deprecated we don't have an embedded agent anymore, leaving this in case we resurrect it
*/
+ @Deprecated
private void startEmbeddedAgent() throws RuntimeException {
// we can't use EmbeddedAgentBootstrapServiceMBean because if the embedded agent
// isn't installed, that class will not be available; we must use JMX API
10 years, 6 months