I just want to make sure I'm on the right track here. I'm working on a workflow that will kickoff during MachineProvisioned stub to change the dvsportgroup. I brought in a get virtual machine by name at the beginning of the workflow which then converts the array to a vc:virtualmachine and pass that on. Is this the best way to get the VM name for the workflow to automatically run?
Is it possible to run this during building? I have a workflow that names my machine. Maybe if I put a wait in place to allow the VM to finish cloning then change the dvsportgroup?
Rather than trying to explain all of this, I'm going to point you to a link... happy reading! Working with vCloud Automation Center IaaS entities
vCAC:Entity is returning zero results when I try to run that. I'll take a look at your link though. From what I'm gathering, vCAC:Entity encompasses all the properties for given entities? Could I not just use vCAC:VirtualMachine in my case?
Nope. As far as I'm aware, you have to get the entity of the vCAC object and then run the update against it, not the object itself. You don't run a search for the entity, though... If you're just building a workflow to go and update values, you'd bring in vCAC:VirtualMachine (call it vCACVm), and get the entity by taking the object and creating a new attribute called entity that calls vCACVm.getEntity();. If you're doing this in the course of a state workflow, the running process that does the setup prior to executing the actual designated workflow will resolve all of those values for you (the vCAC VM object, it's entity, it's properties, and VC/VCD VM, if it's at a point where there is a VM).
Aaaaah... Ok. This is useful stuff...!
I've always assumed that the standard input to a workflow that gets called from a stub is VCAC:Entity. Are you saying that if the vCO workflow input is VCAC:VirtualMachine instead, that VCAC will pass in that value? From there, obviously, I'd need to do a vCACvm.getEntity(); to go and get it's properties.
It's actually easier than that. The stub workflow, if you have objects in there for both the vCAC:VirtualMachine and vCAC:Entity, it will populate both into the workflow, cutting out a step. Take a look at the Workflow template under Extensibility; you'll see what the stub runner is capable of passing along (keeping in mind what's available at any state).
Just having a play with it now, this might be the 'Missing Link' I've been looking for..! The documentation for this stuff appears to be practically non-existent... Just to clarify, what exactly are you referring to when you say 'stub runner' I'm assuming that's the process that VCAC uses to pass the variables to vCO?
If you look under Library -> vCloud Automation Center -> Infrastructure Administration -> Extensibility -> Workflow stubs, you're going to see all of the workflows that vCAC is actually calling when it executes a particular state workflow... What these do is setup the various objects that will be made available, then calls the actual stub workflow for the state the request is in and kicks that one off. It's a bit cumbersome (in theory), but it kind of does make sense if you sit there and think about what it has to do to ensure it's normalized and things work... In theory, during a particular state, the only thing you should really need to manually pull in are properties, not the actual objects themselves (at least, that's all I need to do for the most part).
Stupid question, but why not just use the Custom Property to change the Port Group?
Grant
Hi Grant,
I think, via a very long discussion, that's the conclusion we've come to .
It's much easier to set these things during the BuildingMachine workflow stub, than trying to do it after the machine is provisioned.
awjudge, I'm having some issues with this. I want to do the same thing. I am trying to use a workflow called "create / update property on virtual machine entity" which is in essence just calling the "addUpdatePropertyFromVirtualMachineEntity" action for you. I am setting the property name to "VirtualMachine.Network0.Name" and the value is my network/vlan label. When it runs however I'm getting the error "The validated object is null (Dynamic Script Module name : addUpdatePropertyFromVirtualMachineEntity#7).
Any ideas?
EDIT: I imported the workflow you attached from page 1. I went over it and it appears I have done exactly what you did. I have my inputs/outputs set up nearly identical. If the user selects a dropdown that begins with"internet" it sets the appropriate DVport group name in a variable. I pass that variable as the value and "VirtualMachine.Network0.Name" as the property name to the create / update propety on vm entity workflow. That's when I get the error.
EDIT2: As a test I created in the blueprint a custom property called "VirtualMachine.Network0.Name" and left it blank. When I built my vm it failed with error: A server error was encountered. Error requesting machine. No reservation available that has all specified networks. I'm not sure if this is just because I left it blank or it shouldn't be a custom property at all.\
Edit3: I figured out my issue. I was passing in vcac:vcachost (which is a requirement of the addUpdateProperty) as an "attribute" and not an "in-paramter". Once I made the change my workflow succeeded!