Enable power management on Host
by scott.fitzgerald@oracle.com
Hi,
I am currently trying to enable Power Management on a host. I have created a PowerManagementBuilder object, with an AgentBuilder. However, I am getting the error
.Error: Fault reason is "Operation Failed". Fault detail is "[Cannot edit Host. Power Management is enabled for Host but no Agent type selected.]". HTTP response code is "400". HTTP response message is "Bad Request"
sysService.hostsService().hostService(HostUtils.getHostObjectFromName(sysService, vdsmHostName).id()).update().host(host().powerManagement(powerManagementBuilder.build())).send();
Am I missing a step? Or could someone post the snippet of building an Agent and PowerManagement object so I can check against what I'm doing (below).
TIA
PowerManagementBuilder powerManagementBuilder = new PowerManagementBuilder();
AgentBuilder agentBuilder = new AgentBuilder();
agentBuilder.address(address);
agentBuilder.concurrent(true);
agentBuilder.host(host);
agentBuilder.id("newAgent");
agentBuilder.name("newAgent");
agentBuilder.username("test");
agentBuilder.type("apc");
agentBuilder.port(22);
agentBuilder.password("xxx");
sysService.hostsService().hostService(host.update().host(host().agents(agentBuilder.build())).send();
powerManagementBuilder.address(address);
powerManagementBuilder.agents(agentBuilder.build());
powerManagementBuilder.automaticPmEnabled(true);
powerManagementBuilder.enabled(true);
powerManagementBuilder.password("xxx");
powerManagementBuilder.type("apc");
powerManagementBuilder.username("test");
sysService.hostsService().hostService(host).update().host(host().powerManagement(powerManagementBuilder.build())).send();