VMware Cloud Community
rkalra
Contributor
Contributor
Jump to solution

Run test recovery to cloud on multiple vm

Hi,

I am trying to run test reovery on multiple vms using the workflow sample in in the vsphere plugin in vco. There is a workflow in the vco that allows you to run a test failover to cloud on one vm but I want to failover more than just one vm.

I made a change to the existing one. I changed to array in the replication parameter and it lets me select multiple vms but it fails with the following error when i run the workflow

com.vmware.library.vr.recover/testRecoverToCloud_1) Error in (Dynamic Script Module name : testRecoverToCloud_1#0) TypeError: Cannot find function testFailover in object DynamicWrapper (Instance) : [VRVcToCloudSourceGroup]-[class com.vmware.hms.o11n.model.VcToCloudSourceGroup] -- VALUE : com.vmware.hms.o11n.model.VcToCloudSourceGroup@31f0f077,DynamicWrapper (Instance) : [VRVcToCloudSourceGroup]-[class com.vmware.hms.o11n.model.VcToCloudSourceGroup] -- VALUE : com.vmware.hms.o11n.model.VcToCloudSourceGroup@7c01ec95.

test1.PNG

can some one please help me create a workflow that runs a test recovery/real recovery to cloud.

0 Kudos
1 Solution

Accepted Solutions
iiliev
VMware Employee
VMware Employee
Jump to solution

Hi,

Changing the type of replication parameter from a single object to an array alone is not enough.

Have you also made changes to the scripting action testRecoverToCloud_1 ? What the error says is that it cannot find a method named testFailover() on an array object, and indeed Javascript arrays have no such method.

So what you need to change is to replace the single call to replication.testFailover() with a loop loop iterating over all elements of the input array and calling testFailover() method on each of them. Note that each individual call with return its own VR:Task object so you need to collect these tasks in another array, and then wait for each task to complete using waitTaskEnd action (as the current workflow does for the single task returned from the single call to testFailover() method).

View solution in original post

0 Kudos
5 Replies
iiliev
VMware Employee
VMware Employee
Jump to solution

Hi,

Changing the type of replication parameter from a single object to an array alone is not enough.

Have you also made changes to the scripting action testRecoverToCloud_1 ? What the error says is that it cannot find a method named testFailover() on an array object, and indeed Javascript arrays have no such method.

So what you need to change is to replace the single call to replication.testFailover() with a loop loop iterating over all elements of the input array and calling testFailover() method on each of them. Note that each individual call with return its own VR:Task object so you need to collect these tasks in another array, and then wait for each task to complete using waitTaskEnd action (as the current workflow does for the single task returned from the single call to testFailover() method).

0 Kudos
rkalra
Contributor
Contributor
Jump to solution

llian,

Thank you so much for replying. No, I did not make any changes to the script. I found this article to create a loop on the workflow. Will follow the steps mentioned in the article and see how it goes.

https://www.vcoteam.info/articles/learn-vco/102-creating-workflow-loops.html

I was wondering if there is any way I can send you a webex session for this if you have some availablity to join. I can also open a ticket and provide you the SR number? My email address is rkalra@fusionstorm.com

Thanks again for your help

Thanks,

Rak

0 Kudos
iiliev
VMware Employee
VMware Employee
Jump to solution

Well, it would be a bit of an overkill to create a loop this way; creating a simple 'for each' loop on Javascript level inside your script code should be enough.

Also note that if you decide to open a SR, this SR should be opened to the team who develop/support this plug-in. This is not the vRO team.

0 Kudos
rkalra
Contributor
Contributor
Jump to solution

llian,

I opened a case with vmware 17450443205 for this.

Thanks,

Rak

0 Kudos
rkalra
Contributor
Contributor
Jump to solution

llian,

My workflow finally worked.

1. created duplicate copy of test recovery to cloud

2. clicked edit> removed the existing parameter>removed everything from scheme besides start point and end point

3. added foreach element in the middle and then in the pop window selected run test recovery to cloud.(this elements run loop on the selected workflow)

4. this gave me an option to setup the parameter again and clicked ok

5. then I went back to input tab and selected array of on replication parameter.

6. validated the workflow

Thanks,

Rak

0 Kudos