Revision dc075e09

View differences:

src/scheduler/src/pool/VirtualMachineXML.cc
73 73
        }
74 74
    }
75 75

  
76
    result = ((*this)["/VM/USER_TEMPLATE/SCHED_REQUIREMENTS"]);
76
    result = ((*this)["/VM/TEMPLATE/AUTOMATIC_REQUIREMENTS"]);
77 77

  
78 78
    if (result.size() > 0)
79 79
    {
80 80
        requirements = result[0];
81 81
    }
82
    else
82

  
83
    result = ((*this)["/VM/USER_TEMPLATE/SCHED_REQUIREMENTS"]);
84

  
85
    if (result.size() > 0)
83 86
    {
84
        requirements = "";
87
        if ( !requirements.empty() )
88
        {
89
            ostringstream oss;
90

  
91
            oss << requirements << " & ( " << result[0] << " )";
92

  
93
            requirements = oss.str();
94
        }
95
        else
96
        {
97
            requirements = result[0];
98
        }
85 99
    }
86 100

  
87 101
    result = ((*this)["/VM/HISTORY_RECORDS/HISTORY/HID"]);
src/vm/VirtualMachine.cc
980 980
        oss.str("");
981 981
        oss << "CLUSTER_ID = " << cluster_id;
982 982

  
983
        user_obj_template->get("SCHED_REQUIREMENTS", requirements);
984
        user_obj_template->erase("SCHED_REQUIREMENTS");
985

  
986
        if ( !requirements.empty() )
987
        {
988
            oss << " & ( " << requirements << " )";
989
        }
990

  
991
        user_obj_template->add("SCHED_REQUIREMENTS", oss.str());
983
        obj_template->add("AUTOMATIC_REQUIREMENTS", oss.str());
992 984
    }
993 985

  
994 986
    return 0;

Also available in: Unified diff