Bug 1128141 - HostController gets DOWN when name attribute in host.xml is empty
Summary: HostController gets DOWN when name attribute in host.xml is empty
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss Operations Network
Classification: JBoss
Component: Plugin -- JBoss EAP 6
Version: JON 3.2
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ER04
: JON 3.3.0
Assignee: Libor Zoubek
QA Contact: Filip Brychta
URL:
Whiteboard:
Keywords:
: 1128159 (view as bug list)
Depends On:
Blocks: JON3-47, PRODMGT-629
TreeView+ depends on / blocked
 
Reported: 2014-08-08 11:53 UTC by Libor Zoubek
Modified: 2018-12-09 18:19 UTC (History)
6 users (show)

(edit)
The AS7 plugin did not recognise the HostController if the name attribute in the host.xml file was left blank. The HostController would not deploy if there was not a name assigned to it in the host.xml file. The HostController name is now provided by the API instead of needing to be specified in the host.xml file. The HostController name is automatically detected.
Clone Of:
(edit)
Last Closed: 2014-12-11 13:59:21 UTC


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Bugzilla 1150667 None None None Never

Internal Trackers: 1150667

Description Libor Zoubek 2014-08-08 11:53:35 UTC
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

Comment 1 Libor Zoubek 2014-08-08 13:07:44 UTC
in master

commit 9c2868cc0d54b3394edaf1ccea6f60c2ec959d69
Author: Libor Zoubek <lzoubek@redhat.com>
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@redhat.com>
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@redhat.com>

Comment 2 Libor Zoubek 2014-08-08 14:34:09 UTC
*** Bug 1128159 has been marked as a duplicate of this bug. ***

Comment 3 Simeon Pinder 2014-08-19 23:50:30 UTC
Moving to ON_QA as available to test in the following brew build:

https://brewweb.devel.redhat.com//buildinfo?buildID=379025

Comment 4 Filip Brychta 2014-08-26 09:03:17 UTC
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)

Comment 5 Libor Zoubek 2014-09-05 09:13:47 UTC
in master

commit 33247bd13927c0d87b27e42f41aa898c3f1b53f0
Author: Libor Zoubek <lzoubek@redhat.com>
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@redhat.com>
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@redhat.com>

Comment 7 Simeon Pinder 2014-09-17 02:49:09 UTC
Moving to ON_QA as available for test with the following brew build:
https://brewweb.devel.redhat.com//buildinfo?buildID=385149

Comment 8 Filip Brychta 2014-09-17 14:01:00 UTC
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...

Comment 9 Larry O'Leary 2014-09-17 15:59:36 UTC
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.

Comment 10 Libor Zoubek 2014-09-18 08:35:02 UTC
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.

Comment 11 Libor Zoubek 2014-09-18 12:11:45 UTC
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@redhat.com
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.

Comment 12 Thomas Segismont 2014-09-23 14:32:18 UTC
Cherry-picked over to release/jon3.3.x

commit d23d283d766bb81cf84333bba908c7b1f704c2d0
Author: Libor Zoubek <lzoubek@redhat.com>
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@redhat.com>

Comment 13 Simeon Pinder 2014-10-01 21:32:58 UTC
Moving to ON_QA as available for test with build:
https://brewweb.devel.redhat.com/buildinfo?buildID=388959

Comment 14 Filip Brychta 2014-10-07 09:54:39 UTC
Verified on
Version :	
3.3.0.ER04
Build Number :	
99d2107:d7c537e


Note You need to log in before you can comment on or make changes to this bug.