This service will be undergoing maintenance at 00:00 UTC, 2016-08-01. It is expected to last about 1 hours

Bug 704028

Summary: Resource upgrade doesn't detect duplicate resource keys correctly
Product: [Other] RHQ Project Reporter: Lukas Krejci <lkrejci>
Component: Plugin ContainerAssignee: RHQ Project Maintainer <rhq-maint>
Status: CLOSED CURRENTRELEASE QA Contact: Mike Foley <mfoley>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 4.0.0CC: hrupp, skondkar
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-09-02 03:16:05 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Bug Depends On:    
Bug Blocks: 703268    

Description Lukas Krejci 2011-05-11 17:12:28 EDT
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 10:21:34 EDT
Fixed in release-4.0.0 branch by commit:

commit bd8335935aff914bc2a40860afda96daed6ad20e
Author: Lukas Krejci <lkrejci@redhat.com>
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@redhat.com>
Date:   Wed May 18 15:39:23 2011 +0200

    Merge branch 'master-resource-upgrade-fixes'
Comment 2 Sunil Kondkar 2011-05-19 08:20:19 EDT
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 03:16:05 EDT
Bulk closing of issues that were VERIFIED, had no target release and where the status changed more than a year ago.