VMware vCO – cloning VM, using cluster name instead of host and getting less used datastore of chosen host. – Part 2.

0 Flares Filament.io 0 Flares ×

In the Part1 I have created a vCO workflow to get an ESX host from provided ESX Cluster name to pass it to the cloneVM action in vCO.
So now is time to get less used datastore of this host as another parameter for the cloneVM action. My workflow looks like this
I created an action “getAllDatastoresOfHost” which takes a host of VC:HostSystem as parameter and returns array of datastores of the ESX host. This action does not do much, but creating this simple action is let say more readable than the “Scriptable task”. Here is the one line code for this action 🙂

Next step in the workflow is simple “Scriptable task” which returns the less used datastore of the host. This task takes the array of VC:Datastore objects as an input parameter. The code for this scriptable task

That’s it. These are two parameters I needed to get for my cloneVM task, but now, if I have this to workflows, it’s pretty simple to create a third one “getLessUsedDatastoreInCluster”, which takes the cluster name as input parameter and returns less used datastore of ESX cluster. This workflow is simple combination of two ones previously created
I hope this simple workflows show you, how easy is from the smaller simple parts build more complex ones.

0 Flares LinkedIn 0 Google+ 0 Facebook 0 Twitter 0 Filament.io 0 Flares ×

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.