Quantcast
Channel: VMware Communities : Discussion List - vRealize Orchestrator
Viewing all articles
Browse latest Browse all 6251

Deploying to the 'best' host

$
0
0

I have a very large workflow that determines the best host to deploy a new virtual machine on. I am trying to determine what that logic would look like. The best scenario that I can come up with is something like this:

 

/** input     A cluster object     New memory for a vm     New vcpu for a vm */ 
var bestHost = null;
var hosts = cluster.hosts;
hosts.sort(function(a,b){ if(a.summary.runtime.quickstates.overallCpuUsage != b.a.summary.runtime.quickstates.overallCpuUsage) return a.summary.runtime.quickstates.overallCpuUsage - b.summary.runtime.quickstates.overallCpuUsage; else return a.summary.runtime.quickstates.overallMemoryUsage - b.summary.runtime.quickstates.overallMemoryUsage});
hosts.reverse();
for each(var host in hosts)
{
    if(host.cpu + new cpu < capacity) //psuedo code
        continue;
   if(host.memory + new memory < capacity) //psuedo code
       bestHost = host;
}


Viewing all articles
Browse latest Browse all 6251

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>