Пример #1
0
    def test_erase_devices_in_progress(self, controller_exec_cmd_mock,
                                       get_all_details_mock):
        erase_progress = raid_constants.SSA_ERASE_IN_PROGRESS
        erase_complete = raid_constants.SSA_ERASE_COMPLETE

        expt_ret = {
            'Smart Array P440 in Slot 2': {
                '1I:2:1': 'Erase Complete. Reenable Before Using.'
            }
        }
        get_all_details_mock.side_effect = [
            erase_progress, erase_complete, erase_complete
        ]

        ret = manager.erase_devices()
        self.assertFalse(controller_exec_cmd_mock.called)
        self.assertEqual(expt_ret, ret)
    def erase_devices(self, node, port):
        """Erase the drives on the bare metal.

        This method erase all the drives which supports sanitize on
        bare metal. If fails, it falls back to the generic erase method.
        :returns: The dictionary of controllers with the drives and erase
            status for each drive.
        """
        try:
            result = {}
            result['Sanitize Erase'] = hpssa_manager.erase_devices()

        except exception.HPSSAOperationError:
            result.update(
                super(ProliantHardwareManager, self).erase_devices(node, port))

        return result
Пример #3
0
    def test_erase_devices_in_progress(self, controller_exec_cmd_mock,
                                       sleep_mock,
                                       get_all_details_mock):

        erase_drive = raid_constants.SSA_ERASE_DRIVE
        erase_progress = raid_constants.SSA_ERASE_IN_PROGRESS
        erase_complete = raid_constants.SSA_ERASE_COMPLETE

        expt_ret = {
            'Smart Array P440 in Slot 2': {
                '1I:2:1': 'Erase Complete. Reenable Before Using.',
                'Summary': ('Sanitize Erase performed on the disks attached to'
                            ' the controller.')}}
        get_all_details_mock.side_effect = [erase_drive, erase_progress,
                                            erase_complete, erase_complete]

        ret = manager.erase_devices()
        self.assertTrue(controller_exec_cmd_mock.called)
        self.assertEqual(expt_ret, ret)
        self.assertTrue(sleep_mock.called)
Пример #4
0
    def erase_devices(self, node, port):
        """Erase the drives on the bare metal.

        This method erase all the drives which supports sanitize and the drives
        which are not part of any logical volume on the bare metal. It calls
        generic erase method after the success of Sanitize disk erase.
        :param node: A dictionary of the node object.
        :param port: A list of dictionaries containing information of ports
            for the node.
        :raises exception.HPSSAOperationError, if there is a failure on the
            erase operation on the controllers.
        :returns: The dictionary of controllers with the drives and erase
            status for each drive.
        """
        result = {}
        result['Disk Erase Status'] = hpssa_manager.erase_devices()

        result.update(
            super(ProliantHardwareManager, self).erase_devices(node, port))
        return result
Пример #5
0
    def test_erase_devices(self, controller_exec_cmd_mock,
                           get_all_details_mock):
        erase_drive = raid_constants.SSA_ERASE_DRIVE
        erase_complete = raid_constants.SSA_ERASE_COMPLETE
        cmd_args = []
        cmd_args.append("pd 1I:2:1")
        cmd_args.extend([
            'modify', 'erase', 'erasepattern=overwrite', 'unrestricted=off',
            'forced'
        ])
        expt_ret = {
            'Smart Array P440 in Slot 2': {
                '1I:2:1': 'Erase Complete. Reenable Before Using.'
            }
        }
        get_all_details_mock.side_effect = [
            erase_drive, erase_complete, erase_complete
        ]

        ret = manager.erase_devices()
        self.assertTrue(controller_exec_cmd_mock.called)
        controller_exec_cmd_mock.assert_any_call(*cmd_args)
        self.assertEqual(expt_ret, ret)
Пример #6
0
    def test_erase_devices_not_supported(self, controller_exec_cmd_mock,
                                         sleep_mock,
                                         get_all_details_mock):
        erase_not_supported = raid_constants.SSA_ERASE_NOT_SUPPORTED
        erase_complete = raid_constants.SSA_ERASE_COMPLETE_NOT_SUPPORTED
        erase_progress = raid_constants.SSA_ERASE_IN_PROGRESS_NOT_SUPPORTED
        get_all_details_mock.side_effect = [erase_not_supported,
                                            erase_progress,
                                            erase_complete, erase_complete]
        value = ("Drive 1I:2:1: This operation is not supported in this "
                 "physical drive")
        controller_exec_cmd_mock.return_value = value
        expt_ret = {
            'Smart Array P440 in Slot 2': {
                '1I:2:1': 'Erase Complete. Reenable Before Using.',
                'Summary': ('Drives overwritten with zeros because '
                            'sanitize erase is not supported on the '
                            'controller.')
                }}

        ret = manager.erase_devices()
        self.assertEqual(expt_ret, ret)
        self.assertTrue(controller_exec_cmd_mock.called)
        self.assertTrue(sleep_mock.called)