Example #1
0
 def _generate_task(self):
     self.task = live_migrate.LiveMigrationTask(
         self.context, self.instance, self.destination,
         self.block_migration, self.disk_over_commit, self.migration,
         compute_rpcapi.ComputeAPI(), servicegroup.API(),
         query.SchedulerQueryClient(), report.SchedulerReportClient(),
         self.fake_spec)
Example #2
0
 def _generate_task(self):
     return migrate.MigrationTask(self.context,
                                  self.instance,
                                  self.flavor,
                                  self.request_spec,
                                  self.clean_shutdown,
                                  compute_rpcapi.ComputeAPI(),
                                  query.SchedulerQueryClient(),
                                  report.SchedulerReportClient(),
                                  host_list=None)
Example #3
0
    def test_execute_reschedule(self, mock_elevated, mock_claim,
                                mock_fill_provider_mapping):
        report_client = report.SchedulerReportClient()
        # setup task for re-schedule
        alloc_req = {
            "allocations": {
                uuids.host1: {
                    "resources": {
                        "VCPU": 1,
                        "MEMORY_MB": 1024,
                        "DISK_GB": 100
                    }
                }
            }
        }
        alternate_selection = objects.Selection(
            service_host="host1",
            nodename="node1",
            cell_uuid=uuids.cell1,
            allocation_request=jsonutils.dumps(alloc_req),
            allocation_request_version='1.19')
        task = migrate.MigrationTask(self.context,
                                     self.instance,
                                     self.flavor,
                                     self.request_spec,
                                     self.clean_shutdown,
                                     compute_rpcapi.ComputeAPI(),
                                     query.SchedulerQueryClient(),
                                     report_client,
                                     host_list=[alternate_selection],
                                     network_api=self.mock_network_api)
        mock_claim.return_value = True

        actual_selection = task._reschedule()

        self.assertIs(alternate_selection, actual_selection)
        mock_claim.assert_called_once_with(mock_elevated.return_value,
                                           report_client, self.request_spec,
                                           self.instance.uuid, alloc_req,
                                           '1.19')
        mock_fill_provider_mapping.assert_called_once_with(
            self.context, report_client, self.request_spec,
            alternate_selection)
Example #4
0
    def setUp(self):
        super(SchedulerQueryClientTestCase, self).setUp()
        self.context = context.get_admin_context()

        self.client = scheduler_query_client.SchedulerQueryClient()
Example #5
0
 def __init__(self):
     self.queryclient = query.SchedulerQueryClient()
     self.reportclient = report.SchedulerReportClient()