import org.ovirt.engine.sdk.Api; import org.ovirt.engine.sdk.decorators.Host; import org.ovirt.engine.sdk.entities.PowerManagement; public class debugRemove { private static final String URL = "https://ilia-rhevm.qa.lab.tlv.redhat.com:443/api"; public static void main(String[] args) throws Exception { Api api = new Api(URL, "admin@internal", "123456", true); Host hst = (Host) api.getHosts().list().get(0); PowerManagement pm = new PowerManagement(); pm.setType("apc"); Boolean bl = new Boolean("true"); pm.setEnabled(bl); hst.setPowerManagement(pm); hst.update(); api.close(); } } raises next exception: Exception in thread "main" code : 400 reason: Bad Request detail: may not be null at org.ovirt.engine.sdk.web.HttpProxy.execute(HttpProxy.java:118) at org.ovirt.engine.sdk.web.HttpProxyBroker.update(HttpProxyBroker.java:104) at org.ovirt.engine.sdk.decorators.Host.update(Host.java:390) at debugRemove.main(debugRemove.java:17)
verified with is23, now getting meaningful message: Exception in thread "main" code : 400 reason: Bad Request detail: Cannot edit Host. Power Management is enabled for Host but Agent credentials are missing. at org.ovirt.engine.sdk.web.HttpProxy.execute(HttpProxy.java:118) at org.ovirt.engine.sdk.web.HttpProxyBroker.update(HttpProxyBroker.java:104) at org.ovirt.engine.sdk.decorators.Host.update(Host.java:398) at java_sdk_testing.JavaSDKTestDebug.main(JavaSDKTestDebug.java:19)
Closing - RHEV 3.3 Released