VMware Cloud Community
irene_zimmerman
Contributor
Contributor

set host advanced settings from vco

Hi,

I want to set host advanced options with vco, but i cannot get it to work.
I took the powershell code, that is quite easy, and tried it the same way in Orchestrator.

Powershell:
$option = New-Object VMware.Vim.OptionValue
$option.key = $tgtkey
$option.value = $tgtvalue
$optarr += $option
$optMgr.UpdateOptions($optarr)

vCO code snippet: 
  
var aoValues = new Array();
configuredValue = oTargetHost.configManager.advancedOption.queryOptions("NFS.MaxVolumes");
System.log("Configured value is: " + configuredValue[0].value + ", Key: " + configuredValue[0].key);  
  
configuredValue[0].value="256";
aoValues.push(configuredValue[0]);

oTargetHost.configManager.advancedOption.updateOptions(aoValues);


I also tried to create a new OptionValue, like this:

var myVcOptionValue = new VcOptionValue() ;
myVcOptionValue.key="NFS.MaxVolumes";
myVcOptionValue.value="256";
aoValues.push(myVcOptionValue);

Both result in the same error message:
InternalError: a parameter was not correct.

How can I make this work?

6 Replies
ChrisMueller85
Enthusiast
Enthusiast

The HostSystem Object does not have a updateOptions method.

Try to use the configManager of the Host.

Like: VcHostSystem.configManager.advancedOption.updateOption(changedValue);

0 Kudos
irene_zimmerman
Contributor
Contributor

Hi chris,

Thats what I tried and it did not work.

oTargetHost.configManager.advancedOption.updateOptions(aoValues);

0 Kudos
TZiegler
VMware Employee
VMware Employee

the trouble is that Javascript does not now anything about advanced  Number Formats like Int and Long:

var myVcOptionValue = new VcOptionValue() ;
myVcOptionValue.key="NFS.MaxVolumes";
myVcOptionValue.value_LongValue="256";
aoValues.push(myVcOptionValue);

should Work.

You might also want to have a look at this one:

http://communities.vmware.com/docs/DOC-22782

DDinu
Enthusiast
Enthusiast

I tried the same like below.

var myVcOptionValue = new VcOptionValue() ;
myVcOptionValue.key="NFS.MaxVolumes";
myVcOptionValue.
value="256";
aoValues.push(myVcOptionValue);

Error Message : A specified parameter was not correct:

0 Kudos
LukasWe
Enthusiast
Enthusiast

Hi,

I got it working for a VM. Maybe you can use this approach also for a host.

var optionValueToUpdate= new VcOptionValue(in_configParamName, in_configParamValue);

var extraConfig = new Array();

extraConfig.push(optionValueToUpdate);

if (in_configParamValue != "")

  System.debug("Add option: " + optionValueToUpdate);

else

  System.debug("Delete option: " + optionValueToUpdate);

var spec = new VcVirtualMachineConfigSpec();

spec.extraConfig = extraConfig;

task = in_vm.reconfigVM_Task(spec);

My input parameters:

     in_vm (VcVirtualMachine)

     in_configParamName (string) - e.g. "disk.EnableUUID"
     in_configParamValue (string) e.g. "TRUE"    // this might be also of type object, but I did not test it

I attached the workflow if someone needs it...

0 Kudos
prashant88
Contributor
Contributor

Thanks! value_LongValue worked for me.

0 Kudos