[rhq] modules/enterprise
by mazz
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java | 59 +++++-----
1 file changed, 31 insertions(+), 28 deletions(-)
New commits:
commit 7e32d8c275919efa6ae969153574e37ab6d8df53
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Nov 5 16:47:08 2013 -0500
BZ 1003679 / BZ 1015658 - only schedule the bundle check job once per deployment ID, regardless of how many resources are involved
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
index 7aba9d1..2171a0e 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
@@ -768,7 +768,7 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
} catch (PermissionException e) {
if (null != e.getCause() && e.getCause() instanceof BundleNotFoundException) {
deleteFile = false;
- // This application exception indicates the special token handling workflow
+ // This application exception indicates the special token handling workflow
throw new BundleNotFoundException("[" + file.getName() + "]");
} else {
throw e;
@@ -1338,6 +1338,18 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
}
}
+ // schedule the bundle deployment completion check. Due to timing issues, we cannot determine
+ // the overall completion status of the bundle deployment while receiving the individual resource
+ // deployment statuses. This needs to be done out of band by a quartz job.
+ // See https://bugzilla.redhat.com/show_bug.cgi?id=1003679 for details.
+ try {
+ JobDetail jobDetail = BundleDeploymentStatusCheckJob.getJobDetail(bundleDeploymentId);
+ Trigger trigger = QuartzUtil.getRepeatingTrigger(jobDetail, 0, 10000);
+ quartzScheduler.scheduleJob(jobDetail, trigger);
+ } catch (Exception e) {
+ log.error("Failed to schedule bundle deployment status check job for deployment:" + newDeployment, e);
+ }
+
// make sure the new deployment is set as the live deployment and properly replaces the
// previously live deployment.
destination = entityManager.find(BundleDestination.class, destination.getId());
@@ -1401,16 +1413,7 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
BundleScheduleResponse response = bundleAgentService.schedule(request);
- if (response.isSuccess()) {
- // schedule the bundle deployment completion check. Due to timing issues, we cannot determine
- // the overall completion status of the bundle deployment while receiving the individual resource
- // deployment statuses. This needs to be done out of band by a quartz job.
- // See https://bugzilla.redhat.com/show_bug.cgi?id=1003679 for details.
- JobDetail jobDetail = BundleDeploymentStatusCheckJob.getJobDetail(deployment.getId());
- Trigger trigger = QuartzUtil.getRepeatingTrigger(jobDetail, 0, 10000);
-
- quartzScheduler.scheduleJob(jobDetail, trigger);
- } else {
+ if (!response.isSuccess()) {
// Handle Schedule Failures. This may include deployment failures for immediate deployment request
bundleManager.setBundleResourceDeploymentStatus(subject, resourceDeployment.getId(),
BundleDeploymentStatus.FAILURE);
@@ -1513,7 +1516,7 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
if (null == deployment) {
throw new IllegalArgumentException("Invalid bundleDeploymentId: " + bundleDeploymentId);
}
- Resource resource = (Resource) entityManager.find(Resource.class, resourceId);
+ Resource resource = entityManager.find(Resource.class, resourceId);
if (null == resource) {
throw new IllegalArgumentException("Invalid resourceId (Resource does not exist): " + resourceId);
}
@@ -1770,7 +1773,7 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
PageList<BundleVersion> result = queryRunner.execute();
// If asking for optional data that the subject may not be able to see then ensure that the optional
- // data is filtered appropriately. In this case only deployments to destinations viewable by the subject
+ // data is filtered appropriately. In this case only deployments to destinations viewable by the subject
// can be returned. The result currently holds bundle versions viewable by the caller, but the bundle version
// may have been deployed to destinations for which the user does not have access to the destination's
// resource group. (BZ 694741)
@@ -1793,7 +1796,7 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
// get the viewable destinations and use to filter the deployments
List<BundleDestination> destinations = findBundleDestinationsByCriteria(subject, destinationCriteria);
List<BundleDeployment> filteredDeployments = new ArrayList<BundleDeployment>(numDeployments);
- entityManager.detach(bundleVersion); // make sure we don't persist the filtered data
+ entityManager.detach(bundleVersion); // make sure we don't persist the filtered data
for (BundleDeployment deployment : bundleVersion.getBundleDeployments()) {
if (containsDestination(destinations, deployment.getDestination()))
filteredDeployments.add(deployment);
@@ -1844,7 +1847,7 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
PageList<Bundle> result = queryRunner.execute();
// If asking for optional data that the subject may not be able to see then ensure that the optional
- // data is filtered appropriately. In this case only destinations viewable by the subject can be returned.
+ // data is filtered appropriately. In this case only destinations viewable by the subject can be returned.
// The result currently holds bundles viewable by the caller, but the bundle may have been deployed to
// destinations for which the user does not have access to the destination's resource group. (BZ 694741)
if (!result.isEmpty() && criteria.isInventoryManagerRequired()
@@ -1856,7 +1859,7 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
continue;
}
BundleDestinationCriteria destinationCriteria = new BundleDestinationCriteria();
- destinationCriteria.clearPaging(); //disable paging as the code assumes all the results will be returned.
+ destinationCriteria.clearPaging(); //disable paging as the code assumes all the results will be returned.
destinationCriteria.addFilterBundleId(bundle.getId());
List<BundleDestination> destinations = findBundleDestinationsByCriteria(subject, destinationCriteria);
entityManager.detach(bundle); // make sure the narrowed set of destinations does not get persisted
@@ -1924,7 +1927,7 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
}
// remove bundle from any assigned bundle groups
- // wrap in new HashSet to avoid ConcurrentModificationExceptions.
+ // wrap in new HashSet to avoid ConcurrentModificationExceptions.
Set<BundleGroup> BundleGroupsToRemove = new HashSet<BundleGroup>(bundle.getBundleGroups());
for (BundleGroup bg : BundleGroupsToRemove) {
bg.removeBundle(bundle);
@@ -2119,7 +2122,7 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
}
// unassign any bundles assigned to the bundle group
- // wrap in new HashSet to avoid ConcurrentModificationExceptions.
+ // wrap in new HashSet to avoid ConcurrentModificationExceptions.
Set<Bundle> bundlesToRemove = new HashSet<Bundle>(bundleGroup.getBundles());
for (Bundle b : bundlesToRemove) {
bundleGroup.removeBundle(b);
@@ -2184,7 +2187,7 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
* - Global.CREATE_BUNDLES and Global.VIEW_BUNDLES
* - Global.CREATE_BUNDLES and BundleGroup.VIEW_BUNDLES_IN_GROUP for bundle group BG
* - BundleGroup.CREATE_BUNDLES_IN_GROUP for bundle group BG
- * </pre>
+ * </pre>
* @param subject
* @param bundleGroupIds null or 0 length for unassigned initial bundle version creation
* @throws PermissionException
@@ -2231,7 +2234,7 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
* - Global.CREATE_BUNDLES and Global.VIEW_BUNDLES
* - Global.CREATE_BUNDLES and BundleGroup.VIEW_BUNDLES_IN_GROUP for bundle group BG and the relevant bundle is assigned to BG
* - BundleGroup.CREATE_BUNDLES_IN_GROUP for bundle group BG and the relevant bundle is assigned to BG
- * </pre>
+ * </pre>
* @param subject
* @param bundleId required, bundleId of bundle in which bundle version is being created/updated
* @throws PermissionException
@@ -2326,12 +2329,12 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
/**
* <pre>
* Requires VIEW permission for the relevant bundles and one of:
- * - Global.MANAGE_BUNDLE_GROUPS
+ * - Global.MANAGE_BUNDLE_GROUPS
* - Global.DELETE_BUNDLE
* - BundleGroup.UNASSIGN_BUNDLES_FROM_GROUP for the relevant bundle group
* - BundleGroup.DELETE_BUNDLES_FROM_GROUP for the relevant bundle group
* </pre>
- *
+ *
* @param subject
* @param bundleGroupId an existing bundle group
* @param bundleIds existing bundles
@@ -2385,7 +2388,7 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
* Required Permissions: Either:
* - Global.DEPLOY_BUNDLES and a view of the relevant bundle and a view of the relevant resource group (may involve multiple roles)
* - Resource.DEPLOY_BUNDLES_TO_GROUP and a view of the relevant bundle and a view of the relevant resource group (may involve multiple roles)
- * </pre>
+ * </pre>
*/
private void checkDeployBundleAuthz(Subject subject, int bundleId, int resourceGroupId) throws PermissionException {
@@ -2424,8 +2427,8 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
* Required Permissions: Either:
* - Global.DELETE_BUNDLES and Global.VIEW_BUNDLES
* - Global.DELETE_BUNDLES and BundleGroup.VIEW_BUNDLES_IN_GROUP for bundle group BG and the relevant bundle is assigned to BG
- * - BundleGroup.DELETE_BUNDLES_FROM_GROUP for bundle group BG and the relevant bundle is assigned to BG
- * </pre>
+ * - BundleGroup.DELETE_BUNDLES_FROM_GROUP for bundle group BG and the relevant bundle is assigned to BG
+ * </pre>
* @param subject
* @param bundleId required, bundleId of bundle, or the bundle version, being deleted
* @throws PermissionException
@@ -2547,7 +2550,7 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
if (isNewBundle) {
// set whether can leave unassigned
result.setCanBeUnassigned(hasCreateBundles && hasViewBundles);
- // can assign to bundle groups for which he has create_bundles_in_group
+ // can assign to bundle groups for which he has create_bundles_in_group
permFilter.add(Permission.CREATE_BUNDLES_IN_GROUP);
} else {
@@ -2557,7 +2560,7 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
+ assigningSubject.getName() + "]");
}
- // can assign to bundle groups for which he has create_bundles_in_group or assign_bundles_to_group
+ // can assign to bundle groups for which he has create_bundles_in_group or assign_bundles_to_group
permFilter.add(Permission.CREATE_BUNDLES_IN_GROUP);
permFilter.add(Permission.ASSIGN_BUNDLES_TO_GROUP);
}
@@ -2565,7 +2568,7 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
List<BundleGroup> bundleGroups;
if (hasCreateBundles) {
// can assign to any viewable bundle group
- // get all the viewable bundle groups for the subject, no filters
+ // get all the viewable bundle groups for the subject, no filters
BundleGroupCriteria criteria = new BundleGroupCriteria();
bundleGroups = findBundleGroupsByCriteria(assigningSubject, criteria);
10 years, 7 months
[rhq] modules/common
by John Sanda
modules/common/cassandra-installer/src/main/java/org/rhq/storage/installer/StorageInstaller.java | 31 +++++-----
modules/common/cassandra-installer/src/test/java/org/rhq/storage/installer/StorageInstallerTest.java | 2
2 files changed, 16 insertions(+), 17 deletions(-)
New commits:
commit 85aa4b3173f3c15d3621ca32ad46ed7e692a625a
Author: John Sanda <jsanda(a)redhat.com>
Date: Tue Nov 5 15:21:08 2013 -0500
[BZ 1018213] use relative paths for data directories when defaults are used
diff --git a/modules/common/cassandra-installer/src/main/java/org/rhq/storage/installer/StorageInstaller.java b/modules/common/cassandra-installer/src/main/java/org/rhq/storage/installer/StorageInstaller.java
index e59070c..83734ee 100644
--- a/modules/common/cassandra-installer/src/main/java/org/rhq/storage/installer/StorageInstaller.java
+++ b/modules/common/cassandra-installer/src/main/java/org/rhq/storage/installer/StorageInstaller.java
@@ -110,6 +110,12 @@ public class StorageInstaller {
static final String STORAGE_LOG_FILE_PATH = "../../logs/rhq-storage.log";
+ static final String DEFAULT_COMMIT_LOG_DIR = "../../../rhq-data/commit_log";
+
+ static final String DEFAULT_DATA_DIR = "../../../rhq-data/data";
+
+ static final String DEFAULT_SAVED_CACHES_DIR = "../../../rhq-data/saved_caches";
+
private final Log log = LogFactory.getLog(StorageInstaller.class);
private Options options;
@@ -126,8 +132,6 @@ public class StorageInstaller {
private int defaultGossipPort = 7100;
- private File logDir;
-
private String defaultHeapSize = "512M";
private String defaultHeapNewSize = "128M";
@@ -136,7 +140,6 @@ public class StorageInstaller {
String basedir = System.getProperty("rhq.server.basedir");
serverBasedir = new File(basedir);
storageBasedir = new File(basedir, STORAGE_BASEDIR);
- logDir = new File(serverBasedir, "logs");
Option hostname = new Option("n", StorageProperty.HOSTNAME.property(), true,
"The hostname or IP address on which the node will listen for "
@@ -357,12 +360,10 @@ public class StorageInstaller {
String seeds = cmdLine.getOptionValue(StorageProperty.SEEDS.property(), installerInfo.hostname);
deploymentOptions.setSeeds(seeds);
- String commitlogDir = cmdLine.getOptionValue(StorageProperty.COMMITLOG.property(), getDefaultCommitLogDir()
- .getAbsolutePath());
- String dataDir = cmdLine.getOptionValue(StorageProperty.DATA.property(), getDefaultDataDir()
- .getAbsolutePath());
+ String commitlogDir = cmdLine.getOptionValue(StorageProperty.COMMITLOG.property(), getDefaultCommitLogDir());
+ String dataDir = cmdLine.getOptionValue(StorageProperty.DATA.property(), getDefaultDataDir());
String savedCachesDir = cmdLine.getOptionValue(StorageProperty.SAVED_CACHES.property(),
- getDefaultSavedCachesDir().getAbsolutePath());
+ getDefaultSavedCachesDir());
File commitLogDirFile = new File(commitlogDir);
File dataDirFile = new File(dataDir);
@@ -414,7 +415,7 @@ public class StorageInstaller {
deploymentOptions.setCommitLogDir(commitlogDir);
// TODO add support for specifying multiple dirs
- deploymentOptions.setDataDir(dataDirFile.getAbsolutePath());
+ deploymentOptions.setDataDir(dataDirFile.getPath());
deploymentOptions.setSavedCachesDir(savedCachesDir);
deploymentOptions.setLogFileName(installerInfo.logFile);
@@ -929,16 +930,16 @@ public class StorageInstaller {
return new File(getInstallationDir(), "rhq-data");
}
- private File getDefaultCommitLogDir() {
- return new File(getDefaultBaseDataDir(), "commit_log");
+ private String getDefaultCommitLogDir() {
+ return DEFAULT_COMMIT_LOG_DIR;
}
- private File getDefaultDataDir() {
- return new File(getDefaultBaseDataDir(), "data");
+ private String getDefaultDataDir() {
+ return DEFAULT_DATA_DIR;
}
- private File getDefaultSavedCachesDir() {
- return new File(getDefaultBaseDataDir(), "saved_caches");
+ private String getDefaultSavedCachesDir() {
+ return DEFAULT_SAVED_CACHES_DIR;
}
public void printUsage() {
diff --git a/modules/common/cassandra-installer/src/test/java/org/rhq/storage/installer/StorageInstallerTest.java b/modules/common/cassandra-installer/src/test/java/org/rhq/storage/installer/StorageInstallerTest.java
index 184f3de..ff975d1 100644
--- a/modules/common/cassandra-installer/src/test/java/org/rhq/storage/installer/StorageInstallerTest.java
+++ b/modules/common/cassandra-installer/src/test/java/org/rhq/storage/installer/StorageInstallerTest.java
@@ -51,7 +51,6 @@ public class StorageInstallerTest {
@BeforeMethod
public void initDirs(Method test) throws Exception {
- System.out.println("BEGIN " + test);
digestGenerator = new MessageDigestGenerator(MessageDigestGenerator.SHA_256);
File dir = new File(getClass().getResource(".").toURI());
@@ -74,7 +73,6 @@ public class StorageInstallerTest {
@AfterMethod(alwaysRun = true)
public void shutdownStorageNode() throws Exception {
- System.out.println("END");
if (FileUtils.getFile(storageDir, "bin", "cassandra.pid").exists()) {
CassandraClusterManager ccm = new CassandraClusterManager();
ccm.killNode(storageDir);
10 years, 7 months
[rhq] modules/common
by John Sanda
modules/common/cassandra-installer/src/main/java/org/rhq/storage/installer/StorageInstaller.java | 11 +++++-----
modules/common/cassandra-installer/src/test/java/org/rhq/storage/installer/StorageInstallerTest.java | 6 ++---
2 files changed, 9 insertions(+), 8 deletions(-)
New commits:
commit 7e6521f1974be48e97aca499e6ba34c5fb59bc1f
Author: John Sanda <jsanda(a)redhat.com>
Date: Tue Nov 5 13:11:13 2013 -0500
[BZ 1018213] use relative paths for log4j file location in appender
diff --git a/modules/common/cassandra-installer/src/main/java/org/rhq/storage/installer/StorageInstaller.java b/modules/common/cassandra-installer/src/main/java/org/rhq/storage/installer/StorageInstaller.java
index c2e282b..e59070c 100644
--- a/modules/common/cassandra-installer/src/main/java/org/rhq/storage/installer/StorageInstaller.java
+++ b/modules/common/cassandra-installer/src/main/java/org/rhq/storage/installer/StorageInstaller.java
@@ -108,6 +108,8 @@ public class StorageInstaller {
private final String STORAGE_BASEDIR = "rhq-storage";
+ static final String STORAGE_LOG_FILE_PATH = "../../logs/rhq-storage.log";
+
private final Log log = LogFactory.getLog(StorageInstaller.class);
private Options options;
@@ -365,7 +367,7 @@ public class StorageInstaller {
File commitLogDirFile = new File(commitlogDir);
File dataDirFile = new File(dataDir);
File savedCachesDirFile = new File(savedCachesDir);
- installerInfo.logFile = new File(logDir, "rhq-storage.log");
+
boolean verifyDataDirsEmpty = Boolean.valueOf(cmdLine.getOptionValue(
StorageProperty.VERIFY_DATA_DIRS_EMPTY.property(), "true"));
@@ -415,7 +417,7 @@ public class StorageInstaller {
deploymentOptions.setDataDir(dataDirFile.getAbsolutePath());
deploymentOptions.setSavedCachesDir(savedCachesDir);
- deploymentOptions.setLogFileName(installerInfo.logFile.getPath());
+ deploymentOptions.setLogFileName(installerInfo.logFile);
deploymentOptions.setLoggingLevel("INFO");
deploymentOptions.setRpcPort(rpcPort);
@@ -518,7 +520,6 @@ public class StorageInstaller {
File cassandraJvmPropsFile = new File(newConfDir, "cassandra-jvm.properties");
installerInfo.basedir = storageBasedir;
- installerInfo.logFile = new File(logDir, "rhq-storage.log");
boolean isRHQ48Install;
if (cassandraEnvFile.exists()) {
@@ -530,7 +531,7 @@ public class StorageInstaller {
}
deploymentOptions.setBasedir(storageBasedir.getAbsolutePath());
- deploymentOptions.setLogFileName(installerInfo.logFile.getPath());
+ deploymentOptions.setLogFileName(installerInfo.logFile);
deploymentOptions.setLoggingLevel("INFO");
deploymentOptions.setJmxPort(installerInfo.jmxPort);
deploymentOptions.setHeapSize(defaultHeapSize);
@@ -965,7 +966,7 @@ public class StorageInstaller {
private static class InstallerInfo {
File basedir;
- File logFile;
+ String logFile = STORAGE_LOG_FILE_PATH;
int jmxPort;
int cqlPort;
int gossipPort;
diff --git a/modules/common/cassandra-installer/src/test/java/org/rhq/storage/installer/StorageInstallerTest.java b/modules/common/cassandra-installer/src/test/java/org/rhq/storage/installer/StorageInstallerTest.java
index fab1a9f..184f3de 100644
--- a/modules/common/cassandra-installer/src/test/java/org/rhq/storage/installer/StorageInstallerTest.java
+++ b/modules/common/cassandra-installer/src/test/java/org/rhq/storage/installer/StorageInstallerTest.java
@@ -123,7 +123,7 @@ public class StorageInstallerTest {
Properties log4jProps = new Properties();
log4jProps.load(new FileInputStream(log4jFile));
- assertEquals(log4jProps.getProperty("log4j.appender.R.File"), logFile.getAbsolutePath(),
+ assertEquals(log4jProps.getProperty("log4j.appender.R.File"), StorageInstaller.STORAGE_LOG_FILE_PATH,
"The log file is wrong");
File yamlFile = new File(confDir, "cassandra.yaml");
@@ -193,7 +193,7 @@ public class StorageInstallerTest {
Properties log4jProps = new Properties();
log4jProps.load(new FileInputStream(log4jFile));
- assertEquals(log4jProps.getProperty("log4j.appender.R.File"), logFile.getAbsolutePath(),
+ assertEquals(log4jProps.getProperty("log4j.appender.R.File"), StorageInstaller.STORAGE_LOG_FILE_PATH,
"The log file is wrong");
File yamlFile = new File(confDir, "cassandra.yaml");
@@ -367,7 +367,7 @@ public class StorageInstallerTest {
Properties log4jProps = new Properties();
log4jProps.load(new FileInputStream(newLog4JFile));
- assertEquals(log4jProps.getProperty("log4j.appender.R.File"), logFile.getAbsolutePath(),
+ assertEquals(log4jProps.getProperty("log4j.appender.R.File"), StorageInstaller.STORAGE_LOG_FILE_PATH,
"The log file is wrong");
assertFalse(new File(confDir, "cassandra-env.sh").exists(),
10 years, 7 months
[rhq] modules/enterprise
by mike thompson
modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/inventory/common/graph/graphtype/StackedBarMetricGraphImpl.java | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
New commits:
commit e30123d58abd71180d023e1d5d4498efc65808a2
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Mon Nov 4 19:50:11 2013 -0800
[BZ 1026607] Increase timeout on metric chart hovers from 5 seconds to 15 seconds for better readability.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/inventory/common/graph/graphtype/StackedBarMetricGraphImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/inventory/common/graph/graphtype/StackedBarMetricGraphImpl.java
index f7dd415..e51fc19 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/inventory/common/graph/graphtype/StackedBarMetricGraphImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/inventory/common/graph/graphtype/StackedBarMetricGraphImpl.java
@@ -86,6 +86,7 @@ public class StackedBarMetricGraphImpl extends AbstractMetricGraph {
height = adjustedChartHeight - margin.top - margin.bottom,
smallChartThresholdInPixels = 600,
titleHeight = 30, titleSpace = 10,
+ tooltipTimeout = 15000,
barOffset = 2,
chartData,
interpolation = "basis",
@@ -358,7 +359,7 @@ public class StackedBarMetricGraphImpl extends AbstractMetricGraph {
//Show the tooltip
$wnd.jQuery('#metricGraphTooltip').show();
- setTimeout(function(){$wnd.jQuery('#metricGraphTooltip').hide();},5000);
+ setTimeout(function(){$wnd.jQuery('#metricGraphTooltip').hide();},tooltipTimeout);
}
function showNoDataBarHover(d){
@@ -385,7 +386,7 @@ public class StackedBarMetricGraphImpl extends AbstractMetricGraph {
//Show the tooltip
$wnd.jQuery('#noDataTooltip').show();
- setTimeout(function(){$wnd.jQuery('#noDataTooltip').hide();},5000);
+ setTimeout(function(){$wnd.jQuery('#noDataTooltip').hide();},tooltipTimeout);
}
@@ -551,7 +552,7 @@ public class StackedBarMetricGraphImpl extends AbstractMetricGraph {
//Show the tooltip
$wnd.jQuery('#singleValueTooltip').show();
- setTimeout(function(){$wnd.jQuery('#singleValueTooltip').hide();},5000);
+ setTimeout(function(){$wnd.jQuery('#singleValueTooltip').hide();},tooltipTimeout);
}
10 years, 7 months
[rhq] Branch 'hotfix/jon3.1.2' - modules/enterprise
by Larry O'Leary
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertTemplateManagerBean.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
New commits:
commit 9224f4642fbcd096a4bbbc38003c3fe61acc8ebd
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Nov 1 17:08:46 2013 -0400
[1019519] Recovery alert definition from alert definition template is lost on resources if alert to recover template is modified
Ensure that the to-be-recovered alert def is applied to the resource before
the recovery alert def.
Cherry-Pick Master: 1255061fbdb257f2a7a79f407e498411ce904edc
(cherry picked from commit c880660f26ccd52cc54fdd77dde4f2df5c670d54)
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertTemplateManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertTemplateManagerBean.java
index 94f1d35..11a3834 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertTemplateManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/alert/AlertTemplateManagerBean.java
@@ -177,7 +177,8 @@ public class AlertTemplateManagerBean implements AlertTemplateManagerLocal {
+ " AND template.id NOT IN ( SELECT ad.id " //
+ " FROM AlertDefinition ad " //
+ " WHERE ad.resource.id = :resourceId " //
- + " AND ad.deleted = false ) ");
+ + " AND ad.deleted = false ) " //
+ + " ORDER BY template.recoveryId ASC "); // process recovered defs first, so recovery defs can reference them
query.setParameter("resourceId", resourceId);
List<AlertDefinition> unappliedTemplates = query.getResultList();
10 years, 7 months
[rhq] modules/enterprise
by mike thompson
modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/ImageManager.java | 8 ++++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/bundle/deploy/DeployStep.java | 8 ++++----
modules/enterprise/gui/coregui/src/main/webapp/images/status_complete.gif |binary
modules/enterprise/gui/coregui/src/main/webapp/images/status_error.gif |binary
4 files changed, 12 insertions(+), 4 deletions(-)
New commits:
commit a4f74a96b78950e00e316f539cb64f522c7b4e75
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Mon Nov 4 13:15:05 2013 -0800
[BZ 1026456] - deployment complete icon is missing after deploying bundle. The complete and error icons were being pulled from the portal.war. The portal.war url changes have broken the image path. Rather than change the image path to the portal.war image path, I have added the images to the coregui images because they are being used by coregui and not portal.war. In the near future all of the portal.war stuff will go away.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/ImageManager.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/ImageManager.java
index 0bfd2a4..5d4d049 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/ImageManager.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/ImageManager.java
@@ -49,6 +49,14 @@ public class ImageManager {
return "ajax-loader.gif";
}
+ public static String getStatusComplete() {
+ return "status_complete.gif";
+ }
+
+ public static String getStatusError() {
+ return "status_error.gif";
+ }
+
/**
* Returns a generic "upload" icon.
*/
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/bundle/deploy/DeployStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/bundle/deploy/DeployStep.java
index 98fd3b3..b7ac6de 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/bundle/deploy/DeployStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/coregui/client/bundle/deploy/DeployStep.java
@@ -78,7 +78,7 @@ public class DeployStep extends AbstractWizardStep {
wizard.getNewDeploymentDescription(), wizard.getNewDeploymentConfig(), false, -1, false, //
new AsyncCallback<BundleDeployment>() {
public void onSuccess(BundleDeployment result) {
- deployingImage.setSrc("/images/status_complete.gif");
+ deployingImage.setSrc(ImageManager.getStatusComplete());
deployingMessage.setText(MSG.view_bundle_deployWizard_deploymentCreated());
CoreGUI.getMessageCenter().notify(
new Message(MSG.view_bundle_deployWizard_deploymentCreatedDetail_concise(result.getName()),
@@ -90,7 +90,7 @@ public class DeployStep extends AbstractWizardStep {
wizard.isCleanDeployment(), //
new AsyncCallback<BundleDeployment>() {
public void onSuccess(BundleDeployment result) {
- deployingImage.setSrc("/images/status_complete.gif");
+ deployingImage.setSrc(ImageManager.getStatusComplete());
deployingMessage.setText(MSG.view_bundle_deployWizard_deploymentScheduled());
CoreGUI.getMessageCenter().notify(
new Message(MSG.view_bundle_deployWizard_deploymentScheduledDetail_concise(),
@@ -102,7 +102,7 @@ public class DeployStep extends AbstractWizardStep {
}
public void onFailure(Throwable caught) {
- deployingImage.setSrc("/images/status_error.gif");
+ deployingImage.setSrc(ImageManager.getStatusError());
deployingMessage.setText(MSG.view_bundle_deployWizard_error_3());
String errMsg = MSG.view_bundle_deployWizard_error_4(ErrorHandler
.getAllMessages(caught));
@@ -115,7 +115,7 @@ public class DeployStep extends AbstractWizardStep {
}
public void onFailure(Throwable caught) {
- deployingImage.setSrc("/images/status_error.gif");
+ deployingImage.setSrc(ImageManager.getStatusError());
deployingMessage.setText(MSG.view_bundle_deployWizard_error_5());
String errMsg = MSG.view_bundle_deployWizard_error_6(ErrorHandler.getAllMessages(caught));
wizard.getView().showMessage(errMsg);
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/status_complete.gif b/modules/enterprise/gui/coregui/src/main/webapp/images/status_complete.gif
new file mode 100644
index 0000000..4c29ead
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/status_complete.gif differ
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/images/status_error.gif b/modules/enterprise/gui/coregui/src/main/webapp/images/status_error.gif
new file mode 100644
index 0000000..680b87f
Binary files /dev/null and b/modules/enterprise/gui/coregui/src/main/webapp/images/status_error.gif differ
10 years, 7 months
[rhq] Branch 'hotfix/jon3.1.2' - 2 commits - modules/plugins
by Larry O'Leary
modules/plugins/pattern-generator/src/main/java/org/rhq/plugins/pattern/PatternComponent.java | 138 +++++++---
modules/plugins/pattern-generator/src/main/resources/META-INF/rhq-plugin.xml | 35 ++
2 files changed, 137 insertions(+), 36 deletions(-)
New commits:
commit 800ca294f2e9b4c36ac58879609fd76fa731bfd0
Author: Larry O'Leary <loleary(a)redhat.com>
Date: Fri Nov 1 18:01:27 2013 -0500
Added Pattern 3 Metric and numberList plug-in configuration to support a predetermined list of numeric metric values.
(cherry picked from commit 72b6a4e469bbf3c8d70ec5d8362003e0fa8e4530)
diff --git a/modules/plugins/pattern-generator/src/main/java/org/rhq/plugins/pattern/PatternComponent.java b/modules/plugins/pattern-generator/src/main/java/org/rhq/plugins/pattern/PatternComponent.java
index 18c6036..81ade52 100644
--- a/modules/plugins/pattern-generator/src/main/java/org/rhq/plugins/pattern/PatternComponent.java
+++ b/modules/plugins/pattern-generator/src/main/java/org/rhq/plugins/pattern/PatternComponent.java
@@ -1,17 +1,38 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2011-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.plugins.pattern;
+import java.util.ArrayList;
+import java.util.List;
import java.util.Set;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-
import org.rhq.core.domain.configuration.Configuration;
-import org.rhq.core.domain.measurement.MeasurementDataTrait;
-import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
+import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.measurement.AvailabilityType;
import org.rhq.core.domain.measurement.MeasurementDataNumeric;
+import org.rhq.core.domain.measurement.MeasurementDataTrait;
import org.rhq.core.domain.measurement.MeasurementReport;
import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
+import org.rhq.core.pluginapi.configuration.ListPropertySimpleWrapper;
+import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
import org.rhq.core.pluginapi.inventory.ResourceComponent;
import org.rhq.core.pluginapi.inventory.ResourceContext;
import org.rhq.core.pluginapi.measurement.MeasurementFacet;
@@ -19,6 +40,18 @@ import org.rhq.core.pluginapi.measurement.MeasurementFacet;
@SuppressWarnings("unused")
public class PatternComponent implements ResourceComponent, MeasurementFacet {
+ /**
+ * <code>Number List</code> plug-in configuration property name
+ */
+ public static final String PLUGIN_CONFIG_NUMBER_LIST = "numberList"; //$NON-NLS-1$
+
+ /**
+ * <code>Pattern 3 Metric</code> prperty name
+ */
+ public static final String METRIC_PATTERN_3 = "pattern3"; //$NON-NLS-1$
+
+ private ResourceContext<?> resourceContext;
+
private final Log log = LogFactory.getLog(this.getClass());
int count = 0;
@@ -32,8 +65,14 @@ public class PatternComponent implements ResourceComponent, MeasurementFacet {
long delay = 0L; // in seconds
/**
+ * The current index within <code>numberList</code> for metric named pattern3
+ */
+ int pattern3Idx = 0;
+
+ /**
* Return availability of this resource
- * @see org.rhq.core.pluginapi.inventory.ResourceComponent#getAvailability()
+ *
+ * @see org.rhq.core.pluginapi.inventory.ResourceComponent#getAvailability()
*/
public AvailabilityType getAvailability() {
return AvailabilityType.UP;
@@ -41,10 +80,11 @@ public class PatternComponent implements ResourceComponent, MeasurementFacet {
/**
* Start the resource connection
+ *
* @see org.rhq.core.pluginapi.inventory.ResourceComponent#start(org.rhq.core.pluginapi.inventory.ResourceContext)
*/
public void start(ResourceContext context) throws InvalidPluginConfigurationException {
-
+ resourceContext = context;
Configuration conf = context.getPluginConfiguration();
String tmp = conf.getSimpleValue("ones", "1");
int wantedOnes = Integer.parseInt(tmp);
@@ -66,6 +106,7 @@ public class PatternComponent implements ResourceComponent, MeasurementFacet {
/**
* Tear down the resource connection
+ *
* @see org.rhq.core.pluginapi.inventory.ResourceComponent#stop()
*/
public void stop() {
@@ -73,8 +114,12 @@ public class PatternComponent implements ResourceComponent, MeasurementFacet {
}
/**
- * Gather "measurement" data - actually a series of 1s and 0s starting with 0.
- * @see org.rhq.core.pluginapi.measurement.MeasurementFacet#getValues(org.rhq.core.domain.measurement.MeasurementReport, java.util.Set)
+ * Gather "measurement" data.
+ * <p>
+ * Measurement data is provided based on patterns or data series provided by plug-in configuration.
+ *
+ * @see org.rhq.core.pluginapi.measurement.MeasurementFacet#getValues(org.rhq.core.domain.measurement.MeasurementReport,
+ * java.util.Set)
*/
public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> requests) throws Exception {
@@ -88,17 +133,25 @@ public class PatternComponent implements ResourceComponent, MeasurementFacet {
String metricName = request.getName();
if (metricName.startsWith("pattern")) {
-
- double value;
+ double value = Double.NaN;
if (metricName.equals("pattern1")) {
value = number;
flipMetrics = true;
-
- } else {
+ } else if (metricName.equals("pattern2")) {
// pattern2
value = 1 - number;
+ } else if (metricName.equals(METRIC_PATTERN_3)) {
+ List<Double> numberList = getNumberList();
+ if (numberList != null && numberList.size() > 0) {
+ if (pattern3Idx >= numberList.size()) {
+ pattern3Idx = 0;
+ }
+ value = numberList.get(pattern3Idx);
+ pattern3Idx++;
+ } else {
+ value = Double.NaN;
+ }
}
-
MeasurementDataNumeric datum = new MeasurementDataNumeric(request, value);
report.addData(datum);
} else if (metricName.startsWith("text")) {
@@ -135,4 +188,22 @@ public class PatternComponent implements ResourceComponent, MeasurementFacet {
}
}
+ /**
+ * Get a list of numbers assigned to the <code>numberList</code> plug-in configuration property.
+ *
+ * The list of values are parsed as doubles and returned as a <code>List<Double></code> value.
+ *
+ * @return the numbers assigned to the <code>numberList</code> connection setting
+ */
+ private List<Double> getNumberList() {
+ PropertySimple prop = resourceContext.getPluginConfiguration().getSimple(PLUGIN_CONFIG_NUMBER_LIST);
+ List<Double> numberList = new ArrayList<Double>();
+ List<String> numberListStr = (prop != null) ? new ListPropertySimpleWrapper(prop).getValue()
+ : new ArrayList<String>();
+ // parse the numbers from the configuration into our numeric list object
+ for (String numStr : numberListStr) {
+ numberList.add(Double.parseDouble(numStr.trim()));
+ }
+ return numberList;
+ }
}
diff --git a/modules/plugins/pattern-generator/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/pattern-generator/src/main/resources/META-INF/rhq-plugin.xml
index e45ba0f..0eb033f 100644
--- a/modules/plugins/pattern-generator/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/pattern-generator/src/main/resources/META-INF/rhq-plugin.xml
@@ -14,15 +14,37 @@
>
<plugin-configuration>
- <c:simple-property name="zeros" description="Number of zeros in a row" type="integer" default="1"/>
- <c:simple-property name="ones" description="Number of ones in a row" type="integer" default="2"/>
- <c:simple-property name="delay" description="Number of seconds to delay each metric collection (to test slow reporting)" type="integer" default="0"/>
+ <c:simple-property name="zeros" description="Number of zeros in a row" type="integer" default="1" />
+ <c:simple-property name="ones" description="Number of ones in a row" type="integer" default="2" />
+ <c:simple-property name="delay" description="Number of seconds to delay each metric collection (to test slow reporting)" type="integer" default="0" />
+ <c:simple-property name="numberList"
+ displayName="Number List" required="false" type="longString"
+ default="1 1 3 3">
+ <c:description>
+ A list of numeric values that might represent possible metric
+ values. Each number should be on a new line. This value may be used
+ by metrics to produce a series of predetermined metric values in a
+ specific sequence such as in the case of the pattern3 metric
+ definition.
+ </c:description>
+ </c:simple-property>
</plugin-configuration>
- <metric property="pattern1" displayName="Pattern 1 Metric" defaultInterval="30000" displayType="summary" defaultOn="true"/>
- <metric property="pattern2" displayName="Pattern 2 Metric" defaultInterval="30000" displayType="summary" defaultOn="true"/>
- <metric property="text1" displayName="Pattern 1 Trait" defaultInterval="30000" displayType="summary" defaultOn="true" dataType="trait"/>
- <metric property="text2" displayName="Pattern 2 Trait" defaultInterval="30000" displayType="summary" defaultOn="true" dataType="trait"/>
+ <metric property="pattern1" displayName="Pattern 1 Metric"
+ description="A series of one or more 0s (zeros) followed by a series of one or more 1s (ones). The number of 0s and 1s is determined by the connection setting zeros and ones respectively."
+ defaultInterval="30000" displayType="summary" defaultOn="true" />
+ <metric property="pattern2" displayName="Pattern 2 Metric"
+ description="A series of one or more 1s (ones) followed by a series of one or more 0s (zeros). The number of 1s and 0s is determined by the connection setting ones and zeros respectively."
+ defaultInterval="30000" displayType="summary" defaultOn="true" />
+ <metric property="pattern3" displayName="Pattern 3 Metric"
+ description="A series of one or more ordered numeric values as defined by the connection setting numberList. For example, if numberList is 0, 0, 1, 1, 2, 2, this metric will be return 0, 0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0 ..."
+ defaultInterval="30000" displayType="summary" defaultOn="true" />
+ <metric property="text1" displayName="Pattern 1 Trait"
+ defaultInterval="30000" displayType="summary" defaultOn="true"
+ dataType="trait" />
+ <metric property="text2" displayName="Pattern 2 Trait"
+ defaultInterval="30000" displayType="summary" defaultOn="true"
+ dataType="trait" />
</server>
commit afcdcc48651334029d664436a9ed9f9a8327c27f
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Aug 15 12:07:13 2012 -0400
Upate this dev plugin to also allow for a delay when reporting metrics. This
allows the plugin to be used for "slow" collection reporting when
simulating an overloaded agent or misbehaving plugin.
For example, to see debug logging in the agent when metric collection is
falling behind try:
1) Update pattern2 collection interval to 40s so that the two pattern metrics
are not collected at the same time, thus creating more load.
2) Set the new "delay" plugin config prop to 25. So, each collection will
take 25s, and quickly the agent will fall behind.
(cherry picked from commit 7ae1c1de8d204eaa3fe6b1ab1d03fdc897b01412)
diff --git a/modules/plugins/pattern-generator/src/main/java/org/rhq/plugins/pattern/PatternComponent.java b/modules/plugins/pattern-generator/src/main/java/org/rhq/plugins/pattern/PatternComponent.java
index 5c8d631..18c6036 100644
--- a/modules/plugins/pattern-generator/src/main/java/org/rhq/plugins/pattern/PatternComponent.java
+++ b/modules/plugins/pattern-generator/src/main/java/org/rhq/plugins/pattern/PatternComponent.java
@@ -1,4 +1,3 @@
-
package org.rhq.plugins.pattern;
import java.util.Set;
@@ -30,6 +29,8 @@ public class PatternComponent implements ResourceComponent, MeasurementFacet {
int[] wanted = new int[2];
+ long delay = 0L; // in seconds
+
/**
* Return availability of this resource
* @see org.rhq.core.pluginapi.inventory.ResourceComponent#getAvailability()
@@ -38,7 +39,6 @@ public class PatternComponent implements ResourceComponent, MeasurementFacet {
return AvailabilityType.UP;
}
-
/**
* Start the resource connection
* @see org.rhq.core.pluginapi.inventory.ResourceComponent#start(org.rhq.core.pluginapi.inventory.ResourceContext)
@@ -46,19 +46,23 @@ public class PatternComponent implements ResourceComponent, MeasurementFacet {
public void start(ResourceContext context) throws InvalidPluginConfigurationException {
Configuration conf = context.getPluginConfiguration();
- String tmp = conf.getSimpleValue("ones","1");
+ String tmp = conf.getSimpleValue("ones", "1");
int wantedOnes = Integer.parseInt(tmp);
- if (wantedOnes<1)
+ if (wantedOnes < 1)
throw new InvalidPluginConfigurationException("Ones must be > 0");
- tmp = conf.getSimpleValue("zeros","1");
+ tmp = conf.getSimpleValue("zeros", "1");
int wantedZeros = Integer.parseInt(tmp);
- if (wantedZeros<1)
+ if (wantedZeros < 1)
throw new InvalidPluginConfigurationException("Zeros must be > 0");
wanted[0] = wantedZeros;
wanted[1] = wantedOnes;
- }
+ tmp = conf.getSimpleValue("delay", "0");
+ delay = Long.parseLong(tmp);
+ if (delay < 0L)
+ delay = 0L;
+ }
/**
* Tear down the resource connection
@@ -68,19 +72,22 @@ public class PatternComponent implements ResourceComponent, MeasurementFacet {
// Nothing to do.
}
-
/**
* Gather "measurement" data - actually a series of 1s and 0s starting with 0.
* @see org.rhq.core.pluginapi.measurement.MeasurementFacet#getValues(org.rhq.core.domain.measurement.MeasurementReport, java.util.Set)
*/
- public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> requests) throws Exception {
+ public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> requests) throws Exception {
+
+ if (delay > 0L) {
+ Thread.sleep(delay * 1000L);
+ }
- boolean flipMetrics = false;
- boolean flipTraits = false;
- for (MeasurementScheduleRequest request : requests) {
- String metricName = request.getName();
+ boolean flipMetrics = false;
+ boolean flipTraits = false;
+ for (MeasurementScheduleRequest request : requests) {
+ String metricName = request.getName();
- if (metricName.startsWith("pattern")) {
+ if (metricName.startsWith("pattern")) {
double value;
if (metricName.equals("pattern1")) {
@@ -98,15 +105,15 @@ public class PatternComponent implements ResourceComponent, MeasurementFacet {
double value;
if (metricName.equals("text1")) {
- value = numberForTrait;
- flipTraits = true;
+ value = numberForTrait;
+ flipTraits = true;
} else {
- // text2
- value = 1 - numberForTrait;
+ // text2
+ value = 1 - numberForTrait;
}
String traitValue = (value == 0) ? "red" : "green";
- MeasurementDataTrait datum = new MeasurementDataTrait(request,traitValue);
+ MeasurementDataTrait datum = new MeasurementDataTrait(request, traitValue);
report.addData(datum);
}
}
diff --git a/modules/plugins/pattern-generator/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/pattern-generator/src/main/resources/META-INF/rhq-plugin.xml
index 70a8a59..e45ba0f 100644
--- a/modules/plugins/pattern-generator/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/pattern-generator/src/main/resources/META-INF/rhq-plugin.xml
@@ -16,6 +16,7 @@
<plugin-configuration>
<c:simple-property name="zeros" description="Number of zeros in a row" type="integer" default="1"/>
<c:simple-property name="ones" description="Number of ones in a row" type="integer" default="2"/>
+ <c:simple-property name="delay" description="Number of seconds to delay each metric collection (to test slow reporting)" type="integer" default="0"/>
</plugin-configuration>
<metric property="pattern1" displayName="Pattern 1 Metric" defaultInterval="30000" displayType="summary" defaultOn="true"/>
10 years, 7 months
[rhq] Branch 'release/jon3.1.x' - 2 commits - modules/plugins
by Larry O'Leary
modules/plugins/pattern-generator/src/main/java/org/rhq/plugins/pattern/PatternComponent.java | 138 +++++++---
modules/plugins/pattern-generator/src/main/resources/META-INF/rhq-plugin.xml | 35 ++
2 files changed, 137 insertions(+), 36 deletions(-)
New commits:
commit 72b6a4e469bbf3c8d70ec5d8362003e0fa8e4530
Author: Larry O'Leary <loleary(a)redhat.com>
Date: Fri Nov 1 18:01:27 2013 -0500
Added Pattern 3 Metric and numberList plug-in configuration to support a predetermined list of numeric metric values.
diff --git a/modules/plugins/pattern-generator/src/main/java/org/rhq/plugins/pattern/PatternComponent.java b/modules/plugins/pattern-generator/src/main/java/org/rhq/plugins/pattern/PatternComponent.java
index 18c6036..81ade52 100644
--- a/modules/plugins/pattern-generator/src/main/java/org/rhq/plugins/pattern/PatternComponent.java
+++ b/modules/plugins/pattern-generator/src/main/java/org/rhq/plugins/pattern/PatternComponent.java
@@ -1,17 +1,38 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2011-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.plugins.pattern;
+import java.util.ArrayList;
+import java.util.List;
import java.util.Set;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-
import org.rhq.core.domain.configuration.Configuration;
-import org.rhq.core.domain.measurement.MeasurementDataTrait;
-import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
+import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.measurement.AvailabilityType;
import org.rhq.core.domain.measurement.MeasurementDataNumeric;
+import org.rhq.core.domain.measurement.MeasurementDataTrait;
import org.rhq.core.domain.measurement.MeasurementReport;
import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
+import org.rhq.core.pluginapi.configuration.ListPropertySimpleWrapper;
+import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
import org.rhq.core.pluginapi.inventory.ResourceComponent;
import org.rhq.core.pluginapi.inventory.ResourceContext;
import org.rhq.core.pluginapi.measurement.MeasurementFacet;
@@ -19,6 +40,18 @@ import org.rhq.core.pluginapi.measurement.MeasurementFacet;
@SuppressWarnings("unused")
public class PatternComponent implements ResourceComponent, MeasurementFacet {
+ /**
+ * <code>Number List</code> plug-in configuration property name
+ */
+ public static final String PLUGIN_CONFIG_NUMBER_LIST = "numberList"; //$NON-NLS-1$
+
+ /**
+ * <code>Pattern 3 Metric</code> prperty name
+ */
+ public static final String METRIC_PATTERN_3 = "pattern3"; //$NON-NLS-1$
+
+ private ResourceContext<?> resourceContext;
+
private final Log log = LogFactory.getLog(this.getClass());
int count = 0;
@@ -32,8 +65,14 @@ public class PatternComponent implements ResourceComponent, MeasurementFacet {
long delay = 0L; // in seconds
/**
+ * The current index within <code>numberList</code> for metric named pattern3
+ */
+ int pattern3Idx = 0;
+
+ /**
* Return availability of this resource
- * @see org.rhq.core.pluginapi.inventory.ResourceComponent#getAvailability()
+ *
+ * @see org.rhq.core.pluginapi.inventory.ResourceComponent#getAvailability()
*/
public AvailabilityType getAvailability() {
return AvailabilityType.UP;
@@ -41,10 +80,11 @@ public class PatternComponent implements ResourceComponent, MeasurementFacet {
/**
* Start the resource connection
+ *
* @see org.rhq.core.pluginapi.inventory.ResourceComponent#start(org.rhq.core.pluginapi.inventory.ResourceContext)
*/
public void start(ResourceContext context) throws InvalidPluginConfigurationException {
-
+ resourceContext = context;
Configuration conf = context.getPluginConfiguration();
String tmp = conf.getSimpleValue("ones", "1");
int wantedOnes = Integer.parseInt(tmp);
@@ -66,6 +106,7 @@ public class PatternComponent implements ResourceComponent, MeasurementFacet {
/**
* Tear down the resource connection
+ *
* @see org.rhq.core.pluginapi.inventory.ResourceComponent#stop()
*/
public void stop() {
@@ -73,8 +114,12 @@ public class PatternComponent implements ResourceComponent, MeasurementFacet {
}
/**
- * Gather "measurement" data - actually a series of 1s and 0s starting with 0.
- * @see org.rhq.core.pluginapi.measurement.MeasurementFacet#getValues(org.rhq.core.domain.measurement.MeasurementReport, java.util.Set)
+ * Gather "measurement" data.
+ * <p>
+ * Measurement data is provided based on patterns or data series provided by plug-in configuration.
+ *
+ * @see org.rhq.core.pluginapi.measurement.MeasurementFacet#getValues(org.rhq.core.domain.measurement.MeasurementReport,
+ * java.util.Set)
*/
public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> requests) throws Exception {
@@ -88,17 +133,25 @@ public class PatternComponent implements ResourceComponent, MeasurementFacet {
String metricName = request.getName();
if (metricName.startsWith("pattern")) {
-
- double value;
+ double value = Double.NaN;
if (metricName.equals("pattern1")) {
value = number;
flipMetrics = true;
-
- } else {
+ } else if (metricName.equals("pattern2")) {
// pattern2
value = 1 - number;
+ } else if (metricName.equals(METRIC_PATTERN_3)) {
+ List<Double> numberList = getNumberList();
+ if (numberList != null && numberList.size() > 0) {
+ if (pattern3Idx >= numberList.size()) {
+ pattern3Idx = 0;
+ }
+ value = numberList.get(pattern3Idx);
+ pattern3Idx++;
+ } else {
+ value = Double.NaN;
+ }
}
-
MeasurementDataNumeric datum = new MeasurementDataNumeric(request, value);
report.addData(datum);
} else if (metricName.startsWith("text")) {
@@ -135,4 +188,22 @@ public class PatternComponent implements ResourceComponent, MeasurementFacet {
}
}
+ /**
+ * Get a list of numbers assigned to the <code>numberList</code> plug-in configuration property.
+ *
+ * The list of values are parsed as doubles and returned as a <code>List<Double></code> value.
+ *
+ * @return the numbers assigned to the <code>numberList</code> connection setting
+ */
+ private List<Double> getNumberList() {
+ PropertySimple prop = resourceContext.getPluginConfiguration().getSimple(PLUGIN_CONFIG_NUMBER_LIST);
+ List<Double> numberList = new ArrayList<Double>();
+ List<String> numberListStr = (prop != null) ? new ListPropertySimpleWrapper(prop).getValue()
+ : new ArrayList<String>();
+ // parse the numbers from the configuration into our numeric list object
+ for (String numStr : numberListStr) {
+ numberList.add(Double.parseDouble(numStr.trim()));
+ }
+ return numberList;
+ }
}
diff --git a/modules/plugins/pattern-generator/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/pattern-generator/src/main/resources/META-INF/rhq-plugin.xml
index e45ba0f..0eb033f 100644
--- a/modules/plugins/pattern-generator/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/pattern-generator/src/main/resources/META-INF/rhq-plugin.xml
@@ -14,15 +14,37 @@
>
<plugin-configuration>
- <c:simple-property name="zeros" description="Number of zeros in a row" type="integer" default="1"/>
- <c:simple-property name="ones" description="Number of ones in a row" type="integer" default="2"/>
- <c:simple-property name="delay" description="Number of seconds to delay each metric collection (to test slow reporting)" type="integer" default="0"/>
+ <c:simple-property name="zeros" description="Number of zeros in a row" type="integer" default="1" />
+ <c:simple-property name="ones" description="Number of ones in a row" type="integer" default="2" />
+ <c:simple-property name="delay" description="Number of seconds to delay each metric collection (to test slow reporting)" type="integer" default="0" />
+ <c:simple-property name="numberList"
+ displayName="Number List" required="false" type="longString"
+ default="1 1 3 3">
+ <c:description>
+ A list of numeric values that might represent possible metric
+ values. Each number should be on a new line. This value may be used
+ by metrics to produce a series of predetermined metric values in a
+ specific sequence such as in the case of the pattern3 metric
+ definition.
+ </c:description>
+ </c:simple-property>
</plugin-configuration>
- <metric property="pattern1" displayName="Pattern 1 Metric" defaultInterval="30000" displayType="summary" defaultOn="true"/>
- <metric property="pattern2" displayName="Pattern 2 Metric" defaultInterval="30000" displayType="summary" defaultOn="true"/>
- <metric property="text1" displayName="Pattern 1 Trait" defaultInterval="30000" displayType="summary" defaultOn="true" dataType="trait"/>
- <metric property="text2" displayName="Pattern 2 Trait" defaultInterval="30000" displayType="summary" defaultOn="true" dataType="trait"/>
+ <metric property="pattern1" displayName="Pattern 1 Metric"
+ description="A series of one or more 0s (zeros) followed by a series of one or more 1s (ones). The number of 0s and 1s is determined by the connection setting zeros and ones respectively."
+ defaultInterval="30000" displayType="summary" defaultOn="true" />
+ <metric property="pattern2" displayName="Pattern 2 Metric"
+ description="A series of one or more 1s (ones) followed by a series of one or more 0s (zeros). The number of 1s and 0s is determined by the connection setting ones and zeros respectively."
+ defaultInterval="30000" displayType="summary" defaultOn="true" />
+ <metric property="pattern3" displayName="Pattern 3 Metric"
+ description="A series of one or more ordered numeric values as defined by the connection setting numberList. For example, if numberList is 0, 0, 1, 1, 2, 2, this metric will be return 0, 0, 1, 1, 2, 2, 0, 0, 1, 1, 2, 2, 0 ..."
+ defaultInterval="30000" displayType="summary" defaultOn="true" />
+ <metric property="text1" displayName="Pattern 1 Trait"
+ defaultInterval="30000" displayType="summary" defaultOn="true"
+ dataType="trait" />
+ <metric property="text2" displayName="Pattern 2 Trait"
+ defaultInterval="30000" displayType="summary" defaultOn="true"
+ dataType="trait" />
</server>
commit 7ae1c1de8d204eaa3fe6b1ab1d03fdc897b01412
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Aug 15 12:07:13 2012 -0400
Upate this dev plugin to also allow for a delay when reporting metrics. This
allows the plugin to be used for "slow" collection reporting when
simulating an overloaded agent or misbehaving plugin.
For example, to see debug logging in the agent when metric collection is
falling behind try:
1) Update pattern2 collection interval to 40s so that the two pattern metrics
are not collected at the same time, thus creating more load.
2) Set the new "delay" plugin config prop to 25. So, each collection will
take 25s, and quickly the agent will fall behind.
diff --git a/modules/plugins/pattern-generator/src/main/java/org/rhq/plugins/pattern/PatternComponent.java b/modules/plugins/pattern-generator/src/main/java/org/rhq/plugins/pattern/PatternComponent.java
index 5c8d631..18c6036 100644
--- a/modules/plugins/pattern-generator/src/main/java/org/rhq/plugins/pattern/PatternComponent.java
+++ b/modules/plugins/pattern-generator/src/main/java/org/rhq/plugins/pattern/PatternComponent.java
@@ -1,4 +1,3 @@
-
package org.rhq.plugins.pattern;
import java.util.Set;
@@ -30,6 +29,8 @@ public class PatternComponent implements ResourceComponent, MeasurementFacet {
int[] wanted = new int[2];
+ long delay = 0L; // in seconds
+
/**
* Return availability of this resource
* @see org.rhq.core.pluginapi.inventory.ResourceComponent#getAvailability()
@@ -38,7 +39,6 @@ public class PatternComponent implements ResourceComponent, MeasurementFacet {
return AvailabilityType.UP;
}
-
/**
* Start the resource connection
* @see org.rhq.core.pluginapi.inventory.ResourceComponent#start(org.rhq.core.pluginapi.inventory.ResourceContext)
@@ -46,19 +46,23 @@ public class PatternComponent implements ResourceComponent, MeasurementFacet {
public void start(ResourceContext context) throws InvalidPluginConfigurationException {
Configuration conf = context.getPluginConfiguration();
- String tmp = conf.getSimpleValue("ones","1");
+ String tmp = conf.getSimpleValue("ones", "1");
int wantedOnes = Integer.parseInt(tmp);
- if (wantedOnes<1)
+ if (wantedOnes < 1)
throw new InvalidPluginConfigurationException("Ones must be > 0");
- tmp = conf.getSimpleValue("zeros","1");
+ tmp = conf.getSimpleValue("zeros", "1");
int wantedZeros = Integer.parseInt(tmp);
- if (wantedZeros<1)
+ if (wantedZeros < 1)
throw new InvalidPluginConfigurationException("Zeros must be > 0");
wanted[0] = wantedZeros;
wanted[1] = wantedOnes;
- }
+ tmp = conf.getSimpleValue("delay", "0");
+ delay = Long.parseLong(tmp);
+ if (delay < 0L)
+ delay = 0L;
+ }
/**
* Tear down the resource connection
@@ -68,19 +72,22 @@ public class PatternComponent implements ResourceComponent, MeasurementFacet {
// Nothing to do.
}
-
/**
* Gather "measurement" data - actually a series of 1s and 0s starting with 0.
* @see org.rhq.core.pluginapi.measurement.MeasurementFacet#getValues(org.rhq.core.domain.measurement.MeasurementReport, java.util.Set)
*/
- public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> requests) throws Exception {
+ public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> requests) throws Exception {
+
+ if (delay > 0L) {
+ Thread.sleep(delay * 1000L);
+ }
- boolean flipMetrics = false;
- boolean flipTraits = false;
- for (MeasurementScheduleRequest request : requests) {
- String metricName = request.getName();
+ boolean flipMetrics = false;
+ boolean flipTraits = false;
+ for (MeasurementScheduleRequest request : requests) {
+ String metricName = request.getName();
- if (metricName.startsWith("pattern")) {
+ if (metricName.startsWith("pattern")) {
double value;
if (metricName.equals("pattern1")) {
@@ -98,15 +105,15 @@ public class PatternComponent implements ResourceComponent, MeasurementFacet {
double value;
if (metricName.equals("text1")) {
- value = numberForTrait;
- flipTraits = true;
+ value = numberForTrait;
+ flipTraits = true;
} else {
- // text2
- value = 1 - numberForTrait;
+ // text2
+ value = 1 - numberForTrait;
}
String traitValue = (value == 0) ? "red" : "green";
- MeasurementDataTrait datum = new MeasurementDataTrait(request,traitValue);
+ MeasurementDataTrait datum = new MeasurementDataTrait(request, traitValue);
report.addData(datum);
}
}
diff --git a/modules/plugins/pattern-generator/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/pattern-generator/src/main/resources/META-INF/rhq-plugin.xml
index 70a8a59..e45ba0f 100644
--- a/modules/plugins/pattern-generator/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/pattern-generator/src/main/resources/META-INF/rhq-plugin.xml
@@ -16,6 +16,7 @@
<plugin-configuration>
<c:simple-property name="zeros" description="Number of zeros in a row" type="integer" default="1"/>
<c:simple-property name="ones" description="Number of ones in a row" type="integer" default="2"/>
+ <c:simple-property name="delay" description="Number of seconds to delay each metric collection (to test slow reporting)" type="integer" default="0"/>
</plugin-configuration>
<metric property="pattern1" displayName="Pattern 1 Metric" defaultInterval="30000" displayType="summary" defaultOn="true"/>
10 years, 7 months
[rhq] modules/enterprise
by mazz
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java | 24 ++++++----
1 file changed, 16 insertions(+), 8 deletions(-)
New commits:
commit 94ae66a6a89d42d8be2636c7835f0ee192ea63b5
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon Nov 4 15:04:03 2013 -0500
BZ 1003681 - keep bumping up the deployment # in the name string
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
index d7c27e7..7aba9d1 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
@@ -429,22 +429,33 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
BundleDeployment liveDeployment = (liveDeployments.isEmpty()) ? null : liveDeployments.get(0);
String deploymentName;
+ // always bump up the deploy number, whether its a revert or upgrade
+ int deploy;
+ boolean isInitialDeployment = (null == liveDeployment);
+ if (isInitialDeployment) {
+ deploy = 1;
+ } else {
+ try {
+ String liveName = liveDeployment.getName();
+ int iStart = liveName.indexOf("[") + 1, iEnd = liveName.indexOf("]");
+ deploy = Integer.valueOf(liveName.substring(iStart, iEnd)) + 1;
+ } catch (Exception e) {
+ // if any odd error happens here, don't abort since this is only needed for the human readable name
+ log.warn("Cannot determine next deployment number. Using -1. liveDeployment=" + liveDeployment);
+ deploy = -1;
+ }
+ }
if (null != bundleVersion) {
- boolean isInitialDeployment = (null == liveDeployment);
- int deploy = 1;
String version = bundleVersion.getVersion();
String dest = bundleDestination.getName();
if (isInitialDeployment) {
deploymentName = "Deployment [" + deploy + "] of Version [" + version + "] to [" + dest + "]";
} else {
- String liveName = liveDeployment.getName();
String liveVersion = liveDeployment.getBundleVersion().getVersion();
if (liveVersion.equals(version)) {
// redeploy
- int iStart = liveName.indexOf("[") + 1, iEnd = liveName.indexOf("]");
- deploy = Integer.valueOf(liveName.substring(iStart, iEnd)) + 1;
deploymentName = "Deployment [" + deploy + "] of Version [" + version + "] to [" + dest + "]";
} else {
// upgrade
@@ -459,9 +470,6 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
+ bundleDestination);
}
- String liveName = liveDeployment.getName();
- int iStart = liveName.indexOf("[") + 1, iEnd = liveName.indexOf("]");
- int deploy = Integer.valueOf(liveName.substring(iStart, iEnd)) + 1;
deploymentName = "Deployment [" + deploy + "] Revert To: " + prevDeployment.getName();
}
10 years, 7 months
[rhq] modules/enterprise
by mazz
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
New commits:
commit 08fc51b38c045439a9d4c7d0578abefc5d36b1ec
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon Nov 4 12:49:58 2013 -0500
BZ 1026465 / BZ 1026460 - revert fails due to a NPE
(cherry picked from commit 386ae73d5de0ba99035185f2f9a0df6d7684d138)
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
index b56e1af..d7c27e7 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
@@ -410,7 +410,9 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
+ "] or prevDeploymentId [" + prevDeploymentId + "]");
}
- checkDeployBundleAuthz(subject, bundleVersion.getBundle().getId(), bundleDestination.getGroup().getId());
+ if (bundleVersion != null) {
+ checkDeployBundleAuthz(subject, bundleVersion.getBundle().getId(), bundleDestination.getGroup().getId());
+ }
return getBundleDeploymentNameImpl(subject, bundleDestination, bundleVersion, prevDeployment);
}
10 years, 7 months