VMware Cloud Community
goody3335
Contributor
Contributor
Jump to solution

Use VCO to disconnect removable devices on multiple VMs

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

Reply
0 Kudos
1 Solution

Accepted Solutions
cdecanini_
VMware Employee
VMware Employee
Jump to solution

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:

Screen shot 2011-04-04 at 11.48.25 PM.png

Instead of that:

Screen shot 2011-04-04 at 11.49.28 PM.png

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)

Screen shot 2011-04-04 at 11.55.18 PM.png

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter

View solution in original post

Reply
0 Kudos
16 Replies
cdecanini_
VMware Employee
VMware Employee
Jump to solution

Welcome Lauren,

There is a full tutorial here to create workflow loops with vCenter Orchestrator.

I hope this will help you.

Christophe.

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter
goody3335
Contributor
Contributor
Jump to solution

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!

Reply
0 Kudos
cdecanini_
VMware Employee
VMware Employee
Jump to solution

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).

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter
Reply
0 Kudos
Burke-
VMware Employee
VMware Employee
Jump to solution

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 Smiley Happy

LOL - looks like Christophe beat me to the punch Smiley Wink

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vRealize Orchestrator tips and tutorials - @TechnicalValues on Twitter
Reply
0 Kudos
goody3335
Contributor
Contributor
Jump to solution

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.

Reply
0 Kudos
cdecanini_
VMware Employee
VMware Employee
Jump to solution

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.

Screen shot 2011-04-04 at 11.17.20 PM.png

Christophe.

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter
Reply
0 Kudos
goody3335
Contributor
Contributor
Jump to solution

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"

Reply
0 Kudos
goody3335
Contributor
Contributor
Jump to solution

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)

Reply
0 Kudos
cdecanini_
VMware Employee
VMware Employee
Jump to solution

Please post a screenshot of your decrease counter IN and OUT parameters.

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter
Reply
0 Kudos
goody3335
Contributor
Contributor
Jump to solution

Here is the in, out, and visual binding...thanks.

Reply
0 Kudos
cdecanini_
VMware Employee
VMware Employee
Jump to solution

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:

Screen shot 2011-04-04 at 11.42.11 PM.png

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.

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter
Reply
0 Kudos
cdecanini_
VMware Employee
VMware Employee
Jump to solution

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:

Screen shot 2011-04-04 at 11.48.25 PM.png

Instead of that:

Screen shot 2011-04-04 at 11.49.28 PM.png

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)

Screen shot 2011-04-04 at 11.55.18 PM.png

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter
Reply
0 Kudos
goody3335
Contributor
Contributor
Jump to solution

Thanks for your help!  That took care of it.

Reply
0 Kudos
goody3335
Contributor
Contributor
Jump to solution

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? 

Reply
0 Kudos
cdecanini_
VMware Employee
VMware Employee
Jump to solution

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).

Screen shot 2011-04-05 at 3.45.28 PM.png

Christophe.

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vCenter Orchestrator tips and tutorials - @vCOTeam on Twitter
Reply
0 Kudos
goody3335
Contributor
Contributor
Jump to solution

Thanks Christophe!

I created a document with the steps I took to do this...if anyone is interested.

Reply
0 Kudos