Implement VM provision locking mechanism and enhance VM job handling
This commit is contained in:
@@ -24,7 +24,9 @@ class VmIpReservationService
|
||||
public function reserve(int $networkId, int $hostId, string $dns): ?array
|
||||
{
|
||||
return DB::transaction(function () use ($networkId, $hostId, $dns) {
|
||||
// ponytail: exclude only IPs with an actual VM assigned, not stale __pending__ reservations
|
||||
$usedIps = ModuleIpAddress::where('module_network_id', $networkId)
|
||||
->where('vm_name', '!=', '__pending__')
|
||||
->lockForUpdate()
|
||||
->pluck('ip')
|
||||
->toArray();
|
||||
|
||||
Reference in New Issue
Block a user