Exemple #1
0
    def test_set_boot_device_with_multiple_unfinished_jobs_with_clean_step(
            self, mock__get_next_persistent_boot_mode, mock__get_boot_device,
            mock_list_unfinished_jobs, mock_validate_job_queue,
            mock_get_drac_client):
        mock_client = mock.Mock()
        mock_get_drac_client.return_value = mock_client

        job_dict = {
            'id': 'JID_602553293345',
            'name': 'Config:RAID:RAID.Integrated.1-1',
            'start_time': 'TIME_NOW',
            'until_time': 'TIME_NA',
            'message': 'Task successfully scheduled.',
            'status': 'Scheduled',
            'percent_complete': 0
        }
        job = test_utils.make_job(job_dict)

        bios_job_dict = {
            'id': 'JID_602553293346',
            'name': 'ConfigBIOS:BIOS.Setup.1-1',
            'start_time': 'TIME_NOW',
            'until_time': 'TIME_NA',
            'message': 'Task successfully scheduled.',
            'status': 'Scheduled',
            'percent_complete': 0
        }
        bios_job = test_utils.make_job(bios_job_dict)

        mock_list_unfinished_jobs.return_value = [job, bios_job]
        mock_client.list_boot_devices.return_value = self.boot_devices['IPL']
        boot_device = {
            'boot_device': ironic.common.boot_devices.DISK,
            'persistent': True
        }

        mock__get_boot_device.return_value = boot_device
        mock__get_next_persistent_boot_mode.return_value = 'IPL'

        self.node.driver_internal_info['clean_steps'] = [{
            u'interface':
            u'management',
            u'step':
            u'clear_job_queue'
        }]

        drac_mgmt.set_boot_device(self.node,
                                  ironic.common.boot_devices.DISK,
                                  persistent=True)
        mock_list_unfinished_jobs.assert_called_once_with(self.node)
        mock_client.delete_jobs.assert_called_once_with(
            job_ids=['JID_602553293345', 'JID_602553293346'])

        self.assertEqual(0, mock_validate_job_queue.call_count)
Exemple #2
0
 def setUp(self):
     super(DracJobTestCase, self).setUp()
     self.node = obj_utils.create_test_node(self.context,
                                            driver='idrac',
                                            driver_info=INFO_DICT)
     self.job_dict = {
         'id': 'JID_001436912645',
         'name': 'ConfigBIOS:BIOS.Setup.1-1',
         'start_time': '00000101000000',
         'until_time': 'TIME_NA',
         'message': 'Job in progress',
         'status': 'Running',
         'percent_complete': 34}
     self.job = test_utils.make_job(self.job_dict)