I’ve recently had to manipulate virtual machine advanced parameters via vRO workflows due to a need to manipulate the multi-writer flag of virtual machine disks. I’ve written vRO actions to perform the following:

  1. Add new advanced parameter
  2. Amend an existing advanced parameter
  3. Read the value of an existing advanced parameter
  4. Read the values of all existing advanced parameters

addAdvancedSettingtoVM

This action can be used both to add a new advanced parameter and also amend an existing advanced parameter.

var changedValue = new Array()
changedValue[0] = new VcOptionValue();
changedValue[0].key = optionKey;
changedValue[0].value = optionValue;
var ConfigSpec = new VcVirtualMachineConfigSpec();
ConfigSpec.extraConfig = changedValue;
vmTask = vm.reconfigVM_Task(ConfigSpec);
return vmTask;

Inputs:

optionKey – type string

optionValue – type string

vm – type VC:VirtualMachine

Return Type:

VC:Task

getAdvancedSettingsfromVM

This action will return all of the advanced parameters of a virtual machine as an array.

var advancedProperties = new Array()
var extraConfig = vm.config.extraConfig
for each (var i in extraConfig) {
advancedProperties.push(i);
}
return advancedProperties;

Inputs:

vm – type VC:VirtualMachine

Return Type:

Array/string

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s