Bug 865167
| Summary: | Resource with AvailabilityType of NULL is being returned to UI resulting in ResourceDatasource.copyValues throwing org_rhq_core_domain_resource_Resource_currentAvailability is null | ||
|---|---|---|---|
| Product: | [Other] RHQ Project | Reporter: | Larry O'Leary <loleary> |
| Component: | Core Server, Database | Assignee: | Jay Shaughnessy <jshaughn> |
| Status: | CLOSED CURRENTRELEASE | QA Contact: | Mike Foley <mfoley> |
| Severity: | urgent | Docs Contact: | |
| Priority: | urgent | ||
| Version: | 4.4 | CC: | hrupp, jshaughn, mazz |
| Target Milestone: | --- | ||
| Target Release: | RHQ 4.6 | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | 865166 | Environment: | |
| Last Closed: | 2013-09-03 14:45:31 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
| Bug Depends On: | |||
| Bug Blocks: | 865166 | ||
|
Description
Larry O'Leary
2012-10-10 22:22:49 UTC
master commit c2b37fd00701018fd5df3f99879c6cf4c2fddc4c
Jay Shaughnessy <jshaughn>
Tue Oct 16 14:04:41 2012 -0400
I believe this is the cause of the failure. In certain cases a legacy db
may not have an rhq_resource_avail record for a resource. It is now eagerly
created but in the past it was possible to have resource without the
record. The old codepath for initializing resource avail for these resources
had an issue.
** NOTE!!! Once the issue occurs, the code fix will will not automatically solve
** the problem. This workaround code below should be applied. The fix will
** only help future upgrades, not upgrades that have already taken place.
Workaround SQL that can be applied to databases suffering from this issue:
postgres:
INSERT INTO RHQ_RESOURCE_AVAIL ( ID, RESOURCE_ID, AVAILABILITY_TYPE )
SELECT nextval('RHQ_RESOURCE_AVAIL_ID_SEQ'::text), res.ID, 2
FROM RHQ_RESOURCE res
LEFT JOIN RHQ_RESOURCE_AVAIL avail ON res.ID = avail.RESOURCE_ID
WHERE avail.ID IS NULL
oracle:
INSERT INTO RHQ_RESOURCE_AVAIL ( ID, RESOURCE_ID, AVAILABILITY_TYPE )
SELECT RHQ_RESOURCE_AVAIL_ID_SEQ.nextval, res.ID, 2
FROM RHQ_RESOURCE res
LEFT JOIN RHQ_RESOURCE_AVAIL avail ON res.ID = avail.RESOURCE_ID
WHERE avail.ID IS NULL
Test Notes:
Not really easy to test. I'd suggest probably just moving this to VERIFIED if the relevant customer cases are resolved.
DevNote: If this resolves the issues, the query above could be moved to the db-upgrade.xml script and the codepath could be eliminated completely. As per 865166 db upgrade needs to be updated with the sql below (In reply to comment #3) > As per 865166 db upgrade needs to be updated with the sql below git commit to master 4b888be16b1ae2ceb876e85cc82001bbdc79e516 adds the sql to the db-upgrade script. Bulk closing of issues in old RHQ releases that are in production for a while now. Please open a new issue when running into an issue. |