VMware Cloud Community
philk33
Enthusiast
Enthusiast
Jump to solution

Unable to Snapshot Each VM in a Folder

Hello,

I'm using the following schema for my workflow

pastedImage_0.png

The first action gets all virtual machines in a folder.

The second workflow is a foreach workflow that is supposed to create a snapshot for each VM passed to it from the getAllVirtualMachinesInFolder action.

The third workflow is a foreach workflow that is supposed to reboot guest OS in the same manner as the snapshot.

Seems simple enough, but I'm getting this error:

com.vmware.library.vc.basic/vim3WaitTaskEnd) Error in (Dynamic Script Module name : vim3WaitTaskEnd#20) Task 'CreateSnapshot_Task' error: The operation is not supported on the object.

Workflow execution stack:

***

item: 'Create a snapshot/item1', state: 'failed', business state: 'null', exception: 'Task 'CreateSnapshot_Task' error: The operation is not supported on the object. (Dynamic Script Module name : vim3WaitTaskEnd#20)'

workflow: 'Create snapshot of all virtual machines in a folder' (8a33318d-c441-4931-8de6-224aa3c03aa3)

So what is happening here? It's trying to snapshot the folder? Why? Here is my visual binding, it seems correct.

pastedImage_1.png

Thanks in advance!

Tags (1)
Reply
0 Kudos
1 Solution

Accepted Solutions
tschoergez
Leadership
Leadership
Jump to solution

Does the action filter for Templates? From an inventory perspective templates are also VM objects, just with the "isTemplate" boolean set to true. But in vCenter there are many actions not permitted on templates (like creating snapshots)

Joerg

View solution in original post

Reply
0 Kudos
4 Replies
tschoergez
Leadership
Leadership
Jump to solution

Does the action filter for Templates? From an inventory perspective templates are also VM objects, just with the "isTemplate" boolean set to true. But in vCenter there are many actions not permitted on templates (like creating snapshots)

Joerg

Reply
0 Kudos
philk33
Enthusiast
Enthusiast
Jump to solution

Ah, Ok, this is simply my mistake. I was using our templates folder for testing because it has running vm's we use for testing. It seems though, when I use the action to get vms in a folder, it's also pulling in templates and trying to snapshot them.

This is not what I wanted to do. I see what happened now.

Reply
0 Kudos
tschoergez
Leadership
Leadership
Jump to solution

Yes, the library action "blindly" returns all vm objects of the folder, including templates.

Find attached a workflow example that includes the filtering. I added a scriptable task after the action, and there used some javascript to filter the array:

filteredVmList = allVmsOfFolder.filter(function(vm) {

return vm.isTemplate == false;

});

Joerg

philk33
Enthusiast
Enthusiast
Jump to solution

Thank you very much. Appreciate the help!

Reply
0 Kudos