'Tests that the select_destinations() method properly handles
resetting host state objects and raising NoValidHost when the
_schedule() method returns no host matches.'

@mock.patch('nova.scheduler.filter_scheduler.FilterScheduler._schedule')
def test_select_destinations_fewer_num_instances(self, mock_schedule):

    spec_obj = objects.RequestSpec(flavor=objects.Flavor(memory_mb=512, root_gb=512, ephemeral_gb=0, swap=0, vcpus=1), project_id=uuids.project_id, num_instances=2)
    host_state = mock.Mock(spec=host_manager.HostState)
    mock_schedule.return_value = [host_state]
    self.assertRaises(exception.NoValidHost, self.driver.select_destinations, self.context, spec_obj, mock.sentinel.instance_uuids, mock.sentinel.alloc_reqs_by_rp_uuid, mock.sentinel.p_sums)
    self.assertIsNone(host_state.updated)
