Bug 788487

Summary: AS7 plugin: allow manually add a standalone server
Product: [Other] RHQ Project Reporter: Heiko W. Rupp <hrupp>
Component: PluginsAssignee: Thomas Segismont <tsegismo>
Status: CLOSED CURRENTRELEASE QA Contact: Mike Foley <mfoley>
Severity: unspecified Docs Contact:
Priority: medium    
Version: 4.2CC: hrupp, lzoubek
Target Milestone: ---   
Target Release: RHQ 4.9   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 824513 (view as bug list) Environment:
Last Closed: 2014-03-26 08:31:39 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 707223, 824513    

Description Heiko W. Rupp 2012-02-08 09:49:24 UTC
Allow to manually add a standalone server.

In order to add it, the server must already have a management user set up or security disabled. The "add rhq user" operation can not work in this case.

( We need to make sure the above operation will not do harm on the local file system of the agent )

Comment 1 Heiko W. Rupp 2012-02-08 11:10:44 UTC
master 8f06f86c129bf5b15

Comment 2 Libor Zoubek 2012-05-16 11:20:03 UTC
on JON 3.1.Beta1 EAP6 ER6 - I am not able to add standalone server manually

There is one server running on agent host (not in inventory) and 2nd server on remote host.

When I try to add EAP on local agent host it get's imported, but availability is off. Availability message says:

org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException: The original product type discovered for this AS7 server was JBoss AS 7, but the server is now reporting its product type is [JBoss EAP 6].
	at org.rhq.modules.plugins.jbossas7.BaseServerComponent.getAvailability(BaseServerComponent.java:128)

When I try to import EAP on remote host (typing hostname instead of localhost) I get error in UI:

luginContainerException:Failed to add resource with type [JBossAS7 Standalone Server] and parent resource id [13495] -> org.rhq.core.util.exception.WrappedRemotingException:null -> org.rhq.core.util.exception.WrappedRemotingException:Discovery component invocation failed. -> org.rhq.core.util.exception.WrappedRemotingException:null

Comment 3 Charles Crouch 2012-05-22 20:15:28 UTC
With Heiko to investigate.

Comment 4 Heiko W. Rupp 2012-05-23 13:14:07 UTC
I can "only" reproduce it every 2nd time 

One place is

org.rhq.core.pc.inventory.InventoryManager#updateAvailability
where the resourceContainer is null (perhaps the start() method was not yet called? 



The other place is org.rhq.modules.plugins.jbossas7.BaseServerComponent#validateServerAttributes

(which shows up in the debugger after the above call to updateAvail and is called from
BaseServerComponent.getAvail() which is called from BaseServerComponent.start()

Here 

          baseDir = serverPluginConfig.getBaseDir().getCanonicalFile();
throws a NPE as serverPluginConfig.getBaseDir() is null.



2012-05-23 14:16:55,161 ERROR [ResourceContainer.invoker.daemon-11] (rhq.modules.plugins.jbossas7.BaseServerComponent)- Failed to validate base dir for {JBossAS7}JBossAS7 Standalone Server [snert:9990].
java.lang.NullPointerException
        at org.rhq.modules.plugins.jbossas7.BaseServerComponent.validateServerAttributes(BaseServerComponent.java:133)
        at org.rhq.modules.plugins.jbossas7.BaseServerComponent.getAvailability(BaseServerComponent.java:115)
        at org.rhq.modules.plugins.jbossas7.BaseServerComponent.start(BaseServerComponent.java:92)



Later in this method at

        if (runtimeType != null) {
            JBossProductType type = serverPluginConfig.getProductType();

An exception is thrown when type is null, which seems always the case for the manually imported server. 

Looks like the ProductInfo information is never passed to the plugin config.
Simply adding the productType fixes the "red bar" like this:


        pluginConfig.put(new PropertySimple("manuallyAdded", true));
+        pluginConfig.put(new PropertySimple("productType",productType.name()));

        DiscoveredResourceDetails detail = new DiscoveredResourceDetails(context.getResourceType(), key, name,

It also looks like this fixes the issue with updateAvailabiltiy() above.

Comment 5 Heiko W. Rupp 2012-05-23 16:08:24 UTC
master f6a5001

Also prevent start/restart from being run for manually added servers, as we can not start processes on machines without agents.

Comment 6 Libor Zoubek 2012-05-30 08:58:34 UTC
on JON 3.1.ER6 there is still little issue with adding server manually. Now it does not depend on whether server is on localhost or not. Each time I try to manually add EAP6.ER8 I get following error in message center:


The original product type discovered for this AS7 server was null, but the server is now reporting its product type is [JBoss EAP 6]

I get this error, but server is correctly imported anyway. I don't consider it as blocking bug anymore, but it confuses user.

Comment 7 Heiko W. Rupp 2012-06-04 14:50:18 UTC
That red-bar does not always show up (just tried it and it did not show up).
As it does not prevent import, it is rather harmless and the user can when he clicks on reload button on that inventory page he will soon see the imported server.

Comment 8 Heiko W. Rupp 2013-09-04 08:57:26 UTC
Thomas,
can you if you have time in 4.10 check the status of this one?

Comment 9 Thomas Segismont 2013-09-18 10:01:26 UTC
(In reply to Libor Zoubek from comment #6)
> on JON 3.1.ER6 there is still little issue with adding server manually. Now
> it does not depend on whether server is on localhost or not. Each time I try
> to manually add EAP6.ER8 I get following error in message center:
> 
> 
> The original product type discovered for this AS7 server was null, but the
> server is now reporting its product type is [JBoss EAP 6]
> 
> I get this error, but server is correctly imported anyway. I don't consider
> it as blocking bug anymore, but it confuses user.

This problem was addressed in the fix for BZ913764.

Just did a test again with EAP 6.1 on a remote machine and the managed server product type was properly discovered.

Setting target release to RHQ 4.9 as the fix for BZ913764 is in this release.

Comment 10 Heiko W. Rupp 2014-03-26 08:31:39 UTC
Bulk closing now that 4.10 is out.

If you think an issue is not resolved, please open a new BZ and link to the existing one.