Bug 1039664 - Agent RPM Installs Not Detected by rhqctl
Summary: Agent RPM Installs Not Detected by rhqctl
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss Operations Network
Classification: JBoss
Component: Installer
Version: JON 3.2
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: GA
: JON 3.2.0
Assignee: John Mazzitelli
QA Contact: Mike Foley
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-12-09 17:39 UTC by Stefan Negrea
Modified: 2014-01-02 20:36 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-01-02 20:36:20 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Updated rhq-server-control jar to be overlaid on GA release candidate for testing. (77.62 KB, application/x-java-archive)
2013-12-09 19:53 UTC, Simeon Pinder
no flags Details

Description Stefan Negrea 2013-12-09 17:39:23 UTC
Description of problem:
rhqctl does not detect and warn users against same machine JON agent RPM installs during JON server upgrades or installations. Having an existing JON agent RPM install on the same machine with a JON 3.2 server is not supported because of the new storage service requirements. Users should be warned and referred to the documentation.



Steps to Reproduce:

Install
1. Install JON agent RPM 3.1.2
2. Attempt to install JON server 3.2.0

Upgrade
1. Install JON Server 3.1.2
2. Install JON agent RPM 3.1.2
3. Attempt to upgrade to JON server 3.2.0


Actual results:
No warning about the existing JON agent 3.1.2 RPM installation


Expected results:
A warning about the current situation is printed to the user. The warning refers the user to read the documentation. rhqctl proceeds after a 10 seconds delay.


Additional info:
The warning and test should be done only for upgrade and install commands. Any other rhqctl commands should not perform this check. The check should only test for the existence of JON agent binaries. The check should only print a warning and wait 10 seconds; it should not stop the rhqctl flow.

The agent RPM binaries are located in:
/usr/share/jon-on-{version}/agent

Examples for previous versions:
/usr/share/jon-on-3.1.0.GA/agent
/usr/share/jon-on-3.1.2.GA/agent
/usr/share/jon-on-3.2.0.GA/agent

Comment 1 John Mazzitelli 2013-12-09 17:46:04 UTC
Here's the private method that we can add to RHQControl to check to see if the agent RPM is installed - it will be called almost as soon as rhqctl is invoked.

===

    private void logWarningIfAgentRPMIsInstalled(ControlCommand command) {
        // we only care about warning if the user is installing or upgrading; otherwise, just return silently
        if (!"install".equalsIgnoreCase(command.getName()) && (!"upgrade".equalsIgnoreCase(command.getName()))) {
            return;
        }

        // see if we can find an RPM installation somewhere.
        boolean rpmInstalled;
        File rpmParentLocation = new File("/usr/share");
        File[] rpms = rpmParentLocation.listFiles(new FilenameFilter() {
            @Override
            public boolean accept(File dir, String name) {
                if (name.startsWith("jboss-on-")) {
                    File jonDir = new File(dir, name);
                    // technically, we should look for the agent in new File(jonDir, "agent") because that's the rpm install dir.
                    // but there are no other rpms other than the agent, so if we see this jboss-on-* location, we know the agent is here.
                    log.warn("An agent RPM installation was found in ["
                        + jonDir
                        + "]!!! You will not be able to successfully run this older agent! You should manually remove it.");
                    return true;
                } else
                    return false;
            }
        });

        // if there is an RPM install on this box, we need to pause for some time to give the user a chance to read the message
        rpmInstalled = (rpms != null && rpms.length > 0);
        if (rpmInstalled) {
            try {
                log.warn("Please read the above warnings about the existence of agent RPM installations. This "
                    + command.getName() + " will resume in a few seconds.");
                Thread.sleep(30000L);
            } catch (InterruptedException ie) {
                Thread.currentThread().interrupt();
            }
        }

        return;
    }

Comment 2 John Mazzitelli 2013-12-09 17:50:21 UTC
git commit to master: e4c0b12f83c3d51f111591e7fc7773125e655e17

Comment 3 John Mazzitelli 2013-12-09 17:53:08 UTC
git commit to release/jon3.2.x: 8d987e8cdf916fa97a18e70f0c25679d211c138f

Comment 4 Mike Foley 2013-12-09 17:55:50 UTC
Development ... please document clearly what you have to test this change.

Comment 5 John Mazzitelli 2013-12-09 18:02:24 UTC
If you have an agent RPM installed (for example, /usr/share/jboss-on-3.1.2.GA/agent), you'll see this in the rhqctl install output:

$ ./rhqctl install
13:01:32,718 INFO  [org.jboss.modules] JBoss Modules version 1.2.0.CR1
13:01:32,865 WARN  [org.rhq.server.control.RHQControl] An agent RPM installation was found in [/usr/share/jboss-on-3.1.2.GA]!!! You will not be able to successfully run this older agent anymore. You should manually remove it.
13:01:32,865 WARN  [org.rhq.server.control.RHQControl] Please read the above warnings about the existence of agent RPM installations. This install will resume in a few seconds.

