Hi,
In order to prevent virtual disks shrinking I'm looking to set the following values to a VM .vmx file using the vSphere WS SDK:
I looked through the API reference but I couldn't find a method or config spec to set that.
Is this possible from the vSphere web services SDK? Or can I set those values using the VIX Api?
Thanks!
Sebastián.
Hi,
This can be done using the vSphere Web Services SDK or any of the other vSphere SDKs (vSphere SDK for Perl,etc). Take a look at this article for the details including two example scripts - http://blogs.vmware.com/vsphere/2012/03/acessing-virtual-machine-advanced-settings.html
FYI - VIX is for guest operations only and can not set these configurations which is defined at the VM level.
Thanks, that was exactly what I was looking for!
so, in terms of the WS SDK, the method to invoke is ReconfigVM_Task, and the parameter to set is spec.extraConfig
which is an array of key, value pairs.
I could succesfully add new key-values or modify existing ones. However, I think there's an error in the documentation:
extraConfig* | OptionValue[] | Additional configuration information for the virtual machine. This describes a set of modifications to the additional options. An option is removed if the key is present but the value is not set or the value is an empty string. Otherwise, the key is set to the new value. Configuration keys that would conflict with parameters that are explicitly configurable through other fields in the ConfigSpec object are silently ignored. Reconfigure privilege: VirtualMachine.Config.AdvancedConfig (also required when setting this property while creating a virtual machine) |
To delete a setting, if I set the value field as an empty string, the setting is not deleted nor changed, the change is just ignored. And if I don't set a value at all I get an 'A specified parameter was not correct.' error.
Besides, from the VIClient's "Configuration Parameters" window, a legend reads "Entries cannot be removed".
Is there any way to delete a key-value setting?
Kind regards,
Sebastian.