modules/plugins/jboss-cache/src/main/java/org/rhq/plugins/jbosscache/JBossCacheDiscoveryComponent.java | 10 ++++++++-- modules/plugins/virt/src/main/java/org/rhq/plugins/virt/VirtualizationHostDiscoveryComponent.java | 9 +++++++-- 2 files changed, 15 insertions(+), 4 deletions(-)
New commits: commit 78049db67fa2fc7129e218c3f55df8696b5a3c7c Author: Heiko W. Rupp hwr@redhat.com Date: Fri Dec 13 10:08:04 2013 +0100
No need to print the stack trace here - many systems do not have libvirt installed.
diff --git a/modules/plugins/virt/src/main/java/org/rhq/plugins/virt/VirtualizationHostDiscoveryComponent.java b/modules/plugins/virt/src/main/java/org/rhq/plugins/virt/VirtualizationHostDiscoveryComponent.java index 749c4c1..98aca93 100644 --- a/modules/plugins/virt/src/main/java/org/rhq/plugins/virt/VirtualizationHostDiscoveryComponent.java +++ b/modules/plugins/virt/src/main/java/org/rhq/plugins/virt/VirtualizationHostDiscoveryComponent.java @@ -35,7 +35,7 @@ import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext; import org.rhq.plugins.virt.LibVirtConnection.HVInfo;
/** - * Discovers Host and Guest information using + * Discovers Host and Guest information using */ public class VirtualizationHostDiscoveryComponent implements ResourceDiscoveryComponent, ManualAddFacet {
@@ -68,7 +68,12 @@ public class VirtualizationHostDiscoveryComponent implements ResourceDiscoveryCo res.getPluginConfiguration().put(new PropertySimple("connectionURI", virt.getConnectionURI())); virt.close(); } catch (Throwable t) { - log.warn("Can not load libvirt: " + t.getMessage(), t); + String message = t.getMessage(); + if (t.getCause()!=null) { + message += ": " + t.getCause().getMessage(); + } + log.warn("Can not load libvirt: " + message); + }
return res;
commit c44e0dcd63d088e694918bfea91a150453e21a31 Author: Heiko W. Rupp hwr@redhat.com Date: Thu Dec 12 22:17:25 2013 +0100
Check if the parent can be cast to JMXComponent before doing so.
diff --git a/modules/plugins/jboss-cache/src/main/java/org/rhq/plugins/jbosscache/JBossCacheDiscoveryComponent.java b/modules/plugins/jboss-cache/src/main/java/org/rhq/plugins/jbosscache/JBossCacheDiscoveryComponent.java index 4d1eecf..b3fabfa 100644 --- a/modules/plugins/jboss-cache/src/main/java/org/rhq/plugins/jbosscache/JBossCacheDiscoveryComponent.java +++ b/modules/plugins/jboss-cache/src/main/java/org/rhq/plugins/jbosscache/JBossCacheDiscoveryComponent.java @@ -23,6 +23,7 @@
package org.rhq.plugins.jbosscache;
+import java.util.Collections; import java.util.HashSet; import java.util.Set;
@@ -43,10 +44,10 @@ import org.rhq.plugins.jmx.MBeanResourceDiscoveryComponent; /** * Discover JBossCache instances. The only way to detect them are to * look for "*:cache-interceptor=CacheMgmtInterceptor,*" or "*:treecache-interceptor=CacheMgmtInterceptor,*" - * This is done in {@link MBeanResourceDiscoveryComponent}. We postprocess the result here to + * This is done in {@link MBeanResourceDiscoveryComponent}. We postprocess the result here to * get the base MBean name (without the property for detection) to be able to use this later and also * for display purposes, as this is the MBean name the user set up in his MBean. - * + * * @author Heiko W. Rupp */ public class JBossCacheDiscoveryComponent extends MBeanResourceDiscoveryComponent<JMXComponent<?>> { @@ -60,6 +61,11 @@ public class JBossCacheDiscoveryComponent extends MBeanResourceDiscoveryComponen public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext<JMXComponent<?>> context) {
ResourceContext parentCtx = context.getParentResourceContext(); + + if (!(parentCtx.getParentResourceComponent() instanceof JMXComponent)) { + return Collections.emptySet(); + } + JMXComponent<JBossASServerComponent<?>> gparentComponent = (JMXComponent<JBossASServerComponent<?>>) parentCtx.getParentResourceComponent();
Set<DiscoveredResourceDetails> discovered = super.performDiscovery(context.getDefaultPluginConfiguration(), gparentComponent, context.getResourceType(), false);
rhq-commits@lists.fedorahosted.org