Description of problem: AS7 plugin detects HC name (within EAP Domain) by reading it directly from host.xml. By default, there's a "master" value for DC. But in host-slave.xml, there's nothing. EAP itself can figure out the name even if "name" attribute is empty or does not exist. AS7 plugin, cannot figure it out. Version-Release number of selected component (if applicable): JON 3.2 How reproducible: always Steps to Reproduce: 1. have EAP6, edit host.xml and remove <host name="master" attribute 2. start it and import in JON Actual results: resource is DOWN Expected results: resource is UP and name should be auto-detected same way as EAP6 does Additional info: Here's how EAP/WildFly auto-detects host name https://github.com/wildfly/wildfly-core/blob/master/host-controller/src/main/java/org/jboss/as/host/controller/HostControllerEnvironment.java#L274-L315
in master commit 9c2868cc0d54b3394edaf1ccea6f60c2ec959d69 Author: Libor Zoubek <lzoubek> Date: Fri Aug 8 15:04:31 2014 +0200 Bug 1128141 - HostController gets DOWN when name attribute in host.xml is empty Fallback to detect host name using on $HOSTNAME and others in case we don't find it in host.xml in release branch commit 472bc54e4bba3d967ee78ddc6d0f70d6a20e923a Author: Libor Zoubek <lzoubek> Date: Fri Aug 8 15:04:31 2014 +0200 Bug 1128141 - HostController gets DOWN when name attribute in host.xml is empty Fallback to detect host name using on $HOSTNAME and others in case we don't find it in host.xml (cherry picked from commit 9c2868cc0d54b3394edaf1ccea6f60c2ec959d69) Signed-off-by: Libor Zoubek <lzoubek>
*** Bug 1128159 has been marked as a duplicate of this bug. ***
Moving to ON_QA as available to test in the following brew build: https://brewweb.devel.redhat.com//buildinfo?buildID=379025
The issue is still visible on Version : 3.3.0.ER01.1 Build Number : 9941660:f3aa7e7 I can see following msgs in agent.log: 2014-08-26 04:57:06,171 WARN [ResourceContainer.invoker.availCheck.daemon-83] (rhq.modules.plugins.jbossas7.BaseServerComponent)- Failed to read domain host name from [/home/hudson/jboss-eap6-domain/domain/configuration/host.xml] auto-detecting... 2014-08-26 04:57:06,171 INFO [ResourceContainer.invoker.availCheck.daemon-83] (rhq.modules.plugins.jbossas7.BaseServerComponent)- Domain host name was detected as [fbr-eap6] 2014-08-26 04:57:06,171 INFO [ResourceContainer.invoker.availCheck.daemon-83] (rhq.modules.plugins.jbossas7.BaseServerComponent)- Detected domain host name [fbr-eap6] but detected name is not included in Host Controller's name and this resource remains down. Name in discovery queue: EAP Domain Controller (127.0.0.1:9990) Name in inventory after import: EAP Domain Controller (127.0.0.1:9990) [hudson@fbr-eap6 bin]$ hostname fbr-eap6.bc.jonqe.lab.eng.bos.redhat.com Error from agent.log: 2014-08-26 05:00:57,953 ERROR [ResourceContainer.invoker.daemon-6] (rhq.modules.plugins.jbossas7.BaseServerComponent)- Failed to read attribute [domain-temp-dir]: org.rhq.modules.plugins.jbossas7.json.ResultFailedException: Failed to read attribute [domain-temp-dir] of address [] - response: Result{outcome='failed', failureDescription=JBAS014883: No resource definition is registered for address [ ("host" => "fbr-eap6"), ("core-service" => "host-environment") ], rolledBack=true} org.rhq.modules.plugins.jbossas7.json.ResultFailedException: Failed to read attribute [domain-temp-dir] of address [] - response: Result{outcome='failed', failureDescription=JBAS014883: No resource definition is registered for address [ ("host" => "fbr-eap6"), ("core-service" => "host-environment") ], rolledBack=true} at org.rhq.modules.plugins.jbossas7.BaseComponent.readAttribute(BaseComponent.java:883) at org.rhq.modules.plugins.jbossas7.BaseComponent.readAttribute(BaseComponent.java:871) at org.rhq.modules.plugins.jbossas7.BaseServerComponent.readEnvironmentAttribute(BaseServerComponent.java:825) at org.rhq.modules.plugins.jbossas7.BaseServerComponent.collectEnvironmentTrait(BaseServerComponent.java:816) at org.rhq.modules.plugins.jbossas7.BaseServerComponent.getValues(BaseServerComponent.java:692) at org.rhq.modules.plugins.jbossas7.HostControllerComponent.getValues(HostControllerComponent.java:116) at sun.reflect.GeneratedMethodAccessor51.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.rhq.core.pc.inventory.ResourceContainer$ComponentInvocation.call(ResourceContainer.java:759) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) at java.lang.Thread.run(Thread.java:722)
in master commit 33247bd13927c0d87b27e42f41aa898c3f1b53f0 Author: Libor Zoubek <lzoubek> Date: Fri Sep 5 11:07:29 2014 +0200 Bug 1128141 - HostController gets DOWN when name attribute in host.xml is empty We're now throwing InvalidPluinConfigurationException in case we still fail to read /host=<detected host name> after we actually detected it. This should notify user to update his host.xml in 3.3 branch commit 8744e58739f96d34e1c80b1788eef1527966d334 Author: Libor Zoubek <lzoubek> Date: Fri Sep 5 11:07:29 2014 +0200 Bug 1128141 - HostController gets DOWN when name attribute in host.xml is empty We're now throwing InvalidPluinConfigurationException in case we still fail to read /host=<detected host name> after we actually detected it. This should notify user to update his host.xml (cherry picked from commit 33247bd13927c0d87b27e42f41aa898c3f1b53f0) Signed-off-by: Libor Zoubek <lzoubek>
Moving to ON_QA as available for test with the following brew build: https://brewweb.devel.redhat.com//buildinfo?buildID=385149
This approach basically force users to change their host.xml even though the host.xml is correct. This could be a problem for host controllers because default host-slave.xml doesn't contain the name attribute, so they will hit this issue. After discussion with Libor: - using host controller's API to get the name at server runtinme instead of parsing host.xml directly should fix this issue - previous approach is not possible for domain controllers, because there is no way how to ask for it's name via API (domain controller sees all hosts and is not able to report his name) Asking Larry for for feedback/correction...
Are we not just using :read-attribute(include-defaults=true,name=local-host-name) ? This should return the run-time hostname used for the host.xml configuration. For example, if it is set to master, master is returned. Is this not returning the actual host's name if host is not set? Bottom line is that we can not require a host="" value to be set in host.xml as it is not required by JBoss EAP. If we can not get Wildfly/JBoss EAP to provide the required data, then as a workaround we would need to provide the user with the ability to manually set this value in the plug-in configuration.
Larry, we were not using this attribute, because I didn't know it existed. And I must confess I still don't know the trick you used to discover it. local-host-name is the exact missing piece I was trying to workaround by reading host name from host.xml, thank you.
branch: master link: https://github.com/rhq-project/rhq/commit/ef11bc292 time: 2014-09-18 14:10:20 +0200 commit: ef11bc292e57e5133e5c1aee95947fcbd0f662e6 author: Libor Zoubek - lzoubek message: Bug 1128141 - HostController gets DOWN when name attribute in host.xml is empty I discovered we don't have to read HC/DC's name from host.xml at all, since this value is provided by API via 'local-host-name' attribute. So I rewrote BaseServerComponent#findASHostName() to use API which fixes this issue. ServerControl class was also affected by this change - it required xmlInputFactory (before used for reading host.xml content) which became useless and was removed.
Cherry-picked over to release/jon3.3.x commit d23d283d766bb81cf84333bba908c7b1f704c2d0 Author: Libor Zoubek <lzoubek> Date: Thu Sep 18 13:47:43 2014 +0200 I discovered we don't have to read HC/DC's name from host.xml at all, since this value is provided by API via 'local-host-name' attribute. So I rewrote BaseServerComponent#findASHostName() to use API which fixes this issue. ServerControl class was also affected by this change - it required xmlInputFactory (before used for reading host.xml content) which became useless and was removed. (cherry picked from commit ef11bc292e57e5133e5c1aee95947fcbd0f662e6) Signed-off-by: Thomas Segismont <tsegismo>
Moving to ON_QA as available for test with build: https://brewweb.devel.redhat.com/buildinfo?buildID=388959
Verified on Version : 3.3.0.ER04 Build Number : 99d2107:d7c537e