Comment 5 for bug 1508741

Revision history for this message
Gavin Panella (allenap) wrote :

I wonder if the UI calls MAAS's Web API rather than going via the
WebSocket API for this? If so, I can see an inconsistency in
maasserver.api.nodes:

class NodeHandler(OperationsHandler):
    ...
    @operation(idempotent=True)
    def query_power_state(self, request, system_id):
        ...
        call = client(
            PowerQuery, system_id=system_id, hostname=node.hostname,
            power_type=power_info.power_type,
            context=power_info.power_parameters)
        try:
            state = call.wait(POWER_QUERY_TIMEOUT)
        except crochet.TimeoutError:
            maaslog.error(
                "%s: Timed out waiting for power response in Node.power_state",
                node.hostname)
-->         raise PowerProblem("Timed out waiting for power response")
        except PowerActionFail as e:
            addTask(node.update_power_state, POWER_STATE.ERROR)
            raise PowerProblem(e)
        except NotImplementedError as e:
            addTask(node.update_power_state, POWER_STATE.UNKNOWN)
            raise PowerProblem(e)

Other call-sites for the PowerQuery RPC call deal with time-outs by
setting the power state to "error", whereas this only re-raises the
exception. Adding:

            addTask(node.update_power_state, POWER_STATE.ERROR)

to that except: block might be enough to fix this bug.