VMware Cloud Community
SirWinstonPit
Contributor
Contributor

Clone VM with properties

Hi,

I am trying to use this workflow - Clone VM with properties. I fill out the attibute section and save the file. When I run the workflow it does create the workflow log file. However, I get an error about calling " get on a null value" When I check "Get VMware Values" code all the values - vmFolder = props.get("vmFolder") are in fact null. It seems that none of the values get set from the attributes.

What am I missing for this workflow?

Update:

So it looks like this call props.get is producing the error TypeError Cannot call method "get" of null. If I try and add this call to retrieve any of the attribute values, I get that error.

Has anyone run this workflow?

Thanks for any help.

cheers

Doug

0 Kudos
3 Replies
cdecanini_
VMware Employee
VMware Employee

I do not think you are using this workflow properly.

The way it is supposed to be used is being called by a parent workflow in which you do something like this:

cloneProperties = new Properties();

cloneProperties.put("vmFolder", vmFolder);

cloneProperties.put("vmName", vmName)

cloneProperties.put("vmSource", vmSource);

cloneProperties.put("vmPowerOn", vmPowerOn);

cloneProperties.put("vmTemplate", vmTemplate);

cloneProperties.put("vmDatastore", vmDatastore);

cloneProperties.put("vmHost", vmHost);

cloneProperties.put("vmPool", vmPool);

Where cloneProperties is the output attribute you will be passing tho the Clone VM from properties workflow and vm* all the attributes you need as inputs or attributes of your parent workflow and input parameter of the above scriptable box.

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
0 Kudos
SirWinstonPit
Contributor
Contributor

Thanks Christophe for the response.

I took a look at the details for this workflow:

"Clones virtual machines by using properties as input parameters. Properties of different types have the following prefixes:

-VMware properties start with vm

-Windows properties start with win

-Linux properties start with lin

-Networks properties start with nic1,nic2,nic3 or nic4

-Other properties are ignored. "

I assume these values could be read from a txt file? Still not sure why this does not work if I set the properties as input parameters - save the file and run the workflow.

Thanks again for the help.

cheers

Doug

0 Kudos
cdecanini_
VMware Employee
VMware Employee

This workflow saves information to a file for logging purposes, not for you to re-use.

If you want to do this the easier solution is to:

  • Create a new workflow
  • add to the schema one of the library clone workflows that takes regular input parameters.
  • Link the inputs of the sub workflow to your workflow attributes. Save
  • Create a new vCO configuration element. Add attributes to match the inputs of the sub workflow. Set each attribute.
  • Set the workflows attributes as configuration elements and assign them the configuration attributes.

Please read the documentation to know more about configuration elements and this blog may also help : http://blogs.vmware.com/orchestrator/2012/02/configuration-elements-revisited.html

Saving to file / reading from file and using the clone from properties is possible but a lot more complex to implement if you just begin with vCO.

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
0 Kudos