On 07/12/2018 11:25 PM, [email protected] wrote:
When trying to do VM list using the 4.2.4 Java SDK against a 4.2.4 engine, I am 
getting an error while trying to follow the host link to get host info. Any 
suggestions on fixing this?

List<Vm> vms = vmsService.list()
                 .follow("host")
                 .send().vms();

Check the following example:


https://github.com/oVirt/ovirt-engine-sdk-java/blob/master/sdk/src/test/java/org/ovirt/engine/sdk4/examples/FollowVmLinks.java#L62

If you need host you just need to do:

 Host host = connection.followLink(vm.host());


Exception in thread "main" org.ovirt.engine.sdk4.Error: Failed to send request
         at 
org.ovirt.engine.sdk4.internal.HttpConnection.send(HttpConnection.java:255)
         at 
org.ovirt.engine.sdk4.internal.HttpConnection.send(HttpConnection.java:229)
         at 
org.ovirt.engine.sdk4.internal.services.VmsServiceImpl$ListRequestImpl.send(VmsServiceImpl.java:563)
         at 
org.ovirt.engine.sdk4.internal.services.VmsServiceImpl$ListRequestImpl.send(VmsServiceImpl.java:477)
         at com.foo.ovirt.test.VMList.main(VMList.java:59)
Caused by: org.ovirt.engine.sdk4.Error: The response content type 
'text/html;charset=UTF-8' isn't the expected XML
         at 
org.ovirt.engine.sdk4.internal.HttpConnection.checkContentType(HttpConnection.java:287)
         at 
org.ovirt.engine.sdk4.internal.HttpConnection.send(HttpConnection.java:251)
         ... 4 more
_______________________________________________
Users mailing list -- [email protected]
To unsubscribe send an email to [email protected]
Privacy Statement: https://www.ovirt.org/site/privacy-policy/
oVirt Code of Conduct: 
https://www.ovirt.org/community/about/community-guidelines/
List Archives: 
https://lists.ovirt.org/archives/list/[email protected]/message/IGLEJESNPJRX3P7ED6AUEFG7LD2PC6ZL/

_______________________________________________
Users mailing list -- [email protected]
To unsubscribe send an email to [email protected]
Privacy Statement: https://www.ovirt.org/site/privacy-policy/
oVirt Code of Conduct: 
https://www.ovirt.org/community/about/community-guidelines/
List Archives: 
https://lists.ovirt.org/archives/list/[email protected]/message/H4NJ72HVVYII3EAZ265Y5L75AIYQBT4H/

Reply via email to