Merge ~blake-rouse/maas:fix-bad-postgres-connection into maas:master
Status: | Merged |
---|---|
Approved by: | Blake Rouse |
Approved revision: | b843207535c85c8ca2fdfd9bc61976da4186108b |
Merge reported by: | MAAS Lander |
Merged at revision: | not available |
Proposed branch: | ~blake-rouse/maas:fix-bad-postgres-connection |
Merge into: | maas:master |
Diff against target: |
57 lines (+27/-0) 2 files modified
src/maasserver/utils/orm.py (+11/-0) src/maasserver/utils/tests/test_orm.py (+16/-0) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Mike Pontillo (community) | Approve | ||
Review via email: mp+332741@code.launchpad.net |
Commit message
Ensure a good postgresql connection with the connected utility.
All the twisted helpers including the deferToDatabase use the connected() utility. This utility was not verifying that the postgresql connection that it could use was actually a good connection. This now ensures that it is a usable connection before yielding.
Description of the change
How to test:
sudo systemctl start postgresql
sudo systemctl start maas-regiond
sudo systemctl restart postgresql
sudo systemctl start maas-rackd
No stacktrace will occur with "connection already closed". Before this patch "sudo systemctl restart postgresql" would cause the regiond processes to hold onto a connection to a dead postgresql process.
Looks good.