I was trying to follow this guide below to create a workflow to be executed from a vcac blueprint.. Basically i took the template Vcac/infrastructure administrator/Workflow Template
which has this piece of code
if (vCenterVm != null) {
System.log("Got vCloud VM " + vCenterVm.name);
}
Well, it never prints the vm name. I need it in order to run operations on the vm after the vm is deployed .. how am i able to get it .. and why would the template have it if it's
not availabl.e
How to extend vCAC with vCO Part 2 – Hello world Script in Guest | VMtoCloud.com
That was why I asked about what state this was being performed... if during BuildingMachine, then there is no VM object... it hasn't been created/cloned/whatever. Important piece of diagnostic data!
If you're running vCAC 6.1, check this: VMware KB: Cannot find VMware vSphere virtual machines by unique identifier using the vCenter Orches...
I am not getting an error , just not sure which step i am missing. Like is it passed from vcac .. or how am i suppose to get it ?
declare it as an input parameter. its a vCenter object that vCO is able to retrieve. For instance, if I wanted to reference
bind it appropriately (ignore the other inputs from my screenshot)
to ensure your VC:VirtualMachine object is returning the correct value, use System.log to display the results
System.log("VC VM Name = " + vm.name);
Thank you for trying to help.
Yes, that is what i have done. However, it's empty .. so vco is not getting it from vcac. It's getting everything else .. like vCACHost and all the params. This one it seems it can't get ..
banging my head ..
At what stub are you calling out? If the vCenter VM has not yet been created or has been removed then that value will be null. Generally speaking the vCAC:VirtualMachine name will be the same so you should be able to use that. Are you positive that the vCenter plugin is setup correctly? Can you see the vCenter vm's in the inventory? The vCenter plugin sometimes gets stale connections although the more recent builds of the plugin have (mostly) addressed that issue.
(Asking again...) Are you running vCAC 6.1? If you are...Please follow the KB I posted earlier. You won't get an error under the conditions in that KB. Starting with 6.1, the vmUniqueID value being collected is the InstanceUuid rather than the Uuid value stored with the VM, and without that fix, even with the 6.1 plugin, you're going to run into the issue with vCO being able to resolve the vCAC:VirtualMachine -> VC:VirtualMachine.
In fact, regardless of if you're running 6.1 or not, the included fix (apply after updating to the 6.1 plugin, mind you) should probably be done either way. The way the code was updated for that, it is backwards compatible with > 6.1 IaaS instances.
I ran the "Assign a state change workflow to ab lueprint and it's virtual machine".
It puts in "ExternalWFStubs.BludingMachine" .
Yes, I am sure it's working - since it will build machines, run the workflows . However, the one particular workflow that needs the vm name is where the issue is.
Yes, I am running 6.0.1.1 .
will be adding the update you recommended and get back to you. Thank you for your help.
Unfortunately, the kb article says the package to download, without a link . Trying to find it now..
can't seem to find the package. If anybody knows where i can find this..
com.vmware.vcac61_uuid_wf_patch.package
Please let me know. Many thanks !
the link is in the KB article... https://my.vmware.com/group/vmware/details?downloadGroup=VCAC-610&productId=447&rPId=6501
OK so in this code.
System.log("Workflow started from workflow stub " + externalWFStub + " on vCAC host " + vCACHost.displayName);
System.log("Got vCAC virtual machine " + vCACVm.virtualMachineName);
System.log("Matching virtual machine entity " + virtualMachineEntity.keyString);
System.log("Here is the " + virtualMachineEntity.keyString);
if (vCenterVm != null) {
System.log("Got vCloud VM " + vCenterVm.name);
}
I get nothing in vCenterVM. so how would i get now the name and uuid to input to the workflow (get vm by name .. ) ?
Just a quick thought, but.. what state is this workflow being called from?
Did you ever verify that the vCenter plugin is functioning correctly? If it isn't the bug in the KB biting you then it might be an issue with that plugin or its configuration. Also, this is the code from the "Workflow runner" workflow which is where the prep is happening during the stub call out:
System.log("vmUniqueID : " + vCACVm.vmUniqueID);
if (vCACVm.vmUniqueID != null) { // vmUniqueID may be null (i.e at BuildingMachine state)
if (vCACVm.vmUniqueID.indexOf("vcloud") > -1) {
System.log("Got vCloud Director VM ID");
var vdcHosts = System.getModule("com.vmware.library.vcac").getEnabledHosts() ;
for each (var vcdHost in vdcHosts) {
var vCloudVApp = vcdHost.getEntityById(VclFinderType.VAPP, vCACVm.vmUniqueID);
if (vCloudVApp != null) {
break;
}
}
}
else {
System.log("Trying to resolve a vCenter VM");
var sdkConnections = VcPlugin.allSdkConnections;
System.log(sdkConnections.length + " sdk Connections found...");
for each (var sdkConnection in sdkConnections) {
try {
vCenterVm = sdkConnection.searchIndex.findByUuid(null, vCACVm.vmUniqueID, true, false);
} catch(e) {System.log("Error for SDK connection " + sdkConnection.name + " : " + e);}
if (vCenterVm != null) {
System.log("Resolved vCenter VM " + vCenterVm.name);
break;
}
}
}
}
What do you see in your system logs? That should also help shed a little light on things. This code is from the 6.0.1.1 plugin so it may be different in the 6.1 plugin. Anyway take a look at that workflow. You can see it is looping through each of the vCenter connections you have in your plugin. If the connection is not in a responsive state or the plugin is not setup correctly you will not get a hit. Also, if timing wise the VM has not yet been created you won't get a hit. You may need to move what you are trying to do to "machineProvisioned" or at some other point in your workflow look the vm up yourself. Maybe put in an action that loops until the value of vCACVm.vmUniqueID returns something other than null then look the vm up yourself.
That was why I asked about what state this was being performed... if during BuildingMachine, then there is no VM object... it hasn't been created/cloned/whatever. Important piece of diagnostic data!
So are we supposed to use these new workflows like "Get VM by Name and BIOS UUID" similar to the workflow template? Inputs should be populated when running workflows against a VM?
Just to be clear, i'm talking about machine provisioned and destroyed workflows. My workflows fail now since I'm unable to find the vCenterVM anymore.
BuildingMachine
Like others said, there will be no VC object to output during the building machine workflow