~gmb/maas/dont-powercheck-broken-nodes-bug-1402243

« back to all changes in this revision

Viewing changes to src/provisioningserver/rpc/power.py

  • Committer: MaaS Lander
  • Author(s): Andres Rodriguez, Blake Rouse
  • Date: 2014-12-06 17:18:49 UTC
  • mfrom: (3402.1.3 maas)
  • Revision ID: maas_lander-20141206171849-ab1q3fm6na51gc9o
[r=andreserl][bug=1384424][author=andreserl] Support the ability to query the power status of sm15k using RESTAPI v2.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
61
61
# state for these power types.
62
62
# This is meant to be temporary until all the power types support
63
63
# querying the power state of a node.
64
 
QUERY_POWER_TYPES = ['amt', 'ipmi', 'mscm', 'ucsm', 'virsh']
 
64
QUERY_POWER_TYPES = ['amt', 'ipmi', 'mscm', 'sm15k', 'ucsm', 'virsh']
65
65
 
66
66
 
67
67
# Timeout for change_power_state(). We set it to 2 minutes by default,
232
232
        new_power_state = yield deferToThread(
233
233
            perform_power_change, system_id, hostname, power_type,
234
234
            'query', context)
235
 
        if new_power_state == power_change:
 
235
        if new_power_state == "unknown" or new_power_state == power_change:
236
236
            yield power_change_success(system_id, hostname, power_change)
237
237
            return
238
238
 
301
301
        try:
302
302
            power_state = yield deferToThread(
303
303
                perform_power_query, system_id, hostname, power_type, context)
304
 
            if power_state not in ("on", "off"):
 
304
            if power_state not in ("on", "off", "unknown"):
305
305
                # This is considered an error.
306
306
                raise PowerActionFail(power_state)
307
307
        except PowerActionFail as e: