Ejemplo n.º 1
0
    def get_power_state(self, task):
        """Gets the current power state.

        :param task: a TaskManager instance.
        :param node: The Node.
        :returns: one of :mod:`ironic.common.states` POWER_OFF,
                  POWER_ON or ERROR.
        :raises: OneViewError if fails to retrieve power state of OneView
                 resource
        """

        oneview_info = common.get_oneview_info(task.node)
        oneview_client = common.get_oneview_client()
        try:
            power_state = oneview_client.get_node_power_state(oneview_info)
        except oneview_exceptions.OneViewException as oneview_exc:
            LOG.error(
                _LE("Error getting power state for node %(node)s. Error:" "%(error)s"),
                {"node": task.node.uuid, "error": oneview_exc},
            )
            raise exception.OneViewError(error=oneview_exc)
        return common.translate_oneview_power_state(power_state)
Ejemplo n.º 2
0
    def get_power_state(self, task):
        """Gets the current power state.

        :param task: a TaskManager instance.
        :param node: The Node.
        :returns: one of :mod:`ironic.common.states` POWER_OFF,
                  POWER_ON or ERROR.
        :raises: OneViewError if fails to retrieve power state of OneView
                 resource
        """
        oneview_info = common.get_oneview_info(task.node)

        oneview_client = common.get_oneview_client()
        try:
            power_state = oneview_client.get_node_power_state(oneview_info)
        except oneview_exceptions.OneViewException as oneview_exc:
            LOG.error(
                _LE("Error getting power state for node %(node)s. Error:"
                    "%(error)s"),
                {'node': task.node.uuid, 'error': oneview_exc}
            )
            raise exception.OneViewError(error=oneview_exc)
        return common.translate_oneview_power_state(power_state)
Ejemplo n.º 3
0
 def _test_translate_oneview_states(self, power_state_to_translate,
                                    expected_translated_power_state):
     translated_power_state = common.translate_oneview_power_state(
         power_state_to_translate)
     self.assertEqual(translated_power_state,
                      expected_translated_power_state)
Ejemplo n.º 4
0
 def _test_translate_oneview_states(self, power_state_to_translate,
                                    expected_translated_power_state):
     translated_power_state = common.translate_oneview_power_state(
         power_state_to_translate)
     self.assertEqual(translated_power_state,
                      expected_translated_power_state)