Bug 704028 - Resource upgrade doesn't detect duplicate resource keys correctly
Summary: Resource upgrade doesn't detect duplicate resource keys correctly
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: RHQ Project
Classification: Other
Component: Plugin Container
Version: 4.0.0
Hardware: Unspecified
OS: Unspecified
urgent
urgent
Target Milestone: ---
: ---
Assignee: RHQ Project Maintainer
QA Contact: Mike Foley
URL:
Whiteboard:
Depends On:
Blocks: rhq401
TreeView+ depends on / blocked
 
Reported: 2011-05-11 21:12 UTC by Lukas Krejci
Modified: 2013-09-02 07:16 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-09-02 07:16:05 UTC
Embargoed:


Attachments (Terms of Use)

Description Lukas Krejci 2011-05-11 21:12:28 UTC
Description of problem:

The detection of the duplicate resource keys during resource upgrade is flawed.

The detection fails for the case when 2 resources upgrade to the same resource key.


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

How reproducible:
always

Steps to Reproduce:
1. Build the latest code from release-3.0.1 branch to get the latest changes to the apache plugin
2. Discover some apache server with some vhosts
3. for at least 2 vhosts, set the "SNMP WWW Service Index" value in the connection properties to the same number (functionality-wise, this is an invalid state, but we shouldn't mess up the inventory because of that)
4. install latest master
5. upgrade the database, leaving the data in
6. start the upgraded agent
7. look into the database - the vhost resources are going to have the same resource key

Actual results:
There are 2 resources under a single parent having the same resource key, which is an error

Expected results:
The upgrade should have failed and the resources stopped so that the user can clean up the inventory.

Additional info:

Comment 1 Lukas Krejci 2011-05-18 14:21:34 UTC
Fixed in release-4.0.0 branch by commit:

commit bd8335935aff914bc2a40860afda96daed6ad20e
Author: Lukas Krejci <lkrejci>
Date:   Wed May 18 15:50:47 2011 +0200

    Merging resource-upgrade-fixes from master.


and in master by commit:

commit 6ea278d85a438acc216a33dcd831d53e34e3c85a
Merge: 241f8a1 3ff7587
Author: Lukas Krejci <lkrejci>
Date:   Wed May 18 15:39:23 2011 +0200

    Merge branch 'master-resource-upgrade-fixes'

Comment 2 Sunil Kondkar 2011-05-19 12:20:19 UTC
1. Downloaded the rhq301 build from 'https://brewweb.devel.redhat.com//buildinfo?buildID=164904'

2. Discovered apache server with two vhosts and the "SNMP WWW Service Index" value in the connection properties is set to the same number in both vhosts.

3. Stopped the rhq server and installed latest build#36 (https://hudson.qa.jboss.com/hudson/view/Jon-2.x/job/release-4.0.0/36/)

4. The vhosts after upgrade are displayed as unavailable and the upgraded agent log displays below:

2011-05-19 16:17:52,321 ERROR [main] (rhq.core.pc.upgrade.ResourceUpgradeDelegate)- Upgrading the resource [Resource[id=10801, type=Apache Virtual Host, key=monitoring-test:8081, name=127.0.0.1:8081, parent=sunillaptop:80]] using these updates [ResourceUpgradeRequest[resourceId = '10801', newResourceKey = 'monitoring-test:8081|127.0.0.1:8081', newName = 'null', newDescription = 'null', upgradeErrorMessage = 'null', upgradeErrorStackTrace = 'null']] would render the inventory invalid because of the following reasons:
Another inventoried sibling resource of the same type already has the proposed resource key or would have it after the upgrade.
2011-05-19 16:17:52,322 ERROR [main] (rhq.core.pc.upgrade.ResourceUpgradeDelegate)- Upgrading the resource [Resource[id=10032, type=Apache Virtual Host, key=monitoring-test:8080, name=127.0.0.1:8080, parent=sunillaptop:80]] using these updates [ResourceUpgradeRequest[resourceId = '10032', newResourceKey = 'monitoring-test:8081|127.0.0.1:8081', newName = 'null', newDescription = 'null', upgradeErrorMessage = 'null', upgradeErrorStackTrace = 'null']] would render the inventory invalid because of the following reasons:
Another inventoried sibling resource of the same type already has the proposed resource key or would have it after the upgrade.

5. The postgres database queries display different resource keys for vhost resources (127.0.0.1:8080  and 127.0.0.1:8081)

rhq301=# SELECT resource_key, name FROM rhq_resource where id=10032;
     resource_key     |      name      
----------------------+----------------
 monitoring-test:8080 | 127.0.0.1:8080
(1 row)

rhq301=# SELECT resource_key, name FROM rhq_resource where id=10801;
     resource_key     |      name      
----------------------+----------------
 monitoring-test:8081 | 127.0.0.1:8081


Marking as verified.

Comment 3 Heiko W. Rupp 2013-09-02 07:16:05 UTC
Bulk closing of issues that were VERIFIED, had no target release and where the status changed more than a year ago.


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