Hey Everyone,
I'm new to vCO and trying to get my feet wet. I noticed there's already a workflow for disconnecting removable devices but you can only apply it to one VM at a time. I tried that and it worked, but I would like it to run on a schedule and do it to all of my VMs. I've done some reading and believe I need to use the batch workflows to make this happen. I read that I needed to populate the Run a Workflow on a Selection of Objects and then populate the Fill batch configuration elements. Is this true or was I reading that wrong?
Before that, though, I tried to Start the Run a workflow on a Selection of objects workflow. For my element type I chose VirtualMachine. I selected No, for the Action or Array of Elements. I can go through and set the VMs manually (which is pretty painful to do one at a time, but I'm not sure how to use an action to retrieve them yet). However, when I go to choose a workflow, the Chooser window is just empty. I should have permissions because I'm an administrator both in vCO and in the entire environment.
Am I completely off-track here? Is there a better way to do this? Or am I just missing a step? This is all in 4.1.1.
Any help would be appreciated!
Thanks,
Lauren
OK I have found how you did it. You renamed the local in and out parameters to vmNb.
As a result your script should look like this:
Instead of that:
If you did not replace the full box yet you can go on the in / out tab and double click on the local paramater to rename them back to counter.
Like this (it is not very visible here but the counter local parameter is being edited)
Welcome Lauren,
There is a full tutorial here to create workflow loops with vCenter Orchestrator.
I hope this will help you.
Christophe.
Thanks for the tutorial...definitely a help! However, I'm stuck on at least one thing. I have the schema pretty much set up. I pass the vmNb paramater to the Decrease counter. The problem is that the scripting is counter=counter-1; by default for the Decrease counter. Is there a way for me to change it to vmNb = vmNb - 1; or should I just change the paramager vmNb to counter?
It's not just letting me erase it...and when I try to run it, it says there is no "counter" paramater, which is true.
Thanks for your help!
The decrease counter predefined palette tool does not allow script edition. Instead use the in and out to link your the attribute you want to decrement (this must be explained in the tutorial).
There is no need to change the contents of that one, just re-map your input and output parameters to bind them to your "vmNb" attributes
LOL - looks like Christophe beat me to the punch
I get what you're saying theoretically, but again, I'm brand new to this and not much of a developer. How do I go about re-mapping to bind them to my vmNb attributes.
I apologize, the tutorial was very helpful, but a little confusing for a newbie. Thanks again for any help.
Click on the decrease counter box.
At the bottom of the screen:
click on the IN tab, then on the "not set" link, select your vmNb attribute.
click on the OUT tab, then on the "not set" link, select your vmNb attribute.
Christophe.
Oh yeah, I already have that in there for both the in and out. When I try to validate, though, I get the warning "counter is never used"
When I try to actually run the workflow I get this:
2011-04-04 17:22:24.166] [I] ReferenceError: "counter" is not defined. (Workflow:Detach Media / Decrease counter (item2)#1)
Please post a screenshot of your decrease counter IN and OUT parameters.
I do not know how you managed to do it but it seems you have renamed the decrease counter "counter" in and out. Mine looks like this:
Linked to vmNb.
Select this box and delete it and drag / drop it again from the palette. Re-link counter as explained before and relink the box in your workflow.
You shoud then have the same as me in visual binding.
OK I have found how you did it. You renamed the local in and out parameters to vmNb.
As a result your script should look like this:
Instead of that:
If you did not replace the full box yet you can go on the in / out tab and double click on the local paramater to rename them back to counter.
Like this (it is not very visible here but the counter local parameter is being edited)
Thanks for your help! That took care of it.
One more question. I see how you add VMs in to the array, but is there a better way than adding them in one at a time?
Great.
Typically you would call this workflow from another workflow with a resource pool or vmfolder or any other container as an input and use one of the library getAllVms* action to output all the VMs and pass them to your workflow (you can even use no input at all and use the getAllVms one if you want to run this on absolutely all VMs).
Christophe.