I am looking for an OptionManger updateOptions Example. The following is what I've been trying. Even though the valid arguments are shown in the UI as 1 or 0, the following code errors with InvalidArgument. If anyone has a working example, I'd love to see it. Thanks.
ServiceInstance si = new ServiceInstance(new URL(hostURL),username, password, true);
com.vmware.vim25.InvalidArgument
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at com.vmware.vim25.ws.XmlGen.fromXml(XmlGen.java:201)
at com.vmware.vim25.ws.XmlGen.parseSoapFault(XmlGen.java:80)
at com.vmware.vim25.ws.WSClient.invoke(WSClient.java:128)
at com.vmware.vim25.ws.VimStub.updateOptions(VimStub.java:3176)
at com.vmware.vim25.mo.OptionManager.updateOptions(OptionManager.java:66)
at com.compellent.systemtest.dev.monsrud.VMWarePractice.main(VMWarePractice.java:81)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am looking for an OptionManger updateOptions Example. The following is what I've been trying. Even though the valid arguments are shown in the UI as 1 or 0, the following code errors with InvalidArgument. If anyone has a working example, I'd love to see it. Thanks.
ServiceInstance si = new ServiceInstance(new URL(hostURL),username, password, true);
Folder rootFolder = si.getRootFolder();
HostSystem host = null;
host = (HostSystem) new InventoryNavigator(
rootFolder).searchManagedEntity("HostSystem", hostname);
OptionManager optionmanager = host.getOptionManager();
OptionValue changedValue = new OptionValue;
changedValue = new OptionValue();
changedValue.setKey("VMFS3.HardwareAcceleratedLocking");
changedValue.setValue(0);
optionmanager.updateOptions(changedValue);
com.vmware.vim25.InvalidArgument
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at com.vmware.vim25.ws.XmlGen.fromXml(XmlGen.java:201)
at com.vmware.vim25.ws.XmlGen.parseSoapFault(XmlGen.java:80)
at com.vmware.vim25.ws.WSClient.invoke(WSClient.java:128)
at com.vmware.vim25.ws.VimStub.updateOptions(VimStub.java:3176)
at com.vmware.vim25.mo.OptionManager.updateOptions(OptionManager.java:66)
at com.compellent.systemtest.dev.monsrud.VMWarePractice.main(VMWarePractice.java:81)
Scratch that. I figured it out.
Where it says :
changedValue.setValue(0);
use
changedValue.setValue(0L);