Revision 88fd91af snf-cyclades-app/synnefo/logic/backend.py

b/snf-cyclades-app/synnefo/logic/backend.py
69 69

  
70 70
    """
71 71
    if job_status not in ["success", "error", "canceled"]:
72
        return
72
        return vm
73 73

  
74 74
    # Check successful completion of a job will trigger any quotable change in
75 75
    # the VM state.
76 76
    action = utils.get_action_from_opcode(job_opcode, job_fields)
77
    if action == "BUILD":
78
        # Quotas for new VMs are automatically accepted by the API
79
        return vm
77 80
    commission_info = quotas.get_commission_info(vm, action=action,
78 81
                                                 action_fields=job_fields)
79 82

  
......
83 86
        # if fails, must be accepted, as the user must manually remove the
84 87
        # failed server
85 88
        serial = vm.serial
86
        if job_status == "success" or job_opcode == "OP_INSTANCE_CREATE":
89
        if job_status == "success":
87 90
            quotas.accept_serial(serial)
88 91
        elif job_status in ["error", "canceled"]:
89 92
            log.debug("Job %s failed. Rejecting related serial %s", job_id,

Also available in: Unified diff