Hi,
I have downloaded the vCenter Orchestrator appliance and startup the orchestrator client. My main reason is to create snapshot of all VMs. I see there are 2 pre-defined workflows in the orchestrator 1. is "Create a snapshot" which creates snapshot of only one VM at a time and 2nd is "Create snapshots of all virtual machines in a resource pool" which only works if I have resource pool setup. I have a simple VMware cluster and around 50 VMs and I need help in creating a new workflow that will create a snapshot of all selected VMs in shot.
Please help.
Thanks
Duplicate "Create snapshots of all virtual machines in a resource pool" and replace the getAllVMsOfResourcePool action by getAllVMsOfCluster (in the initialize scripting box).
Also remove the resourcePool input and add a Cluster input.
Validate your workflow before running it.
Christophe.
Hi
Welcome to the communities.
I am not with snapshot because in case of failure its tough to recover .
If you ar doing some up gradtion then can do snapshot for testing purpose.
Thanks Chris. I have made the changes to the initialize scripting box as attached to:
// Retrieve an array of vms contained in the specified Resource Pool
if(childResourcePool){
allVMs = System.getModule("com.vmware.library.vc.resourcePool").getAllVMsOfCluster(resourcePool) ;
}else{
allVMs = resourcePool.vm;
}
vmCount = allVMs.length;
currentVM = 0;
Also under Inputs tab I changed Type from VC:ResourcePool to Array/VC:VirtualMachine and validated which produced the attahed error. I have also wrote the error as follow:
"Script in item 'Initialize' use an undefined Action or Module"
Change the script to the following:
// Retrieve an array of vms contained in the specified Cluster
allVMs = System.getModule("com.vmware.library.vc.cluster").getAllVMsOfCluster(cluster) ;
vmCount = allVMs.length;
currentVM = 0;
Delete the resource input and create a cluster one of type VC:ClusterConputeResource.
Add this input parameter to the initialize scripting box.
Hi Chris,
I have made changes to the script box exactly as you specified (image attached). I have also changed the input parameters "Type" to VC:ClusterComputeResource (image attached). The General tab screenshot is also attached.
I could not do the last part where you said,
--> Add this input parameter to the initialize scripting box
Can you please let me know the exact scripting part? I appreciate your help.
Thanks
Chris,
I have finally able to run the snapshots on all VMs under the cluster. Please see the attached image for the "Initialize" Scripting tab.
I just have last question, the workflow fails when any VMs snapshot fails. Is there a way to exclude VMs or tell the workflow to keep going if the an VMs snapshot fails?
You must have noticed that to be recognized by your scriptable task your workflow cluster input need to be added to the input of the scriptable box.
Congratulations ! You completed your first workflow. It means you have a lot of fun in front of you now :smileysilly:
As for your question: Here is the main workflow loop.
The dotted line means that if Create snapshot fail it will go to the "Ignore error ..." scriptable task instead of failing the workflow.
However inside it does the following :
if (errorCode == "Task 'CreateSnapshot_Task' error: Snapshot not taken since the state of the virtual machine has not changed since the last snapshot operation. (Dynamic Script Module name : vim3WaitTaskEnd#20)") {
System.warn("Virtual machine '" + activeVM.name + "': Snapshot not taken since the state of the virtual machine has not changed since the last snapshot operation.");
} else {
throw errorCode;
}
Which mean it will ignore the error only if it is the error code above. Otherwise it will fail the workflow (throw).
If you want it to ignore any error. Replace this script with:
System.warn(errorCode);
Which will print the error in the workflow logs but not fail (stop) the workflow.
Thanks so much chris. I have just finished taking snapshot of all VMs.
Imran