diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php --- a/src/__phutil_library_map__.php +++ b/src/__phutil_library_map__.php @@ -1229,6 +1229,8 @@ 'DrydockLeaseStatus' => 'applications/drydock/constants/DrydockLeaseStatus.php', 'DrydockLeaseUpdateWorker' => 'applications/drydock/worker/DrydockLeaseUpdateWorker.php', 'DrydockLeaseViewController' => 'applications/drydock/controller/DrydockLeaseViewController.php', + 'DrydockLeaseWaitingForActivationLogType' => 'applications/drydock/logtype/DrydockLeaseWaitingForActivationLogType.php', + 'DrydockLeaseWaitingForReclamationLogType' => 'applications/drydock/logtype/DrydockLeaseWaitingForReclamationLogType.php', 'DrydockLeaseWaitingForResourcesLogType' => 'applications/drydock/logtype/DrydockLeaseWaitingForResourcesLogType.php', 'DrydockLog' => 'applications/drydock/storage/DrydockLog.php', 'DrydockLogController' => 'applications/drydock/controller/DrydockLogController.php', @@ -7294,6 +7296,8 @@ 'DrydockLeaseStatus' => 'PhabricatorObjectStatus', 'DrydockLeaseUpdateWorker' => 'DrydockWorker', 'DrydockLeaseViewController' => 'DrydockLeaseController', + 'DrydockLeaseWaitingForActivationLogType' => 'DrydockLogType', + 'DrydockLeaseWaitingForReclamationLogType' => 'DrydockLogType', 'DrydockLeaseWaitingForResourcesLogType' => 'DrydockLogType', 'DrydockLog' => array( 'DrydockDAO', diff --git a/src/applications/drydock/blueprint/DrydockWorkingCopyBlueprintImplementation.php b/src/applications/drydock/blueprint/DrydockWorkingCopyBlueprintImplementation.php --- a/src/applications/drydock/blueprint/DrydockWorkingCopyBlueprintImplementation.php +++ b/src/applications/drydock/blueprint/DrydockWorkingCopyBlueprintImplementation.php @@ -43,11 +43,6 @@ return false; } - // TODO: If we have a pending resource which is compatible with the - // configuration for this lease, prevent a new allocation? Otherwise the - // queue can fill up with copies of requests from the same lease. But - // maybe we can deal with this with "pre-leasing"? - return true; } diff --git a/src/applications/drydock/logtype/DrydockLeaseWaitingForActivationLogType.php b/src/applications/drydock/logtype/DrydockLeaseWaitingForActivationLogType.php new file mode 100644 --- /dev/null +++ b/src/applications/drydock/logtype/DrydockLeaseWaitingForActivationLogType.php @@ -0,0 +1,23 @@ +renderHandleList($resource_phids)); + } + +} diff --git a/src/applications/drydock/logtype/DrydockLeaseWaitingForReclamationLogType.php b/src/applications/drydock/logtype/DrydockLeaseWaitingForReclamationLogType.php new file mode 100644 --- /dev/null +++ b/src/applications/drydock/logtype/DrydockLeaseWaitingForReclamationLogType.php @@ -0,0 +1,23 @@ +renderHandleList($resource_phids)); + } + +} diff --git a/src/applications/drydock/storage/DrydockLease.php b/src/applications/drydock/storage/DrydockLease.php --- a/src/applications/drydock/storage/DrydockLease.php +++ b/src/applications/drydock/storage/DrydockLease.php @@ -392,6 +392,62 @@ )); } + public function getAllocatedResourcePHIDs() { + return $this->getAttribute('internal.resourcePHIDs.allocated', array()); + } + + public function setAllocatedResourcePHIDs(array $phids) { + return $this->setAttribute('internal.resourcePHIDs.allocated', $phids); + } + + public function addAllocatedResourcePHIDs(array $phids) { + $allocated_phids = $this->getAllocatedResourcePHIDs(); + + foreach ($phids as $phid) { + $allocated_phids[$phid] = $phid; + } + + return $this->setAllocatedResourcePHIDs($allocated_phids); + } + + public function removeAllocatedResourcePHIDs(array $phids) { + $allocated_phids = $this->getAllocatedResourcePHIDs(); + + foreach ($phids as $phid) { + unset($allocated_phids[$phid]); + } + + return $this->setAllocatedResourcePHIDs($allocated_phids); + } + + public function getReclaimedResourcePHIDs() { + return $this->getAttribute('internal.resourcePHIDs.reclaimed', array()); + } + + public function setReclaimedResourcePHIDs(array $phids) { + return $this->setAttribute('internal.resourcePHIDs.reclaimed', $phids); + } + + public function addReclaimedResourcePHIDs(array $phids) { + $reclaimed_phids = $this->getReclaimedResourcePHIDs(); + + foreach ($phids as $phid) { + $reclaimed_phids[$phid] = $phid; + } + + return $this->setReclaimedResourcePHIDs($reclaimed_phids); + } + + public function removeReclaimedResourcePHIDs(array $phids) { + $reclaimed_phids = $this->getReclaimedResourcePHIDs(); + + foreach ($phids as $phid) { + unset($reclaimed_phids[$phid]); + } + + return $this->setReclaimedResourcePHIDs($reclaimed_phids); + } + public function setAwakenTaskIDs(array $ids) { $this->setAttribute('internal.awakenTaskIDs', $ids); return $this;