[ovirt-users] Power Management with python SDK

Giulio Casella giulio at di.unimi.it
Tue Dec 1 09:16:47 EST 2015


Hi everybody,
I'm trying to enable power management on a host using python, but I'm stuck.

Previously (ovirt 3.5) I directly wrote power management parameters into 
PowerManagement structure (and everything was working fine), but 
starting from 3.6 this is not possible.

This is what I do now:

agent = params.Agent()
agent.set_options(params.Options())
agent.set_type("ilo3")
agent.set_username("admin")
agent.set_password("mysecret")
agent.set_address("172.20.20.1")

agents=params.Agents()
agents.add_agent(agent)

pm=params.PowerManagement()
pm.set_agents(agents)
pm.set_enabled(True)

myhost=api.hosts.get("myhost")
myhost.set_power_management(pm)
try:
	myhost.update()
except Exception as e:
	print "Error: %s" % e

and I get:

Error:
status: 400
reason: Bad Request
detail: Cannot edit Host. Power Management is enabled for Host but no 
Agent type selected.


If I dont't enable PM (pm.set_enabled line above) I get no error, but no 
agent is added.

My software is:
- ovirt-engine-3.6.0.3-1.el6
- ovirt-engine-sdk-python-3.6.0.3-1.el6
on a CentOS 6.6 distro.

Any ideas?

Thanks in advance,
Giulio


More information about the Users mailing list