Quantcast
Channel: VMware Communities : All Content - vSphere Management SDK
Viewing all articles
Browse latest Browse all 1860

Way to get HA dedicated failover hosts via java SDK

$
0
0

Hi,

 

I'm using java VMware vSphere SDK 5.0.0  to get properties of managed object.

 

I set two hosts as dedicated failover hosts for HA admission control policy. I wanna this failover host list from SDK APIs. So I write following code to get:

 

======================================================================================================================

 

String[] properties = new String[] {"configuration.dasConfig.admissionControlPolicy.failoverHosts"};

PropertySpecExt pSpec = new PropertySpecExt();

pSpec.setType(moRef.getType());

pSpec.setPathSet(properties);

ObjectSpec oSpec = new ObjectSpec();

oSpec.setObj(moRef);

PropertyFilterSpecExt pfSpec = new PropertyFilterSpecExt();

pfSpec.setPropSet(new PropertySpec[] {pSpec});

pfSpec.setObjectSet(new ObjectSpec[] {oSpec});

List<PropertyFilterSpec> pfSpecList = new ArrayList<PropertyFilterSpec>();

pfSpecList.add(pfSpec);

List<ObjectContent> ocs = vimPort.retrieveProperties(getMOR(),pfSpecList);


======================================================================================================================


But I got exception info:


======================================================================================================================


com.vmware.vim25.InvalidPropertyFaultMsg:

    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)

    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)

    at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:136)

    at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:108)

    at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78)

    at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:135)

    at com.sun.proxy.$Proxy35.retrieveProperties(Unknown Source)

 

======================================================================================================================


Not sure if this exception is due to the property name "configuration.dasConfig.admissionControlPolicy.failoverHosts", so I tried "configuration.dasConfig.admissionControlPolicy". I managed to get the object of ClusterDasAdmissionControlPolicy, but it was found out that there was no any method/function to access failoverHosts (it is protected).

 

obj.jpg

 

Does anybody have idea about this?


Viewing all articles
Browse latest Browse all 1860

Trending Articles