VMware Cloud Community
vMarkusK1985
Expert
Expert

vSphere VM deleted between Array Build and Output

Hello,

I created a log running Workflow. The Workflow Matches vCloud VMs to vCenter VMs but it can happen that a Vm is deleted between its conversion from vCloud to vSphere:VM and the Putput of the workflow.

System.debug("* Starting - Get vSphere VMs");

System.debug("Convert to Vim Managed Objects");

var VcenterVms = new Array();

for(var i = 0; i < VcloudVms.length; i++){

System.debug("Converting vCloud VM: " + VcloudVms[i].name);

try {

    var managedObject = new VcManagedObjectReference(); 

managedObject.type = "VirtualMachine"; 

managedObject.value = VcloudVms[i].getVMVimRef().moRef;

VcenterVm = VcPlugin.convertToVimManagedObject(vcserver , managedObject);

VcenterVms.push(VcenterVm);

}

catch(err) {

   System.warn("Converting vCloud VM failed! Error: " + err);

}

System.debug("Found vCenter VM: " + VcenterVm.name);

}

System.log(VcenterVms.length + " vCenter Vms Found");

System.debug("* Finished - Get vSphere VMs");

That Situation results in a Error:

Workflow:vCD - Get VcVms / Get vCenter VMs (item2) : ch.dunes.model.type.ConvertorException: Unable to convert object, 'Stub: moRef = (ManagedObjectReference: type = VirtualMachine, value = vm-9877, serverGuid = null), binding = https://<vCenter FQDN>:443/sdk' plugin exception reason : convertToResult() --> Finder 'VC:VirtualMachine' : unexpected error 'ch.dunes.model.sdk.SDKFinderException: convertToResult() --> Finder 'VC:VirtualMachine' : unable to invoke read method : 'name''

Is there any workaround to handle that situation (e.g. Skip the Output of the Failed Object)?

https://mycloudrevolution.com | https://twitter.com/vMarkus_K | https://github.com/vMarkusK
Tags (2)
0 Kudos
1 Reply
iiliev
VMware Employee
VMware Employee

Hi,

Conversion of input/output parameters is done server side, so content creators do not have control over it. What you can do is to try to handle errors gracefully by adding additional error handler items to your workflow.

0 Kudos