Ejemplo n.º 1
0
 def _generate_task(self):
     return migrate.MigrationTask(self.context, self.instance, self.flavor,
                                  self.request_spec,
                                  self.clean_shutdown,
                                  compute_rpcapi.ComputeAPI(),
                                  scheduler_client.SchedulerClient(),
                                  host_list=None)
Ejemplo n.º 2
0
 def _build_cold_migrate_task(self, context, instance, flavor,
                              filter_properties, request_spec, reservations,
                              clean_shutdown):
     return migrate.MigrationTask(context, instance, flavor,
                                  filter_properties, request_spec,
                                  reservations, clean_shutdown,
                                  self.compute_rpcapi,
                                  self.scheduler_client)
Ejemplo n.º 3
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,
                                  network_api=self.mock_network_api)
Ejemplo n.º 4
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)
 def _generate_task(self):
     return migrate.MigrationTask(self.context, self.instance, self.flavor,
                                  self.filter_properties, self.request_spec,
                                  self.reservations, self.clean_shutdown,
                                  compute_rpcapi.ComputeAPI(),
                                  scheduler_client.SchedulerClient())