Comment 6 John Mazzitelli 2013-12-09 18:04:06 UTC
Here's what it looks like if you upgrade a server on a machine where an agent RPM also lives:

$ ./rhqctl upgrade --from-server-dir=/some-server-install-dir
13:02:54,575 INFO  [org.jboss.modules] JBoss Modules version 1.2.0.CR1
13:02:54,728 WARN  [org.rhq.server.control.RHQControl] An agent RPM installation was found in [/usr/share/jboss-on-3.1.2.GA]!!! You will not be able to successfully run this older agent anymore. You should manually remove it.
13:02:54,728 WARN  [org.rhq.server.control.RHQControl] Please read the above warnings about the existence of agent RPM installations. This upgrade will resume in a few seconds.

Comment 7 Mike Foley 2013-12-09 18:09:20 UTC
QE, please ... 
1) update the TCMS definition based on this BZ
2) another documented testcase run of this TCMS as part of the verification.  

https://tcms.engineering.redhat.com/run/94976/?from_plan=6517

Comment 9 Simeon Pinder 2013-12-09 19:53:09 UTC
Created attachment 834498 [details]
Updated rhq-server-control jar to be overlaid on GA release candidate for testing.

Comment 10 Simeon Pinder 2013-12-09 20:08:13 UTC
This can be tested with a GA-1 candidate by:
i)installing an earlier JON 3.1.2.GA agent via rpm
ii)Unzip JON 3.2.0.GA candidate build, then take the attached jar on top of 
 <jon-server-install-dir>/modules/org/rhq/rhq-server-control/main/rhq-server-control.....jar.
iii)Run normal upgrade/install test activities and monitor install logs for WARN as described above.

Comment 12 Simeon Pinder 2013-12-09 22:33:01 UTC
Updated the wording to explicitly direct users to the install documentation as discussed:
"... You will not be able to successfully run this older agent anymore. You should consult the install documentation about manually removing and/or merging the old and new agent.".

This if fixed with the following commits to the release branch:
dbf6b06c
15939eb4

Comment 13 Simeon Pinder 2013-12-10 05:07:24 UTC
Moving to ON_QA as available for test in latest brew build:
https://brewweb.devel.redhat.com//buildinfo?buildID=317919

Comment 14 Sunil Kondkar 2013-12-10 14:20:48 UTC
Verified on https://brewweb.devel.redhat.com//buildinfo?buildID=317919

Verified as below:
---
Installation
-------
1. Installed JON agent RPM 3.1.2 on RHEL 6 machine.
(jboss-on-agent-3.1.2.GA-1.el6_3.noarch.rpm)
 rpm -e jboss-on-agent-3.1.2.GA-1.el6_3.noarch.rpm
 service jon-agent start
2. Attempted to install JON server 3.2.0 on the same machine.
 ./rhqctl install

It displayed below:
03:17:10,418 INFO  [org.jboss.modules] JBoss Modules version 1.2.2.Final-redhat-1
03:17:10,749 WARN  [org.rhq.server.control.RHQControl] An agent RPM installation was found in [/usr/share/jboss-on-3.1.2.GA]!!! You will not be able to successfully run this older agent anymore. You should consult the install documentation about manually removing and/or merging the old and new agent.
03:17:10,750 WARN  [org.rhq.server.control.RHQControl] Please read the above warnings about the existence of agent RPM installations. This install will resume in a few seconds. 
---------
Upgrade:
-------------
1. Installed JON Server 3.1.2 on RHEL 6 machine.
2. Installed JON agent RPM 3.1.2 RHEL 6 machine.
rpm -e jboss-on-agent-3.1.2.GA-1.el6_3.noarch.rpm
service jon-agent start
3. Attempted to upgrade to JON server 3.2.0.
./rhqctl upgrade --from-server-dir <JON3.2 Server Dir>

It displayed below:

[root@dhcp201-210 bin]# ./rhqctl upgrade --from-server-dir /JON3.1.2GA/jon-server-3.1.2.GA
05:35:24,625 INFO  [org.jboss.modules] JBoss Modules version 1.2.2.Final-redhat-1
05:35:25,195 WARN  [org.rhq.server.control.RHQControl] An agent RPM installation was found in [/usr/share/jboss-on-3.1.2.GA]!!! You will not be able to successfully run this older agent anymore. You should consult the install documentation about manually removing and/or merging the old and new agent.
05:35:25,196 WARN  [org.rhq.server.control.RHQControl] Please read the above warnings about the existence of agent RPM installations. This upgrade will resume in a few seconds.
------

Also verified that only rhqctl install and rhqctl upgrade displays above warning. Other rhqctl commands like rhqctl start, restart, stop, status, ---help does not display above warning message.


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