1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-13 10:22:42 +01:00
phorge-phorge/src/applications/drydock
epriestley cce5ebebe9 Improve Drydock's ability to allocate leases correctly
Summary:
Right now, Drydock gives out multiple leases to the same working copy and gives out leases to working copies with repository "P" in them when the user requested some other repository.

Add two callbacks:

  - `canAllocateLease()` - allows a blueprint to reject a lease on a resource because of a fundamental incompatibility, like "it's a working copy with Phabricator in it, but the lease wants a working copy with Javelin in it".
  - `shouldAllocateLease()` - allows a blueprint to reject a lease on a resource because of resource limits, like "only one active lease can own a working copy at a time".

Also cleaned up various other things.

Test Plan:
After implementing the callbacks, Drydock has the correct behavior:

  - It gives multiple leases on `localhost`, but only one lease per working-copy resource.
  - It does not grant leases on resources with repository X to requests for repository Y.

Ran `bin/drydock lease --type working-copy --repositoryID 12` and similar repeatedly and verified results in the web console.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T2015

Differential Revision: https://secure.phabricator.com/D4166
2012-12-12 18:42:12 -08:00
..
application Use application icons for "Eye" menu and Crumbs 2012-12-07 13:37:28 -08:00
blueprint Improve Drydock's ability to allocate leases correctly 2012-12-12 18:42:12 -08:00
constants Improve Drydock's ability to allocate leases correctly 2012-12-12 18:42:12 -08:00
controller Show lease and resource attributes in web view for Drydock 2012-12-12 07:36:53 -08:00
interface Delete license headers from files 2012-11-05 11:16:51 -08:00
management Make drydock case sensitive in attribute parsing 2012-11-29 06:05:35 -08:00
query Make various Drydock CLI/Allocator improvements 2012-11-06 15:30:11 -08:00
storage Improve Drydock's ability to allocate leases correctly 2012-12-12 18:42:12 -08:00
util Improve Drydock's ability to allocate leases correctly 2012-12-12 18:42:12 -08:00
worker Improve Drydock's ability to allocate leases correctly 2012-12-12 18:42:12 -08:00