Ejemplo n.º 1
0
 def test_aggregate_add_host_placement_missing_provider(
         self, mock_log, mock_pc_add_host):
     hostname = 'fake-host'
     err = exception.ResourceProviderNotFound(name_or_uuid=hostname)
     mock_pc_add_host.side_effect = err
     aggregate = self.aggregate_api.create_aggregate(
         self.ctxt, 'aggregate', None)
     self.aggregate_api.add_host_to_aggregate(self.ctxt, aggregate.id,
                                              hostname)
     # Nothing should blow up in Rocky, but we should get a warning
     msg = ("Failed to associate %s with a placement "
            "aggregate: %s. This may be corrected after running "
            "nova-manage placement sync_aggregates.")
     mock_log.assert_called_with(msg, hostname, err)
Ejemplo n.º 2
0
 def test_aggregate_remove_host_placement_missing_provider(
         self, mock_log, mock_pc_remove_host, mock_agg_obj_delete_host):
     hostname = 'fake-host'
     err = exception.ResourceProviderNotFound(name_or_uuid=hostname)
     mock_pc_remove_host.side_effect = err
     aggregate = self.aggregate_api.create_aggregate(
         self.ctxt, 'aggregate', None)
     self.aggregate_api.remove_host_from_aggregate(self.ctxt, aggregate.id,
                                                   hostname)
     # Nothing should blow up in Rocky, but we should get a warning
     msg = ("Failed to remove association of %s with a placement "
            "aggregate: %s.")
     mock_log.assert_called_with(msg, hostname, err)
     # In this case Aggregate.delete_host is still called because the
     # ResourceProviderNotFound error is just logged.
     mock_agg_obj_delete_host.assert_called_once_with(hostname)