Add ui elements for handling server transfers, add TransferJob.php and TransferService.php
This commit is contained in:
parent
49f0421e90
commit
a2eab3ca43
11 changed files with 526 additions and 71 deletions
|
@ -174,6 +174,23 @@ class NodeRepository extends EloquentRepository implements NodeRepositoryInterfa
|
|||
})->values();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a node with the given id with the Node's resource usage.
|
||||
*
|
||||
* @param int $node_id
|
||||
* @return Node
|
||||
*/
|
||||
public function getNodeWithResourceUsage(int $node_id): Node
|
||||
{
|
||||
$instance = $this->getBuilder()
|
||||
->select(['nodes.id', 'nodes.memory', 'nodes.disk', 'nodes.memory_overallocate', 'nodes.disk_overallocate'])
|
||||
->selectRaw('IFNULL(SUM(servers.memory), 0) as sum_memory, IFNULL(SUM(servers.disk), 0) as sum_disk')
|
||||
->leftJoin('servers', 'servers.node_id', '=', 'nodes.id')
|
||||
->where('nodes.id', $node_id);
|
||||
|
||||
return $instance->first();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the IDs of all nodes that exist in the provided locations and have the space
|
||||
* available to support the additional disk and memory provided.
|
||||
|
|
Reference in a new issue