Bug 1387299

Summary: EAP version identifier change results in loss/reset of plug-in configuration
Product: [JBoss] JBoss Operations Network Reporter: Filip Brychta <fbrychta>
Component: Plugin -- JBoss EAP 7Assignee: Ruben Vargas Palma <rvargasp>
Status: CLOSED NOTABUG QA Contact: Mike Foley <mfoley>
Severity: high Docs Contact:
Priority: urgent    
Version: JON 3.3.7CC: loleary, mfoley, spinder, stianlund+bugzilla
Target Milestone: CR01Keywords: Triaged
Target Release: One-off release   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1379834 Environment:
Last Closed: 2016-11-04 19:32:17 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Filip Brychta 2016-10-20 14:54:09 UTC
+++ This bug was initially created as a clone of Bug #1379834 +++

Description of problem:
When a patch/update is applied to an EAP server that is in inventory, it results in the loss of connection settings. For example, the management user, password, secure connection settings, etc. are restored to their post-import values. The result is that JBoss ON is no longer able to monitor/manage these resources until an administrator manually intervenes and restores the previous configuration.

Version-Release number of selected component (if applicable):
3.3.7

How reproducible:
Always

Steps to Reproduce:
1.  Install, configure, and start JBoss ON 3.3.6 system.
2.  Install EAP 6.4.0.GA server into its default base directory such as `jboss-eap-6.4`.
3.  Configure and start EAP 6.4.0 standalone-full server.
4.  Import EAP 6.4.0 server into JBoss ON inventory.
5.  From _Connection Settings_ page for newly imported EAP resource, set _user_ and _password_ to necessary values and _Truststore_ to `/data/fake-trust` or some other non-existent value.
6.  Verify EAP resource's availability is reported as _UP_.
7.  Shutdown EAP standalone server from outside of JBoss ON.
8.  Verify EAP resource's availability is reported as _DOWN_.
9.  Apply EAP 6.4 update-08 using `bin/jboss-cli.sh "patch apply path/to/jboss-eap-6.4.8-patch.zip"` command.
10. Start EAP 6.4.8 standalone-full server using the same command as before.
11. Once EAP server is started, execute JBoss ON discovery scan from platform resource.
12. Wait for JBoss ON discovery scan and inventory sync to complete. This could take a couple of minutes.

Actual results:
Connection settings user property value is changed to admin
Connection settings password property value is changed to "Unset"
Connection settings truststore property value is changed to "Unset"
From logs (attached agent-excerpt.log), it appears that this issue may also reset all other connection settings including host, port, trust passwords, etc.
The EAP server is no longer managed/monitored and is reported as DOWN and agent debug log reveals:

DEBUG [ResourceContainer.invoker.daemon-1] (rhq.modules.plugins.jbossas7.BaseServerComponent)- ResourceType[id=0, name=JBossAS7 Standalone Server, plugin=JBossAS7, category=Server] [hostConfig: /data/jboss-eap-6.4/standalone/configuration/standalone-full.xml]: exception while checking availability
org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException: Credentials for plugin to connect to AS7 management interface are invalid - update Connection Settings with valid credentials.
	at org.rhq.modules.plugins.jbossas7.ASConnection.executeRaw(ASConnection.java:304)
	at org.rhq.modules.plugins.jbossas7.ASConnection.execute(ASConnection.java:512)
	at org.rhq.modules.plugins.jbossas7.ASConnection.execute(ASConnection.java:465)
	at org.rhq.modules.plugins.jbossas7.BaseComponent.readAttribute(BaseComponent.java:869)
	at org.rhq.modules.plugins.jbossas7.BaseComponent.readAttribute(BaseComponent.java:860)
	at org.rhq.modules.plugins.jbossas7.BaseServerComponent.getAvailability(BaseServerComponent.java:133)
	at org.rhq.modules.plugins.jbossas7.BaseServerComponent.start(BaseServerComponent.java:114)
	at org.rhq.modules.plugins.jbossas7.StandaloneASComponent.start(StandaloneASComponent.java:91)
	at sun.reflect.GeneratedMethodAccessor28.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.rhq.core.pc.inventory.ResourceContainer$ComponentInvocation.call(ResourceContainer.java:759)
	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:745)


Expected results:
The EAP server should be reported as UP just like it was originally without its connection settings all getting reset.

Additional info:
Perhaps this is by design but this behavior makes using the management plug-in unusable considering that EAP has been doing inplace upgrades and updates since EAP 6.1. 

This was only tested with EAP 6. I am guessing that this same issue affects EAP 7 resources as well.

InventoryManager.mergeExistingResourcePluginConfiguration seems to be behind this. Perhaps the config diff process is backwards? If configuration is not the default, then we should not touch it. If it is the default, then the default discovery logic should be applied?

Comment 1 Larry O'Leary 2016-11-04 19:32:17 UTC
This is not a bug in the plug-in but a bug in the agent's inventory manager. Therefore I am closing this as it pertains to EAP 7 plug-in and the real issue, in inventory manager, is being tracked via original bug 1379834.