VMware

siayiu

siayiu's Profile

  • Name: Sia Yiu 
  • Email: (Private)
  • Member Since: Feb 4, 2008
  • Last Logged In: Nov 16, 2009 10:08 AM
  • Status Level: Enthusiast Enthusiast (239 points)
  • VMware Employee: VMware Yes
  • Location: VMware Switzerland
  • Occupation: Product Manager

siayiu's Latest Content

I was testing a workflow that finds VMs with larger than a number of snapshots . The workflow asks the user to enter the number of snapshots, the workflow then goes out to your VC, finds all the VMs, and how many snapshots each VM has and reports back. You can then optionally delete the oldest snapshots.

The problem I found was that users can actually enter the number of VMs in decimals: it's an expected behavior not from the user stand point, but from the workflow: the parameter type was number - aligned with best practice. Since it's a number, you can pretty much enter anything you want.

I asked around for what the best fix was. Someone told me that I would have to do the parameter checking in my workflow using scripting. Man, would that be painful or what?

The best practice is actually to implement input limits using the presentation tool of vCO. No scripting! Not only that, you are limiting the input before the workflow is really running so you are not wasting resources.


So, here is how I did it.

1. write my workflow. The user input in reference here is the top of the screenshot. You can see that the numberOfSnapshotMax type is of number.


http://communities.vmware.com/servlet/JiveServlet/downloadImage/6447/workflow_1.gif

2. Go to the Presentation tab at the top of the workflow. You should see all the inut parameters of the workflow.
http://communities.vmware.com/servlet/JiveServlet/downloadImage/6448/workflow_2.gif

3. Click on the Presentation then click on the icon create new step on the tool bar (the thing that looks like a document with a plus sign). You should see a new icon with the default text "New Step" I gave mine a name of "Number of Snapshots."

http://communities.vmware.com/servlet/JiveServlet/downloadImage/6449/workflow_3.gif

4. Highlight the parameter you want to have appear under that step and literally drag it under the step.
http://communities.vmware.com/servlet/JiveServlet/downloadImage/6450/workflow_5.gif

5. With the parameter highlighted, look at the bottom half of the window and click on "Add Property" (the little blue triangle with a plus sign), and select "number format" (there are also other things you can set like the min and max value, you can also define a preset list of things users can select). This is where you can choose what users can input.

http://communities.vmware.com/servlet/JiveServlet/downloadImage/6451/workflow_6.gif

6. Save and close the workflow. Run it and see if it's what you'd expect.

Sia

0 Comments Permalink

Communities