Revision 80f8c0be

View differences:

src/rm/RequestManagerVirtualMachine.cc
915 915

  
916 916
    if((vm->get_state()     != VirtualMachine::ACTIVE)  ||
917 917
       (vm->get_lcm_state() != VirtualMachine::RUNNING &&
918
        vm->get_lcm_state() != VirtualMachine::UNKNOWN &&
919
        vm->get_lcm_state() != VirtualMachine::PROLOG_MIGRATE_FAILURE) ||
918
        vm->get_lcm_state() != VirtualMachine::UNKNOWN) ||
920 919
       (vm->hasPreviousHistory() && vm->get_previous_reason() == History::NONE))
921 920
    {
922 921
        failure_response(ACTION,
......
941 940

  
942 941
    c_hid = vm->get_hid();
943 942

  
944
    if (vm->get_state() == VirtualMachine::ACTIVE &&
945
        vm->get_lcm_state() == VirtualMachine::PROLOG_MIGRATE_FAILURE)
943
    if (c_hid == hid)
946 944
    {
947
        enforce = false;
948
        live = false;
949

  
950
        int p_hid = c_hid;
951

  
952
        if(vm->hasPreviousHistory())
953
        {
954
            p_hid = vm->get_previous_hid();
955
        }
956

  
957
        if (hid != c_hid && hid != p_hid)
958
        {
959
            ostringstream oss;
960

  
961
            oss << "VM in state PROLOG_MIGRATE_FAILURE can only be migrated to "
962
                << object_name(PoolObjectSQL::HOST) << " [" << c_hid << "] or "
963
                << object_name(PoolObjectSQL::HOST) << " [" << p_hid << "]";
964

  
965
            failure_response(ACTION,
966
                    request_error(oss.str(),""),
967
                    att);
968

  
969
            vm->unlock();
970
            return;
971
        }
972
    }
973
    else
974
    {
975
        if (c_hid == hid)
976
        {
977
            ostringstream oss;
945
        ostringstream oss;
978 946

  
979
            oss << "VM is already running on "
980
                << object_name(PoolObjectSQL::HOST) << " [" << c_hid << "]";
947
        oss << "VM is already running on "
948
            << object_name(PoolObjectSQL::HOST) << " [" << c_hid << "]";
981 949

  
982
            failure_response(ACTION,
983
                    request_error(oss.str(),""),
984
                    att);
950
        failure_response(ACTION,
951
                request_error(oss.str(),""),
952
                att);
985 953

  
986
            vm->unlock();
987
            return;
988
        }
954
        vm->unlock();
955
        return;
989 956
    }
990 957

  
991 958
    // Get System DS information from current History record

Also available in: Unified diff