Ejemplo n.º 1
0
 def test_wait_for_ilo_after_reset_ribcl_ok(self, name_mock):
     # | GIVEN |
     name_mock.return_value = ribcl_output.GET_PRODUCT_NAME
     # | WHEN |
     common.wait_for_ilo_after_reset(self.ribcl)
     # | THEN |
     name_mock.assert_called_once_with()
Ejemplo n.º 2
0
 def test_wait_for_ilo_after_reset_ribcl_ok(self, name_mock):
     # | GIVEN |
     name_mock.return_value = ribcl_output.GET_PRODUCT_NAME
     # | WHEN |
     common.wait_for_ilo_after_reset(self.ribcl)
     # | THEN |
     name_mock.assert_called_once_with()
Ejemplo n.º 3
0
 def test_wait_for_ilo_after_reset_retry(self, name_mock, sleep_mock):
     # | GIVEN |
     exc = exception.IloError('error')
     name_mock.side_effect = [exc, ribcl_output.GET_PRODUCT_NAME]
     # | WHEN |
     common.wait_for_ilo_after_reset(self.ribcl)
     # | THEN |
     self.assertEqual(2, name_mock.call_count)
     name_mock.assert_called_with()
Ejemplo n.º 4
0
    def reset_ilo(self):
        """Resets the iLO.

        :raises: IloError, on an error from iLO.
        :raises: IloConnectionError, if iLO is not up after reset.
        """
        self._execute_command('RESET_RIB', 'RIB_INFO', 'write')
        # Check if iLO is up again after reset.
        common.wait_for_ilo_after_reset(self)
Ejemplo n.º 5
0
    def reset_ilo(self):
        """Resets the iLO.

        :raises: IloError, on an error from iLO.
        :raises: IloConnectionError, if iLO is not up after reset.
        """
        self._execute_command('RESET_RIB', 'RIB_INFO', 'write')
        # Check if iLO is up again after reset.
        common.wait_for_ilo_after_reset(self)
Ejemplo n.º 6
0
 def test_wait_for_ilo_after_reset_retry(self, name_mock, sleep_mock):
     # | GIVEN |
     exc = exception.IloError('error')
     name_mock.side_effect = [exc, ribcl_output.GET_PRODUCT_NAME]
     # | WHEN |
     common.wait_for_ilo_after_reset(self.ribcl)
     # | THEN |
     self.assertEqual(2, name_mock.call_count)
     name_mock.assert_called_with()
Ejemplo n.º 7
0
    def wait_for_redfish_firmware_update_to_complete(self, redfish_object):
        """Continuously polls for iLO firmware update to complete.

        :param redfish_object: redfish instance
        """
        p_state = ['Idle']
        c_state = ['Idle']

        def has_firmware_flash_completed():
            """Checks for completion status of firmware update operation

            The below table shows the conditions for which the firmware update
            will be considered as DONE (be it success or error)::

            +-----------------------------------+-----------------------------+
            |    Previous state                 |   Current state             |
            +===================================+=============================+
            |    Idle                           |   Error, Complete           |
            +-----------------------------------+-----------------------------+
            |    Updating, Verifying,           |   Complete, Error,          |
            |    Uploading, Writing             |   Unknown, Idle             |
            +-----------------------------------+-----------------------------+

            :returns: True upon firmware update completion otherwise False
            """
            curr_state, curr_percent = self.get_firmware_update_progress()
            p_state[0] = c_state[0]
            c_state[0] = curr_state
            if (((p_state[0]
                  in ['Updating', 'Verifying', 'Uploading', 'Writing']) and
                 (c_state[0] in ['Complete', 'Error', 'Unknown', 'Idle']))
                    or (p_state[0] == 'Idle' and
                        (c_state[0] in ['Complete', 'Error']))):
                return True
            return False

        common.wait_for_operation_to_complete(
            has_firmware_flash_completed,
            delay_bw_retries=30,
            failover_msg='iLO firmware update has failed.')
        common.wait_for_ilo_after_reset(redfish_object)