Revision 87f5c298 lib/backend.py

b/lib/backend.py
2605 2605
    @param idata: the allocator input data
2606 2606

  
2607 2607
    @rtype: tuple
2608
    @return: four element tuple of:
2609
       - run status (one of the IARUN_ constants)
2610
       - stdout
2611
       - stderr
2612
       - fail reason (as from L{utils.RunResult})
2608
    @return: two element tuple of:
2609
       - status
2610
       - either error message or stdout of allocator (for success)
2613 2611

  
2614 2612
    """
2615 2613
    alloc_script = utils.FindFile(name, constants.IALLOCATOR_SEARCH_PATH,
2616 2614
                                  os.path.isfile)
2617 2615
    if alloc_script is None:
2618
      return (constants.IARUN_NOTFOUND, None, None, None)
2616
      _Fail("iallocator module '%s' not found in the search path", name)
2619 2617

  
2620 2618
    fd, fin_name = tempfile.mkstemp(prefix="ganeti-iallocator.")
2621 2619
    try:
......
2623 2621
      os.close(fd)
2624 2622
      result = utils.RunCmd([alloc_script, fin_name])
2625 2623
      if result.failed:
2626
        return (constants.IARUN_FAILURE, result.stdout, result.stderr,
2627
                result.fail_reason)
2624
        _Fail("iallocator module '%s' failed: %s, output '%s'",
2625
              name, result.fail_reason, result.output)
2628 2626
    finally:
2629 2627
      os.unlink(fin_name)
2630 2628

  
2631
    return (constants.IARUN_SUCCESS, result.stdout, result.stderr, None)
2629
    return True, result.stdout
2632 2630

  
2633 2631

  
2634 2632
class DevCacheManager(object):

Also available in: Unified diff