Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 251579

Re: Wokflow Exercise

$
0
0

Chris example is correct.

As an optional improvement and for further exercising I would do something like that :

 

 

var allVms = new Array() ; // Declares 'allVms' as Array
var vmsWithX = new Array(); 
allVms = System.getModule("com.vmware.library.vc.vm").getAllVMs(); // Returns all VMs for each ( var vm in allVms ) // Runs now for each VM in 'allVms' Array{    if ( vm.name.search("x") != -1 ) // Is there a 'x' within the attribute 'name' of 'vm'    {        System.log( "Adding " + vm.name + " to array of VMs to be started"); // Write the name of the VM to log        vmsWithX.push(vm);               }}

 

This allows to store the VMs to be started as a workflow attribute that can then be used in different ways:

  • Use a loop iterator to start the Power on VM workflow: this will allow the workflow to resume where it stopped in case the Orhestration service is turned off (i.e Windows update, VM maintenance).
  • Eventually create smaller arrays from this array and use start workflow in parallel to only start x many VMs at a single time.

 

Christophe.


Viewing all articles
Browse latest Browse all 251579

Trending Articles



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