Revision 685b219e

b/logic/backend.py
27 27
    # Notifications of success change the operating state
28 28
    if status == 'success':
29 29
        utils.update_state(vm, VirtualMachine.OPER_STATE_FROM_OPCODE[opcode])
30
    # Special cases OP_INSTANCE_CREATE fails --> ERROR
30
        # Set the deleted flag explicitly, to cater for admin-initiated removals
31
        if opcode == 'OP_INSTANCE_REMOVE':
32
            vm.deleted = True
33

  
34
    # Special case: if OP_INSTANCE_CREATE fails --> ERROR
31 35
    if status in ('canceled', 'error') and opcode == 'OP_INSTANCE_CREATE':
32 36
        utils.update_state(vm, 'ERROR')
33 37
    # Any other notification of failure leaves the operating state unchanged
b/logic/utils.py
32 32
        r = VirtualMachine.RSAPI_STATE_FROM_OPER_STATE[vm.operstate]
33 33
    except KeyError:
34 34
        return "UNKNOWN"
35
    # A machine is DELETED if the deleted flag has been set
36
    if vm.deleted:
37
        return "DELETED"
35 38
    # A machine is in REBOOT if an OP_INSTANCE_REBOOT request is in progress
36 39
    if r == 'ACTIVE' and vm.backendopcode == 'OP_INSTANCE_REBOOT' and \
37 40
        vm.backendjobstatus in ('queued', 'waiting', 'running'):

Also available in: Unified diff