When XenServer disable/enable host, the api set_host_enabled() need to get service info for the target host, but the rpc call of set_host_enabled() did not transfer host as parameter, this will cause the api call failed.
def set_host_enabled(self, host, enabled):
"""Sets the specified host's ability to accept new instances."""
# Since capabilities are gone, use service table to disable a node
# in scheduler
status = {'disabled': not enabled,
'disabled_reason': 'set by xenapi host_state'
}
cntxt = context.get_admin_context()
service = self._conductor_api.service_get_by_args(
cntxt,
host, <<<<<<<<<
'nova-compute')
self._conductor_api.service_update(
cntxt,
service,
status)
args = {"enabled": jsonutils.dumps(enabled)}
response = call_xenhost(self._session, "set_host_enabled", args)
return response.get("status", response)
======================================
def set_host_enabled(self, ctxt, enabled, host):
cctxt = self.client.prepare(server=host)
return cctxt.call(ctxt, 'set_host_enabled', enabled=enabled) <<<<<<<<<< No host
Fix proposed to branch: master /review. openstack. org/56812
Review: https:/