ok, so i been on a mental struggle here trying to get this completed.
I have an array that looks like
Array ( [0] => cluster_1 [1] => cluster_2 )
I want to add a new user to the first available cluster that has sufficient space to allocated the new user.
I have this class method created to output the amount of megs in each array item. I can test it out and echo the results with
foreach ($cluster_array as $cluster) {
echo $cluster . " " . Server::server_free_space("/agents/" . $cluster, 2)."<br />";
}
the output gives me
cluster_1 20505
cluster_2 21398
those figures are in MB.
I want to have my array looped to find the first available cluster that has enough space to allocate a new user. For example if a new user needs 1gb allocated, thats 1024mb. So if the first cluster in the array does not have 1024MB free, then it will move and scan the next cluster in the array and so on. Adding the user to that cluster.
How would I approach this?